Show More
@@ -196,11 +196,13 b' class ReposController(BaseRepoController' | |||
|
196 | 196 | def create_repository(self): |
|
197 | 197 | """GET /_admin/create_repository: Form to create a new item""" |
|
198 | 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 | 202 | if not HasPermissionAny('hg.admin', 'hg.create.repository')(): |
|
201 | 203 | # you're not super admin nor have global create permissions, |
|
202 | 204 | # but maybe you have at least write permission to a parent group ? |
|
203 | _gr = RepoGroup.get(parent_group) | |
|
205 | ||
|
204 | 206 | gr_name = _gr.group_name if _gr else None |
|
205 | 207 | # create repositories with write permission on group is set to true |
|
206 | 208 | create_on_write = HasPermissionAny('hg.create.write_on_repogroup.true')() |
@@ -217,12 +219,20 b' class ReposController(BaseRepoController' | |||
|
217 | 219 | c.personal_repo_group = c.rhodecode_user.personal_repo_group |
|
218 | 220 | c.new_repo = repo_name_slug(new_repo) |
|
219 | 221 | |
|
220 |
|
|
|
222 | # apply the defaults from defaults page | |
|
221 | 223 | defaults = SettingsModel().get_default_repo_settings(strip_prefix=True) |
|
222 | 224 | # set checkbox to autochecked |
|
223 | 225 | defaults['repo_copy_permissions'] = True |
|
224 | if parent_group: | |
|
225 | defaults.update({'repo_group': parent_group}) | |
|
226 | ||
|
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 | 237 | return htmlfill.render( |
|
228 | 238 | render('admin/repos/repo_add.html'), |
General Comments 0
You need to be logged in to leave comments.
Login now