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