changeset 5290:b52b0496b9f6

forks: group write permission should only be sufficient when 'write_on_repogroup' is enabled
author Mads Kiilerich <madski@unity3d.com>
date Thu, 23 Jul 2015 00:52:29 +0200
parents 28db71c6349e
children 9d4c4d4d9e16
files kallithea/controllers/forks.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/forks.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/controllers/forks.py	Thu Jul 23 00:52:29 2015 +0200
@@ -38,7 +38,7 @@
 
 from kallithea.lib.helpers import Page
 from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator, \
-    NotAnonymous, HasRepoPermissionAny, HasPermissionAnyDecorator
+    NotAnonymous, HasRepoPermissionAny, HasPermissionAnyDecorator, HasPermissionAny
 from kallithea.lib.base import BaseRepoController, render
 from kallithea.model.db import Repository, RepoGroup, UserFollowing, User,\
     Ui
@@ -56,8 +56,11 @@
         super(ForksController, self).__before__()
 
     def __load_defaults(self):
+        repo_group_perms = ['group.admin']
+        if HasPermissionAny('hg.create.write_on_repogroup.true')():
+            repo_group_perms.append('group.write')
         acl_groups = RepoGroupList(RepoGroup.query().all(),
-                               perm_set=['group.write', 'group.admin'])
+                               perm_set=repo_group_perms)
         c.repo_groups = RepoGroup.groups_choices(groups=acl_groups)
         c.repo_groups_choices = map(lambda k: k[0], c.repo_groups)
         choices, c.landing_revs = ScmModel().get_repo_landing_revs()