diff rhodecode/controllers/admin/settings.py @ 3239:a9565b8b429b beta

filter out repo groups choices to only ones that you have write+ access to. Before it was read+ access and you got proper error saying that you don't have write permissions to group to create repo in. Filtering out the read groups is less confusing for users. ref #730
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 28 Jan 2013 00:02:09 +0100
parents 11b005b2d5e8
children 72a91632b731
line wrap: on
line diff
--- a/rhodecode/controllers/admin/settings.py	Sun Jan 27 22:37:55 2013 +0100
+++ b/rhodecode/controllers/admin/settings.py	Mon Jan 28 00:02:09 2013 +0100
@@ -46,7 +46,7 @@
     RhodeCodeSetting, PullRequest, PullRequestReviewers
 from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \
     ApplicationUiSettingsForm, ApplicationVisualisationForm
-from rhodecode.model.scm import ScmModel
+from rhodecode.model.scm import ScmModel, GroupList
 from rhodecode.model.user import UserModel
 from rhodecode.model.repo import RepoModel
 from rhodecode.model.db import User
@@ -483,7 +483,9 @@
     def create_repository(self):
         """GET /_admin/create_repository: Form to create a new item"""
 
-        c.repo_groups = RepoGroup.groups_choices(check_perms=True)
+        acl_groups = GroupList(RepoGroup.query().all(),
+                               perm_set=['group.write', 'group.admin'])
+        c.repo_groups = RepoGroup.groups_choices(groups=acl_groups)
         c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
         choices, c.landing_revs = ScmModel().get_repo_landing_revs()