aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Smith <ssmith@iol.unh.edu>2021-03-24 17:22:54 -0400
committerSean Smith <ssmith@iol.unh.edu>2021-03-29 16:21:47 -0400
commitd007fa661e2faf77e70cb75c8d520941e907ebf7 (patch)
tree69b83bf903635768ac8614bfd799de998bb046ea
parentf6753ae2c5f54fb79375214590e565218b1bf0d7 (diff)
Remove exposure of users on dashboard
Signed-off-by: Sean Smith <ssmith@iol.unh.edu> Change-Id: I83b93d9247a7eafb54e4a5761d1423a504d86400
-rw-r--r--src/account/forms.py5
-rw-r--r--src/account/migrations/0007_userprofile_pulic_user.py18
-rw-r--r--src/account/migrations/0008_auto_20210324_2106.py18
-rw-r--r--src/account/migrations/0009_auto_20210324_2107.py18
-rw-r--r--src/account/models.py2
-rw-r--r--src/account/views.py2
-rw-r--r--src/booking/forms.py2
-rw-r--r--src/booking/lib.py2
8 files changed, 62 insertions, 5 deletions
diff --git a/src/account/forms.py b/src/account/forms.py
index dd1a0a9..28cb27d 100644
--- a/src/account/forms.py
+++ b/src/account/forms.py
@@ -18,11 +18,12 @@ from account.models import UserProfile
class AccountSettingsForm(forms.ModelForm):
class Meta:
model = UserProfile
- fields = ['company', 'email_addr', 'ssh_public_key', 'pgp_public_key', 'timezone']
+ fields = ['company', 'email_addr', 'public_user', 'ssh_public_key', 'pgp_public_key', 'timezone']
labels = {
'email_addr': _('Email Address'),
'ssh_public_key': _('SSH Public Key'),
- 'pgp_public_key': _('PGP Public Key')
+ 'pgp_public_key': _('PGP Public Key'),
+ 'public_user': _('Public User')
}
timezone = forms.ChoiceField(choices=[(x, x) for x in pytz.common_timezones], initial='UTC')
diff --git a/src/account/migrations/0007_userprofile_pulic_user.py b/src/account/migrations/0007_userprofile_pulic_user.py
new file mode 100644
index 0000000..6a229e6
--- /dev/null
+++ b/src/account/migrations/0007_userprofile_pulic_user.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.2 on 2021-03-24 21:06
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0006_auto_20201109_1947'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='userprofile',
+ name='pulic_user',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/src/account/migrations/0008_auto_20210324_2106.py b/src/account/migrations/0008_auto_20210324_2106.py
new file mode 100644
index 0000000..9ff513d
--- /dev/null
+++ b/src/account/migrations/0008_auto_20210324_2106.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.2 on 2021-03-24 21:06
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0007_userprofile_pulic_user'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='userprofile',
+ old_name='pulic_user',
+ new_name='public_user',
+ ),
+ ]
diff --git a/src/account/migrations/0009_auto_20210324_2107.py b/src/account/migrations/0009_auto_20210324_2107.py
new file mode 100644
index 0000000..baa7382
--- /dev/null
+++ b/src/account/migrations/0009_auto_20210324_2107.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.2 on 2021-03-24 21:07
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('account', '0008_auto_20210324_2106'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='userprofile',
+ name='public_user',
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/src/account/models.py b/src/account/models.py
index 2a7b017..b71f0ac 100644
--- a/src/account/models.py
+++ b/src/account/models.py
@@ -54,6 +54,8 @@ class UserProfile(models.Model):
full_name = models.CharField(max_length=100, null=True, blank=True, default='')
booking_privledge = models.BooleanField(default=False)
+ public_user = models.BooleanField(default=False)
+
class Meta:
db_table = 'user_profile'
diff --git a/src/account/views.py b/src/account/views.py
index 2e1ab94..b74126e 100644
--- a/src/account/views.py
+++ b/src/account/views.py
@@ -209,7 +209,7 @@ class UserListView(TemplateView):
template_name = "account/user_list.html"
def get_context_data(self, **kwargs):
- users = User.objects.all()
+ users = UserProfile.objects.filter(public_user=True).select_related('user')
context = super(UserListView, self).get_context_data(**kwargs)
context.update({'title': "Dashboard Users", 'users': users})
return context
diff --git a/src/booking/forms.py b/src/booking/forms.py
index 2a8784f..b2df799 100644
--- a/src/booking/forms.py
+++ b/src/booking/forms.py
@@ -40,7 +40,7 @@ class QuickBookingForm(forms.Form):
)
self.fields['users'] = SearchableSelectMultipleField(
- queryset=UserProfile.objects.select_related('user').exclude(user=user),
+ queryset=UserProfile.objects.filter(public_user=True).select_related('user').exclude(user=user),
items=get_user_items(exclude=user),
required=False,
**get_user_field_opts()
diff --git a/src/booking/lib.py b/src/booking/lib.py
index 8132c75..7a4c261 100644
--- a/src/booking/lib.py
+++ b/src/booking/lib.py
@@ -23,7 +23,7 @@ def get_user_field_opts():
def get_user_items(exclude=None):
- qs = UserProfile.objects.select_related('user').exclude(user=exclude)
+ qs = UserProfile.objects.filter(public_user=True).select_related('user').exclude(user=exclude)
items = {}
for up in qs:
item = {