Show More
@@ -36,7 +36,7 b' from rhodecode.lib import helpers as h' | |||||
36 | from rhodecode.lib.exceptions import UserGroupsAssignedException |
|
36 | from rhodecode.lib.exceptions import UserGroupsAssignedException | |
37 | from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int |
|
37 | from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int | |
38 | from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator,\ |
|
38 | from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator,\ | |
39 | HasUserGroupPermissionAnyDecorator |
|
39 | HasUserGroupPermissionAnyDecorator, HasPermissionAnyDecorator | |
40 | from rhodecode.lib.base import BaseController, render |
|
40 | from rhodecode.lib.base import BaseController, render | |
41 | from rhodecode.model.scm import UserGroupList |
|
41 | from rhodecode.model.scm import UserGroupList | |
42 | from rhodecode.model.users_group import UserGroupModel |
|
42 | from rhodecode.model.users_group import UserGroupModel | |
@@ -137,7 +137,7 b' class UsersGroupsController(BaseControll' | |||||
137 | c.users_groups_list = sorted(group_iter, key=sk) |
|
137 | c.users_groups_list = sorted(group_iter, key=sk) | |
138 | return render('admin/users_groups/users_groups.html') |
|
138 | return render('admin/users_groups/users_groups.html') | |
139 |
|
139 | |||
140 |
@HasPermissionA |
|
140 | @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') | |
141 | def create(self): |
|
141 | def create(self): | |
142 | """POST /users_groups: Create a new item""" |
|
142 | """POST /users_groups: Create a new item""" | |
143 | # url('users_groups') |
|
143 | # url('users_groups') | |
@@ -169,7 +169,7 b' class UsersGroupsController(BaseControll' | |||||
169 |
|
169 | |||
170 | return redirect(url('users_groups')) |
|
170 | return redirect(url('users_groups')) | |
171 |
|
171 | |||
172 |
@HasPermissionA |
|
172 | @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') | |
173 | def new(self, format='html'): |
|
173 | def new(self, format='html'): | |
174 | """GET /users_groups/new: Form to create a new item""" |
|
174 | """GET /users_groups/new: Form to create a new item""" | |
175 | # url('new_users_group') |
|
175 | # url('new_users_group') |
@@ -106,6 +106,10 b' class UserGroupModel(BaseModel):' | |||||
106 | self.sa.add(new_user_group) |
|
106 | self.sa.add(new_user_group) | |
107 | perm_obj = self._create_default_perms(new_user_group) |
|
107 | perm_obj = self._create_default_perms(new_user_group) | |
108 | self.sa.add(perm_obj) |
|
108 | self.sa.add(perm_obj) | |
|
109 | ||||
|
110 | self.grant_user_permission(user_group=new_user_group, | |||
|
111 | user=owner, perm='usergroup.admin') | |||
|
112 | ||||
109 | return new_user_group |
|
113 | return new_user_group | |
110 | except Exception: |
|
114 | except Exception: | |
111 | log.error(traceback.format_exc()) |
|
115 | log.error(traceback.format_exc()) |
@@ -21,10 +21,11 b'' | |||||
21 | <div class="title"> |
|
21 | <div class="title"> | |
22 | ${self.breadcrumbs()} |
|
22 | ${self.breadcrumbs()} | |
23 | <ul class="links"> |
|
23 | <ul class="links"> | |
|
24 | %if h.HasPermissionAny('hg.usergroup.create.true')(): | |||
24 | <li> |
|
25 | <li> | |
25 | <span>${h.link_to(_(u'Add new user group'),h.url('new_users_group'))}</span> |
|
26 | <span>${h.link_to(_(u'Add new user group'),h.url('new_users_group'))}</span> | |
26 | </li> |
|
27 | </li> | |
27 |
|
28 | %endif | ||
28 | </ul> |
|
29 | </ul> | |
29 | </div> |
|
30 | </div> | |
30 | <!-- end box / title --> |
|
31 | <!-- end box / title --> |
General Comments 0
You need to be logged in to leave comments.
Login now