# HG changeset patch # User Mads Kiilerich # Date 2015-07-23 00:52:29 # Node ID b52b0496b9f6d2c6ffec20ba4f9f042f3883a617 # Parent 28db71c6349e92505209a46f246097f35f1ff5cb forks: group write permission should only be sufficient when 'write_on_repogroup' is enabled diff --git a/kallithea/controllers/forks.py b/kallithea/controllers/forks.py --- a/kallithea/controllers/forks.py +++ b/kallithea/controllers/forks.py @@ -38,7 +38,7 @@ import kallithea.lib.helpers as h 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 @@ class ForksController(BaseRepoController 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()