Show More
@@ -140,8 +140,9 b' class ReposGroupModel(BaseModel):' | |||||
140 |
|
140 | |||
141 | def create(self, group_name, group_description, owner, parent=None, just_db=False): |
|
141 | def create(self, group_name, group_description, owner, parent=None, just_db=False): | |
142 | try: |
|
142 | try: | |
|
143 | user = self._get_user(owner) | |||
143 | new_repos_group = RepoGroup() |
|
144 | new_repos_group = RepoGroup() | |
144 |
new_repos_group.user = |
|
145 | new_repos_group.user = user | |
145 | new_repos_group.group_description = group_description or group_name |
|
146 | new_repos_group.group_description = group_description or group_name | |
146 | new_repos_group.parent_group = self._get_repo_group(parent) |
|
147 | new_repos_group.parent_group = self._get_repo_group(parent) | |
147 | new_repos_group.group_name = new_repos_group.get_new_name(group_name) |
|
148 | new_repos_group.group_name = new_repos_group.get_new_name(group_name) | |
@@ -150,10 +151,11 b' class ReposGroupModel(BaseModel):' | |||||
150 | perm_obj = self._create_default_perms(new_repos_group) |
|
151 | perm_obj = self._create_default_perms(new_repos_group) | |
151 | self.sa.add(perm_obj) |
|
152 | self.sa.add(perm_obj) | |
152 |
|
153 | |||
153 |
#create an ADMIN permission for owner |
|
154 | #create an ADMIN permission for owner except if we're super admin, | |
154 | #the owner field of groups |
|
155 | #later owner should go into the owner field of groups | |
155 | self.grant_user_permission(repos_group=new_repos_group, |
|
156 | if not user.is_admin: | |
156 | user=owner, perm='group.admin') |
|
157 | self.grant_user_permission(repos_group=new_repos_group, | |
|
158 | user=owner, perm='group.admin') | |||
157 |
|
159 | |||
158 | if not just_db: |
|
160 | if not just_db: | |
159 | # we need to flush here, in order to check if database won't |
|
161 | # we need to flush here, in order to check if database won't |
General Comments 0
You need to be logged in to leave comments.
Login now