Changeset - 4ab0e4d478b6
[Not reviewed]
Merge codereview
0 3 0
Marcin Kuzminski - 13 years ago 2012-06-10 02:26:02
marcin@python-works.com
merge with beta
3 files changed with 51 insertions and 2 deletions:
0 comments (0 inline, 0 general)
docs/changelog.rst
Show inline comments
 
@@ -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
 
+++++
rhodecode/controllers/admin/users.py
Show inline comments
 
@@ -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, UserEmailMap
 
@@ -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']
rhodecode/templates/admin/users/user_edit.html
Show inline comments
 
@@ -157,6 +157,52 @@
 
        </div>
 
    </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
 
                     %>
 
                    <tr>
 
                        <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>
 
                        <td>
 
                            %if section == 'global':
 
                             ${h.bool2icon(True)}
 
                            %else:
 
                            <span class="perm_tag ${_perm}">${section_perm}</span>
 
                            %endif
 
                         </td>
 
                    </tr>
 
                %endfor
 
                </tbody>
 
               </table>
 
              </div>
 
           %endfor
 
    </div>    
 
</div>
 
<div class="box box-right">
 
    <!-- box / title -->
0 comments (0 inline, 0 general)