##// END OF EJS Templates
repository-groups: improved detection of repository groups parent....
marcink -
r1188:8732a902 default
parent child Browse files
Show More
@@ -196,11 +196,13 b' class ReposController(BaseRepoController'
196 def create_repository(self):
196 def create_repository(self):
197 """GET /_admin/create_repository: Form to create a new item"""
197 """GET /_admin/create_repository: Form to create a new item"""
198 new_repo = request.GET.get('repo', '')
198 new_repo = request.GET.get('repo', '')
199 parent_group = request.GET.get('parent_group')
199 parent_group = safe_int(request.GET.get('parent_group'))
200 _gr = RepoGroup.get(parent_group)
201
200 if not HasPermissionAny('hg.admin', 'hg.create.repository')():
202 if not HasPermissionAny('hg.admin', 'hg.create.repository')():
201 # you're not super admin nor have global create permissions,
203 # you're not super admin nor have global create permissions,
202 # but maybe you have at least write permission to a parent group ?
204 # but maybe you have at least write permission to a parent group ?
203 _gr = RepoGroup.get(parent_group)
205
204 gr_name = _gr.group_name if _gr else None
206 gr_name = _gr.group_name if _gr else None
205 # create repositories with write permission on group is set to true
207 # create repositories with write permission on group is set to true
206 create_on_write = HasPermissionAny('hg.create.write_on_repogroup.true')()
208 create_on_write = HasPermissionAny('hg.create.write_on_repogroup.true')()
@@ -217,12 +219,20 b' class ReposController(BaseRepoController'
217 c.personal_repo_group = c.rhodecode_user.personal_repo_group
219 c.personal_repo_group = c.rhodecode_user.personal_repo_group
218 c.new_repo = repo_name_slug(new_repo)
220 c.new_repo = repo_name_slug(new_repo)
219
221
220 ## apply the defaults from defaults page
222 # apply the defaults from defaults page
221 defaults = SettingsModel().get_default_repo_settings(strip_prefix=True)
223 defaults = SettingsModel().get_default_repo_settings(strip_prefix=True)
222 # set checkbox to autochecked
224 # set checkbox to autochecked
223 defaults['repo_copy_permissions'] = True
225 defaults['repo_copy_permissions'] = True
224 if parent_group:
226
225 defaults.update({'repo_group': parent_group})
227 parent_group_choice = '-1'
228 if not c.rhodecode_user.is_admin and c.rhodecode_user.personal_repo_group:
229 parent_group_choice = c.rhodecode_user.personal_repo_group
230
231 if parent_group and _gr:
232 if parent_group in [x[0] for x in c.repo_groups]:
233 parent_group_choice = unicode(parent_group)
234
235 defaults.update({'repo_group': parent_group_choice})
226
236
227 return htmlfill.render(
237 return htmlfill.render(
228 render('admin/repos/repo_add.html'),
238 render('admin/repos/repo_add.html'),
General Comments 0
You need to be logged in to leave comments. Login now