# HG changeset patch # User Marcin Kuzminski # Date 2012-06-10 00:24:19 # Node ID 751c1c56e08026b4344c3aa5cc2c7cc282761acf # Parent d6efacde970f4aa59db8eb37ba744a00416cd085 #478 permissions overview for admin in user edit view diff --git a/docs/changelog.rst b/docs/changelog.rst --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -31,6 +31,7 @@ news reformated based on user suggestions. Additional rss/atom feeds for user journal - various i18n improvements +- #478 permissions overview for admin in user edit view fixes +++++ diff --git a/rhodecode/controllers/admin/users.py b/rhodecode/controllers/admin/users.py --- a/rhodecode/controllers/admin/users.py +++ b/rhodecode/controllers/admin/users.py @@ -35,7 +35,8 @@ from pylons.i18n.translation import _ from rhodecode.lib.exceptions import DefaultUserException, \ UserOwnsReposException from rhodecode.lib import helpers as h -from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator +from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator,\ + AuthUser from rhodecode.lib.base import BaseController, render from rhodecode.model.db import User, Permission @@ -111,7 +112,7 @@ class UsersController(BaseController): # url('user', id=ID) user_model = UserModel() c.user = user_model.get(id) - + c.perm_user = AuthUser(user_id=id) _form = UserForm(edit=True, old_data={'user_id': id, 'email': c.user.email})() form_result = {} @@ -174,6 +175,7 @@ class UsersController(BaseController): if c.user.username == 'default': h.flash(_("You can't edit this user"), category='warning') return redirect(url('users')) + c.perm_user = AuthUser(user_id=id) c.user.permissions = {} c.granted_permissions = UserModel().fill_perms(c.user)\ .permissions['global'] diff --git a/rhodecode/templates/admin/users/user_edit.html b/rhodecode/templates/admin/users/user_edit.html --- a/rhodecode/templates/admin/users/user_edit.html +++ b/rhodecode/templates/admin/users/user_edit.html @@ -157,5 +157,51 @@ ${h.end_form()} + + ## permissions overview +
+ %for section in sorted(c.perm_user.permissions.keys()): +
${section.replace("_"," ").capitalize()}
+ +
+ + + + + + + + %for k in c.perm_user.permissions[section]: + <% + if section != 'global': + section_perm = c.perm_user.permissions[section].get(k) + _perm = section_perm.split('.')[-1] + else: + _perm = section_perm = None + %> + + + + + %endfor + +
${_('Name')}${_('Permission')}
+ %if section == 'repositories': + ${k} + %elif section == 'repositories_groups': + ${k} + %else: + ${k} + %endif + + %if section == 'global': + ${h.bool2icon(True)} + %else: + ${section_perm} + %endif +
+
+ %endfor +