diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -158,8 +158,7 @@ def make_map(config): action="delete", conditions=dict(method=["DELETE"], function=check_int)) m.connect("edit_repos_group", "/repos_groups/{id}/edit", - action="edit", conditions=dict(method=["GET"], - function=check_int)) + action="edit", conditions=dict(method=["GET"],)) m.connect("formatted_edit_repos_group", "/repos_groups/{id}.{format}/edit", action="edit", conditions=dict(method=["GET"], diff --git a/rhodecode/controllers/admin/repos_groups.py b/rhodecode/controllers/admin/repos_groups.py --- a/rhodecode/controllers/admin/repos_groups.py +++ b/rhodecode/controllers/admin/repos_groups.py @@ -301,13 +301,12 @@ class ReposGroupsController(BaseControll """GET /repos_groups/id/edit: Form to edit an existing item""" # url('edit_repos_group', id=ID) - id_ = int(id) - - c.repos_group = RepoGroup.get(id_) - defaults = self.__load_data(id_) + c.repos_group = ReposGroupModel()._get_repos_group(id) + defaults = self.__load_data(c.repos_group.group_id) # we need to exclude this group from the group list for editing - c.repo_groups = filter(lambda x: x[0] != id_, c.repo_groups) + c.repo_groups = filter(lambda x: x[0] != c.repos_group.group_id, + c.repo_groups) return htmlfill.render( render('admin/repos_groups/repos_groups_edit.html'), diff --git a/rhodecode/model/repo.py b/rhodecode/model/repo.py --- a/rhodecode/model/repo.py +++ b/rhodecode/model/repo.py @@ -53,7 +53,7 @@ class RepoModel(BaseModel): return self._get_instance(UsersGroup, users_group, callback=UsersGroup.get_by_group_name) - def __get_repos_group(self, repos_group): + def _get_repos_group(self, repos_group): return self._get_instance(RepoGroup, repos_group, callback=RepoGroup.get_by_group_name) @@ -210,7 +210,7 @@ class RepoModel(BaseModel): owner = self._get_user(owner) fork_of = self._get_repo(fork_of) - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) try: # repo name is just a name of repository diff --git a/rhodecode/model/repos_group.py b/rhodecode/model/repos_group.py --- a/rhodecode/model/repos_group.py +++ b/rhodecode/model/repos_group.py @@ -45,7 +45,7 @@ class ReposGroupModel(BaseModel): return self._get_instance(UsersGroup, users_group, callback=UsersGroup.get_by_group_name) - def __get_repos_group(self, repos_group): + def _get_repos_group(self, repos_group): return self._get_instance(RepoGroup, repos_group, callback=RepoGroup.get_by_group_name) @@ -133,7 +133,7 @@ class ReposGroupModel(BaseModel): try: new_repos_group = RepoGroup() new_repos_group.group_description = group_description - new_repos_group.parent_group = self.__get_repos_group(parent) + new_repos_group.parent_group = self._get_repos_group(parent) new_repos_group.group_name = new_repos_group.get_new_name(group_name) self.sa.add(new_repos_group) @@ -202,7 +202,7 @@ class ReposGroupModel(BaseModel): raise def delete(self, repos_group): - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) try: self.sa.delete(repos_group) self.__delete_group(repos_group) @@ -221,7 +221,7 @@ class ReposGroupModel(BaseModel): :param perm: Instance of Permission, or permission_name """ - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) user = self._get_user(user) permission = self._get_perm(perm) @@ -247,7 +247,7 @@ class ReposGroupModel(BaseModel): :param user: Instance of User, user_id or username """ - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) user = self._get_user(user) obj = self.sa.query(UserRepoGroupToPerm)\ @@ -267,7 +267,7 @@ class ReposGroupModel(BaseModel): or users group name :param perm: Instance of Permission, or permission_name """ - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) group_name = self.__get_users_group(group_name) permission = self._get_perm(perm) @@ -295,7 +295,7 @@ class ReposGroupModel(BaseModel): :param group_name: Instance of UserGroup, users_group_id, or users group name """ - repos_group = self.__get_repos_group(repos_group) + repos_group = self._get_repos_group(repos_group) group_name = self.__get_users_group(group_name) obj = self.sa.query(UsersGroupRepoGroupToPerm)\ diff --git a/rhodecode/templates/admin/users/user_edit.html b/rhodecode/templates/admin/users/user_edit.html --- a/rhodecode/templates/admin/users/user_edit.html +++ b/rhodecode/templates/admin/users/user_edit.html @@ -169,6 +169,7 @@ ${_('Name')} ${_('Permission')} + ${_('Edit Permission')} %for k in c.perm_user.permissions[section]: @@ -195,7 +196,16 @@ %else: ${section_perm} %endif - + + + %if section == 'repositories': + ${_('edit')} + %elif section == 'repositories_groups': + ${_('edit')} + %else: + -- + %endif + %endfor