mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
users: Minor fix to return value when getting last admin user
Tests: - When only when admin user is present, the users list does not show delete button next to the admin user. The checkbox for admin group is disabled (but checked) for that user in edit user form. - When there are multiple admin users preset, the users list shows delete button against all admin users. The checkbox for admin group is enabled (but checked) for all admin users. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
caa266e348
commit
2317e6bd94
@ -129,7 +129,7 @@ def get_last_admin_user():
|
||||
output = actions.superuser_run('users', ['get-group-users', 'admin'])
|
||||
admin_users = output.strip().split('\n')
|
||||
|
||||
if len(admin_users) == 1:
|
||||
if len(admin_users) == 1 and admin_users[0]:
|
||||
return admin_users[0]
|
||||
|
||||
return None
|
||||
|
||||
@ -80,9 +80,7 @@ class UserList(ContextMixin, django.views.generic.ListView):
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(UserList, self).get_context_data(*args, **kwargs)
|
||||
last_admin_user = get_last_admin_user()
|
||||
if last_admin_user is not None:
|
||||
context['last_admin_user'] = last_admin_user
|
||||
context['last_admin_user'] = get_last_admin_user()
|
||||
return context
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user