Skip to content

Commit

Permalink
Merge pull request ome#5801 from mtbc/cannot-edit-root-user-role
Browse files Browse the repository at this point in the history
in webadmin gray out user role when editing root user
  • Loading branch information
sbesson authored Jul 3, 2018
2 parents a1d9686 + 794541c commit 86bf287
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions components/tools/OmeroWeb/omeroweb/webadmin/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008-2014 University of Dundee.
# Copyright (c) 2008-2018 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -151,7 +151,8 @@ def __init__(self, name_check=False, email_check=False,
initial='user')
# If current user is restricted Admin, can't create full Admin
restricted_admin = "ReadSession" not in self.user_privileges
self.fields['role'].widget.renderer.disable_admin = restricted_admin
self.fields['role'].widget.renderer.disable_admin = \
restricted_admin or experimenter_root

if ('with_password' in kwargs['initial'] and
kwargs['initial']['with_password']):
Expand Down
4 changes: 2 additions & 2 deletions components/tools/OmeroWeb/omeroweb/webadmin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
#
#
# Copyright (c) 2008-2014 University of Dundee.
# Copyright (c) 2008-2018 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -506,7 +506,7 @@ def manage_experimenter(request, action, eid=None, conn=None, **kwargs):
role = 'restricted_administrator'
initial['role'] = role

root_id = [conn.getAdminService().getSecurityRoles().rootId]
root_id = conn.getAdminService().getSecurityRoles().rootId
user_id = conn.getUserId()
experimenter_root = long(eid) == root_id
experimenter_me = long(eid) == user_id
Expand Down

0 comments on commit 86bf287

Please sign in to comment.