##// END OF EJS Templates
Added quick links for editing permissions for users from permission overview
marcink -
r2631:f597cfb4 beta
parent child Browse files
Show More
@@ -158,8 +158,7 def make_map(config):
158 158 action="delete", conditions=dict(method=["DELETE"],
159 159 function=check_int))
160 160 m.connect("edit_repos_group", "/repos_groups/{id}/edit",
161 action="edit", conditions=dict(method=["GET"],
162 function=check_int))
161 action="edit", conditions=dict(method=["GET"],))
163 162 m.connect("formatted_edit_repos_group",
164 163 "/repos_groups/{id}.{format}/edit",
165 164 action="edit", conditions=dict(method=["GET"],
@@ -301,13 +301,12 class ReposGroupsController(BaseControll
301 301 """GET /repos_groups/id/edit: Form to edit an existing item"""
302 302 # url('edit_repos_group', id=ID)
303 303
304 id_ = int(id)
305
306 c.repos_group = RepoGroup.get(id_)
307 defaults = self.__load_data(id_)
304 c.repos_group = ReposGroupModel()._get_repos_group(id)
305 defaults = self.__load_data(c.repos_group.group_id)
308 306
309 307 # we need to exclude this group from the group list for editing
310 c.repo_groups = filter(lambda x: x[0] != id_, c.repo_groups)
308 c.repo_groups = filter(lambda x: x[0] != c.repos_group.group_id,
309 c.repo_groups)
311 310
312 311 return htmlfill.render(
313 312 render('admin/repos_groups/repos_groups_edit.html'),
@@ -53,7 +53,7 class RepoModel(BaseModel):
53 53 return self._get_instance(UsersGroup, users_group,
54 54 callback=UsersGroup.get_by_group_name)
55 55
56 def __get_repos_group(self, repos_group):
56 def _get_repos_group(self, repos_group):
57 57 return self._get_instance(RepoGroup, repos_group,
58 58 callback=RepoGroup.get_by_group_name)
59 59
@@ -210,7 +210,7 class RepoModel(BaseModel):
210 210
211 211 owner = self._get_user(owner)
212 212 fork_of = self._get_repo(fork_of)
213 repos_group = self.__get_repos_group(repos_group)
213 repos_group = self._get_repos_group(repos_group)
214 214 try:
215 215
216 216 # repo name is just a name of repository
@@ -45,7 +45,7 class ReposGroupModel(BaseModel):
45 45 return self._get_instance(UsersGroup, users_group,
46 46 callback=UsersGroup.get_by_group_name)
47 47
48 def __get_repos_group(self, repos_group):
48 def _get_repos_group(self, repos_group):
49 49 return self._get_instance(RepoGroup, repos_group,
50 50 callback=RepoGroup.get_by_group_name)
51 51
@@ -133,7 +133,7 class ReposGroupModel(BaseModel):
133 133 try:
134 134 new_repos_group = RepoGroup()
135 135 new_repos_group.group_description = group_description
136 new_repos_group.parent_group = self.__get_repos_group(parent)
136 new_repos_group.parent_group = self._get_repos_group(parent)
137 137 new_repos_group.group_name = new_repos_group.get_new_name(group_name)
138 138
139 139 self.sa.add(new_repos_group)
@@ -202,7 +202,7 class ReposGroupModel(BaseModel):
202 202 raise
203 203
204 204 def delete(self, repos_group):
205 repos_group = self.__get_repos_group(repos_group)
205 repos_group = self._get_repos_group(repos_group)
206 206 try:
207 207 self.sa.delete(repos_group)
208 208 self.__delete_group(repos_group)
@@ -221,7 +221,7 class ReposGroupModel(BaseModel):
221 221 :param perm: Instance of Permission, or permission_name
222 222 """
223 223
224 repos_group = self.__get_repos_group(repos_group)
224 repos_group = self._get_repos_group(repos_group)
225 225 user = self._get_user(user)
226 226 permission = self._get_perm(perm)
227 227
@@ -247,7 +247,7 class ReposGroupModel(BaseModel):
247 247 :param user: Instance of User, user_id or username
248 248 """
249 249
250 repos_group = self.__get_repos_group(repos_group)
250 repos_group = self._get_repos_group(repos_group)
251 251 user = self._get_user(user)
252 252
253 253 obj = self.sa.query(UserRepoGroupToPerm)\
@@ -267,7 +267,7 class ReposGroupModel(BaseModel):
267 267 or users group name
268 268 :param perm: Instance of Permission, or permission_name
269 269 """
270 repos_group = self.__get_repos_group(repos_group)
270 repos_group = self._get_repos_group(repos_group)
271 271 group_name = self.__get_users_group(group_name)
272 272 permission = self._get_perm(perm)
273 273
@@ -295,7 +295,7 class ReposGroupModel(BaseModel):
295 295 :param group_name: Instance of UserGroup, users_group_id,
296 296 or users group name
297 297 """
298 repos_group = self.__get_repos_group(repos_group)
298 repos_group = self._get_repos_group(repos_group)
299 299 group_name = self.__get_users_group(group_name)
300 300
301 301 obj = self.sa.query(UsersGroupRepoGroupToPerm)\
@@ -169,6 +169,7
169 169 <tr>
170 170 <th class="left">${_('Name')}</th>
171 171 <th class="left">${_('Permission')}</th>
172 <th class="left">${_('Edit Permission')}</th>
172 173 </thead>
173 174 <tbody>
174 175 %for k in c.perm_user.permissions[section]:
@@ -196,6 +197,15
196 197 <span class="perm_tag ${_perm}">${section_perm}</span>
197 198 %endif
198 199 </td>
200 <td>
201 %if section == 'repositories':
202 <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
203 %elif section == 'repositories_groups':
204 <a href="${h.url('edit_repos_group',id=k,anchor='permissions_manage')}">${_('edit')}</a>
205 %else:
206 --
207 %endif
208 </td>
199 209 </tr>
200 210 %endfor
201 211 </tbody>
General Comments 0
You need to be logged in to leave comments. Login now