##// END OF EJS Templates
#478 permissions overview for admin in user edit view
marcink -
r2435:751c1c56 beta
parent child Browse files
Show More
@@ -31,6 +31,7 b' news'
31 31 reformated based on user suggestions. Additional rss/atom feeds for user
32 32 journal
33 33 - various i18n improvements
34 - #478 permissions overview for admin in user edit view
34 35
35 36 fixes
36 37 +++++
@@ -35,7 +35,8 b' from pylons.i18n.translation import _'
35 35 from rhodecode.lib.exceptions import DefaultUserException, \
36 36 UserOwnsReposException
37 37 from rhodecode.lib import helpers as h
38 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator
38 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator,\
39 AuthUser
39 40 from rhodecode.lib.base import BaseController, render
40 41
41 42 from rhodecode.model.db import User, Permission
@@ -111,7 +112,7 b' class UsersController(BaseController):'
111 112 # url('user', id=ID)
112 113 user_model = UserModel()
113 114 c.user = user_model.get(id)
114
115 c.perm_user = AuthUser(user_id=id)
115 116 _form = UserForm(edit=True, old_data={'user_id': id,
116 117 'email': c.user.email})()
117 118 form_result = {}
@@ -174,6 +175,7 b' class UsersController(BaseController):'
174 175 if c.user.username == 'default':
175 176 h.flash(_("You can't edit this user"), category='warning')
176 177 return redirect(url('users'))
178 c.perm_user = AuthUser(user_id=id)
177 179 c.user.permissions = {}
178 180 c.granted_permissions = UserModel().fill_perms(c.user)\
179 181 .permissions['global']
@@ -157,5 +157,51 b''
157 157 </div>
158 158 </div>
159 159 ${h.end_form()}
160
161 ## permissions overview
162 <div id="perms" class="table">
163 %for section in sorted(c.perm_user.permissions.keys()):
164 <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
165
166 <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
167 <table id="tbl_list_${section}">
168 <thead>
169 <tr>
170 <th class="left">${_('Name')}</th>
171 <th class="left">${_('Permission')}</th>
172 </thead>
173 <tbody>
174 %for k in c.perm_user.permissions[section]:
175 <%
176 if section != 'global':
177 section_perm = c.perm_user.permissions[section].get(k)
178 _perm = section_perm.split('.')[-1]
179 else:
180 _perm = section_perm = None
181 %>
182 <tr>
183 <td>
184 %if section == 'repositories':
185 <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
186 %elif section == 'repositories_groups':
187 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
188 %else:
189 ${k}
190 %endif
191 </td>
192 <td>
193 %if section == 'global':
194 ${h.bool2icon(True)}
195 %else:
196 <span class="perm_tag ${_perm}">${section_perm}</span>
197 %endif
198 </td>
199 </tr>
200 %endfor
201 </tbody>
202 </table>
203 </div>
204 %endfor
205 </div>
160 206 </div>
161 207 </%def>
General Comments 0
You need to be logged in to leave comments. Login now