@@ -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
+++++
@@ -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.user.permissions = {}
c.granted_permissions = UserModel().fill_perms(c.user)\
.permissions['global']
@@ -157,5 +157,51 @@
</div>
${h.end_form()}
## permissions overview
<div id="perms" class="table">
%for section in sorted(c.perm_user.permissions.keys()):
<div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
<div id='tbl_list_wrap_${section}' class="yui-skin-sam">
<table id="tbl_list_${section}">
<thead>
<tr>
<th class="left">${_('Name')}</th>
<th class="left">${_('Permission')}</th>
</thead>
<tbody>
%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
%>
<td>
%if section == 'repositories':
<a href="${h.url('summary_home',repo_name=k)}">${k}</a>
%elif section == 'repositories_groups':
<a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
%else:
${k}
%endif
</td>
%if section == 'global':
${h.bool2icon(True)}
<span class="perm_tag ${_perm}">${section_perm}</span>
</tr>
%endfor
</tbody>
</table>
</%def>
Status change: