aboutsummaryrefslogtreecommitdiffstats
path: root/src/account
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2021-04-06 17:38:49 +0000
committerGerrit Code Review <gerrit@opnfv.org>2021-04-06 17:38:49 +0000
commit241ff304980c8bf542fdd1a2a47f73accf912ee1 (patch)
tree0192336d1a72df98ca5056b190f6d29e683079a0 /src/account
parentf1456220fcc098cb0f5e9fc60124680ff8aba6af (diff)
parentd007fa661e2faf77e70cb75c8d520941e907ebf7 (diff)
Merge "Remove exposure of users on dashboard"
Diffstat (limited to 'src/account')
-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
6 files changed, 60 insertions, 3 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