comparison rhodecode/model/forms.py @ 3714:7e3d89d9d3a2 beta

- Manage User’s Groups: create, delete, rename, add/remove users inside. by user group admin. In this case, a user's group can be owned by several people thru an owner user's group. Some refactoring of naming, permission handling logic. - remove some code duplicity as well as inconsistent naming
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 08 Apr 2013 22:47:35 +0200
parents ff2ea58debb5
children a8f520540ab0
comparison
equal deleted inserted replaced
3713:e45f8cefd7d9 3714:7e3d89d9d3a2
132 group_parent_id = All(v.CanCreateGroup(can_create_in_root), 132 group_parent_id = All(v.CanCreateGroup(can_create_in_root),
133 v.OneOf(available_groups, hideList=False, 133 v.OneOf(available_groups, hideList=False,
134 testValueList=True, 134 testValueList=True,
135 if_missing=None, not_empty=True)) 135 if_missing=None, not_empty=True))
136 enable_locking = v.StringBoolean(if_missing=False) 136 enable_locking = v.StringBoolean(if_missing=False)
137 recursive = v.StringBoolean(if_missing=False) 137 chained_validators = [v.ValidReposGroup(edit, old_data)]
138 chained_validators = [v.ValidReposGroup(edit, old_data),
139 v.ValidPerms('group')]
140 138
141 return _ReposGroupForm 139 return _ReposGroupForm
142 140
143 141
144 def RegisterForm(edit=False, old_data={}): 142 def RegisterForm(edit=False, old_data={}):
205 203
206 def RepoPermsForm(): 204 def RepoPermsForm():
207 class _RepoPermsForm(formencode.Schema): 205 class _RepoPermsForm(formencode.Schema):
208 allow_extra_fields = True 206 allow_extra_fields = True
209 filter_extra_fields = False 207 filter_extra_fields = False
210 chained_validators = [v.ValidPerms()] 208 chained_validators = [v.ValidPerms(type_='repo')]
211 return _RepoPermsForm 209 return _RepoPermsForm
210
211
212 def RepoGroupPermsForm():
213 class _RepoGroupPermsForm(formencode.Schema):
214 allow_extra_fields = True
215 filter_extra_fields = False
216 recursive = v.StringBoolean(if_missing=False)
217 chained_validators = [v.ValidPerms(type_='repo_group')]
218 return _RepoGroupPermsForm
219
220
221 def UserGroupPermsForm():
222 class _UserPermsForm(formencode.Schema):
223 allow_extra_fields = True
224 filter_extra_fields = False
225 chained_validators = [v.ValidPerms(type_='user_group')]
226 return _UserPermsForm
212 227
213 228
214 def RepoFieldForm(): 229 def RepoFieldForm():
215 class _RepoFieldForm(formencode.Schema): 230 class _RepoFieldForm(formencode.Schema):
216 filter_extra_fields = True 231 filter_extra_fields = True