##// END OF EJS Templates
fixed missing permission for being able to write to group on repository settings ref #468
marcink -
r2986:f8d82768 beta
parent child Browse files
Show More
@@ -1,349 +1,350 b''
1 """ this is forms validation classes
1 """ this is forms validation classes
2 http://formencode.org/module-formencode.validators.html
2 http://formencode.org/module-formencode.validators.html
3 for list off all availible validators
3 for list off all availible validators
4
4
5 we can create our own validators
5 we can create our own validators
6
6
7 The table below outlines the options which can be used in a schema in addition to the validators themselves
7 The table below outlines the options which can be used in a schema in addition to the validators themselves
8 pre_validators [] These validators will be applied before the schema
8 pre_validators [] These validators will be applied before the schema
9 chained_validators [] These validators will be applied after the schema
9 chained_validators [] These validators will be applied after the schema
10 allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
10 allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
11 filter_extra_fields False If True, then keys that aren't associated with a validator are removed
11 filter_extra_fields False If True, then keys that aren't associated with a validator are removed
12 if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value.
12 if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value.
13 ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already
13 ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already
14
14
15
15
16 <name> = formencode.validators.<name of validator>
16 <name> = formencode.validators.<name of validator>
17 <name> must equal form name
17 <name> must equal form name
18 list=[1,2,3,4,5]
18 list=[1,2,3,4,5]
19 for SELECT use formencode.All(OneOf(list), Int())
19 for SELECT use formencode.All(OneOf(list), Int())
20
20
21 """
21 """
22 import logging
22 import logging
23
23
24 import formencode
24 import formencode
25 from formencode import All
25 from formencode import All
26
26
27 from pylons.i18n.translation import _
27 from pylons.i18n.translation import _
28
28
29 from rhodecode.model import validators as v
29 from rhodecode.model import validators as v
30 from rhodecode import BACKENDS
30 from rhodecode import BACKENDS
31
31
32 log = logging.getLogger(__name__)
32 log = logging.getLogger(__name__)
33
33
34
34
35 class LoginForm(formencode.Schema):
35 class LoginForm(formencode.Schema):
36 allow_extra_fields = True
36 allow_extra_fields = True
37 filter_extra_fields = True
37 filter_extra_fields = True
38 username = v.UnicodeString(
38 username = v.UnicodeString(
39 strip=True,
39 strip=True,
40 min=1,
40 min=1,
41 not_empty=True,
41 not_empty=True,
42 messages={
42 messages={
43 'empty': _(u'Please enter a login'),
43 'empty': _(u'Please enter a login'),
44 'tooShort': _(u'Enter a value %(min)i characters long or more')}
44 'tooShort': _(u'Enter a value %(min)i characters long or more')}
45 )
45 )
46
46
47 password = v.UnicodeString(
47 password = v.UnicodeString(
48 strip=False,
48 strip=False,
49 min=3,
49 min=3,
50 not_empty=True,
50 not_empty=True,
51 messages={
51 messages={
52 'empty': _(u'Please enter a password'),
52 'empty': _(u'Please enter a password'),
53 'tooShort': _(u'Enter %(min)i characters or more')}
53 'tooShort': _(u'Enter %(min)i characters or more')}
54 )
54 )
55
55
56 remember = v.StringBoolean(if_missing=False)
56 remember = v.StringBoolean(if_missing=False)
57
57
58 chained_validators = [v.ValidAuth()]
58 chained_validators = [v.ValidAuth()]
59
59
60
60
61 def UserForm(edit=False, old_data={}):
61 def UserForm(edit=False, old_data={}):
62 class _UserForm(formencode.Schema):
62 class _UserForm(formencode.Schema):
63 allow_extra_fields = True
63 allow_extra_fields = True
64 filter_extra_fields = True
64 filter_extra_fields = True
65 username = All(v.UnicodeString(strip=True, min=1, not_empty=True),
65 username = All(v.UnicodeString(strip=True, min=1, not_empty=True),
66 v.ValidUsername(edit, old_data))
66 v.ValidUsername(edit, old_data))
67 if edit:
67 if edit:
68 new_password = All(
68 new_password = All(
69 v.ValidPassword(),
69 v.ValidPassword(),
70 v.UnicodeString(strip=False, min=6, not_empty=False)
70 v.UnicodeString(strip=False, min=6, not_empty=False)
71 )
71 )
72 password_confirmation = All(
72 password_confirmation = All(
73 v.ValidPassword(),
73 v.ValidPassword(),
74 v.UnicodeString(strip=False, min=6, not_empty=False),
74 v.UnicodeString(strip=False, min=6, not_empty=False),
75 )
75 )
76 admin = v.StringBoolean(if_missing=False)
76 admin = v.StringBoolean(if_missing=False)
77 else:
77 else:
78 password = All(
78 password = All(
79 v.ValidPassword(),
79 v.ValidPassword(),
80 v.UnicodeString(strip=False, min=6, not_empty=True)
80 v.UnicodeString(strip=False, min=6, not_empty=True)
81 )
81 )
82 password_confirmation = All(
82 password_confirmation = All(
83 v.ValidPassword(),
83 v.ValidPassword(),
84 v.UnicodeString(strip=False, min=6, not_empty=False)
84 v.UnicodeString(strip=False, min=6, not_empty=False)
85 )
85 )
86
86
87 active = v.StringBoolean(if_missing=False)
87 active = v.StringBoolean(if_missing=False)
88 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
88 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
89 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
89 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
90 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
90 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
91
91
92 chained_validators = [v.ValidPasswordsMatch()]
92 chained_validators = [v.ValidPasswordsMatch()]
93
93
94 return _UserForm
94 return _UserForm
95
95
96
96
97 def UsersGroupForm(edit=False, old_data={}, available_members=[]):
97 def UsersGroupForm(edit=False, old_data={}, available_members=[]):
98 class _UsersGroupForm(formencode.Schema):
98 class _UsersGroupForm(formencode.Schema):
99 allow_extra_fields = True
99 allow_extra_fields = True
100 filter_extra_fields = True
100 filter_extra_fields = True
101
101
102 users_group_name = All(
102 users_group_name = All(
103 v.UnicodeString(strip=True, min=1, not_empty=True),
103 v.UnicodeString(strip=True, min=1, not_empty=True),
104 v.ValidUsersGroup(edit, old_data)
104 v.ValidUsersGroup(edit, old_data)
105 )
105 )
106
106
107 users_group_active = v.StringBoolean(if_missing=False)
107 users_group_active = v.StringBoolean(if_missing=False)
108
108
109 if edit:
109 if edit:
110 users_group_members = v.OneOf(
110 users_group_members = v.OneOf(
111 available_members, hideList=False, testValueList=True,
111 available_members, hideList=False, testValueList=True,
112 if_missing=None, not_empty=False
112 if_missing=None, not_empty=False
113 )
113 )
114
114
115 return _UsersGroupForm
115 return _UsersGroupForm
116
116
117
117
118 def ReposGroupForm(edit=False, old_data={}, available_groups=[]):
118 def ReposGroupForm(edit=False, old_data={}, available_groups=[]):
119 class _ReposGroupForm(formencode.Schema):
119 class _ReposGroupForm(formencode.Schema):
120 allow_extra_fields = True
120 allow_extra_fields = True
121 filter_extra_fields = False
121 filter_extra_fields = False
122
122
123 group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
123 group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
124 v.SlugifyName())
124 v.SlugifyName())
125 group_description = v.UnicodeString(strip=True, min=1,
125 group_description = v.UnicodeString(strip=True, min=1,
126 not_empty=True)
126 not_empty=True)
127 group_parent_id = v.OneOf(available_groups, hideList=False,
127 group_parent_id = v.OneOf(available_groups, hideList=False,
128 testValueList=True,
128 testValueList=True,
129 if_missing=None, not_empty=False)
129 if_missing=None, not_empty=False)
130 enable_locking = v.StringBoolean(if_missing=False)
130 enable_locking = v.StringBoolean(if_missing=False)
131 recursive = v.StringBoolean(if_missing=False)
131 recursive = v.StringBoolean(if_missing=False)
132 chained_validators = [v.ValidReposGroup(edit, old_data),
132 chained_validators = [v.ValidReposGroup(edit, old_data),
133 v.ValidPerms('group')]
133 v.ValidPerms('group')]
134
134
135 return _ReposGroupForm
135 return _ReposGroupForm
136
136
137
137
138 def RegisterForm(edit=False, old_data={}):
138 def RegisterForm(edit=False, old_data={}):
139 class _RegisterForm(formencode.Schema):
139 class _RegisterForm(formencode.Schema):
140 allow_extra_fields = True
140 allow_extra_fields = True
141 filter_extra_fields = True
141 filter_extra_fields = True
142 username = All(
142 username = All(
143 v.ValidUsername(edit, old_data),
143 v.ValidUsername(edit, old_data),
144 v.UnicodeString(strip=True, min=1, not_empty=True)
144 v.UnicodeString(strip=True, min=1, not_empty=True)
145 )
145 )
146 password = All(
146 password = All(
147 v.ValidPassword(),
147 v.ValidPassword(),
148 v.UnicodeString(strip=False, min=6, not_empty=True)
148 v.UnicodeString(strip=False, min=6, not_empty=True)
149 )
149 )
150 password_confirmation = All(
150 password_confirmation = All(
151 v.ValidPassword(),
151 v.ValidPassword(),
152 v.UnicodeString(strip=False, min=6, not_empty=True)
152 v.UnicodeString(strip=False, min=6, not_empty=True)
153 )
153 )
154 active = v.StringBoolean(if_missing=False)
154 active = v.StringBoolean(if_missing=False)
155 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
155 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
156 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
156 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
157 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
157 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
158
158
159 chained_validators = [v.ValidPasswordsMatch()]
159 chained_validators = [v.ValidPasswordsMatch()]
160
160
161 return _RegisterForm
161 return _RegisterForm
162
162
163
163
164 def PasswordResetForm():
164 def PasswordResetForm():
165 class _PasswordResetForm(formencode.Schema):
165 class _PasswordResetForm(formencode.Schema):
166 allow_extra_fields = True
166 allow_extra_fields = True
167 filter_extra_fields = True
167 filter_extra_fields = True
168 email = All(v.ValidSystemEmail(), v.Email(not_empty=True))
168 email = All(v.ValidSystemEmail(), v.Email(not_empty=True))
169 return _PasswordResetForm
169 return _PasswordResetForm
170
170
171
171
172 def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
172 def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
173 repo_groups=[], landing_revs=[]):
173 repo_groups=[], landing_revs=[]):
174 class _RepoForm(formencode.Schema):
174 class _RepoForm(formencode.Schema):
175 allow_extra_fields = True
175 allow_extra_fields = True
176 filter_extra_fields = False
176 filter_extra_fields = False
177 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
177 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
178 v.SlugifyName())
178 v.SlugifyName())
179 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
179 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
180 repo_group = All(v.CanWriteGroup(),
180 repo_group = All(v.CanWriteGroup(),
181 v.OneOf(repo_groups, hideList=True))
181 v.OneOf(repo_groups, hideList=True))
182 repo_type = v.OneOf(supported_backends)
182 repo_type = v.OneOf(supported_backends)
183 description = v.UnicodeString(strip=True, min=1, not_empty=False)
183 description = v.UnicodeString(strip=True, min=1, not_empty=False)
184 private = v.StringBoolean(if_missing=False)
184 private = v.StringBoolean(if_missing=False)
185 enable_statistics = v.StringBoolean(if_missing=False)
185 enable_statistics = v.StringBoolean(if_missing=False)
186 enable_downloads = v.StringBoolean(if_missing=False)
186 enable_downloads = v.StringBoolean(if_missing=False)
187 enable_locking = v.StringBoolean(if_missing=False)
187 enable_locking = v.StringBoolean(if_missing=False)
188 landing_rev = v.OneOf(landing_revs, hideList=True)
188 landing_rev = v.OneOf(landing_revs, hideList=True)
189
189
190 if edit:
190 if edit:
191 #this is repo owner
191 #this is repo owner
192 user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
192 user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
193
193
194 chained_validators = [v.ValidCloneUri(),
194 chained_validators = [v.ValidCloneUri(),
195 v.ValidRepoName(edit, old_data),
195 v.ValidRepoName(edit, old_data),
196 v.ValidPerms()]
196 v.ValidPerms()]
197 return _RepoForm
197 return _RepoForm
198
198
199
199
200 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
200 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
201 repo_groups=[], landing_revs=[]):
201 repo_groups=[], landing_revs=[]):
202 class _RepoForkForm(formencode.Schema):
202 class _RepoForkForm(formencode.Schema):
203 allow_extra_fields = True
203 allow_extra_fields = True
204 filter_extra_fields = False
204 filter_extra_fields = False
205 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
205 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
206 v.SlugifyName())
206 v.SlugifyName())
207 repo_group = All(v.CanWriteGroup(),
207 repo_group = All(v.CanWriteGroup(),
208 v.OneOf(repo_groups, hideList=True))
208 v.OneOf(repo_groups, hideList=True))
209 repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends))
209 repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends))
210 description = v.UnicodeString(strip=True, min=1, not_empty=True)
210 description = v.UnicodeString(strip=True, min=1, not_empty=True)
211 private = v.StringBoolean(if_missing=False)
211 private = v.StringBoolean(if_missing=False)
212 copy_permissions = v.StringBoolean(if_missing=False)
212 copy_permissions = v.StringBoolean(if_missing=False)
213 update_after_clone = v.StringBoolean(if_missing=False)
213 update_after_clone = v.StringBoolean(if_missing=False)
214 fork_parent_id = v.UnicodeString()
214 fork_parent_id = v.UnicodeString()
215 chained_validators = [v.ValidForkName(edit, old_data)]
215 chained_validators = [v.ValidForkName(edit, old_data)]
216 landing_rev = v.OneOf(landing_revs, hideList=True)
216 landing_rev = v.OneOf(landing_revs, hideList=True)
217
217
218 return _RepoForkForm
218 return _RepoForkForm
219
219
220
220
221 def RepoSettingsForm(edit=False, old_data={},
221 def RepoSettingsForm(edit=False, old_data={},
222 supported_backends=BACKENDS.keys(), repo_groups=[],
222 supported_backends=BACKENDS.keys(), repo_groups=[],
223 landing_revs=[]):
223 landing_revs=[]):
224 class _RepoForm(formencode.Schema):
224 class _RepoForm(formencode.Schema):
225 allow_extra_fields = True
225 allow_extra_fields = True
226 filter_extra_fields = False
226 filter_extra_fields = False
227 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
227 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
228 v.SlugifyName())
228 v.SlugifyName())
229 description = v.UnicodeString(strip=True, min=1, not_empty=True)
229 description = v.UnicodeString(strip=True, min=1, not_empty=True)
230 repo_group = v.OneOf(repo_groups, hideList=True)
230 repo_group = All(v.CanWriteGroup(),
231 v.OneOf(repo_groups, hideList=True))
231 private = v.StringBoolean(if_missing=False)
232 private = v.StringBoolean(if_missing=False)
232 landing_rev = v.OneOf(landing_revs, hideList=True)
233 landing_rev = v.OneOf(landing_revs, hideList=True)
233 chained_validators = [v.ValidRepoName(edit, old_data), v.ValidPerms(),
234 chained_validators = [v.ValidRepoName(edit, old_data), v.ValidPerms(),
234 v.ValidSettings()]
235 v.ValidSettings()]
235 return _RepoForm
236 return _RepoForm
236
237
237
238
238 def ApplicationSettingsForm():
239 def ApplicationSettingsForm():
239 class _ApplicationSettingsForm(formencode.Schema):
240 class _ApplicationSettingsForm(formencode.Schema):
240 allow_extra_fields = True
241 allow_extra_fields = True
241 filter_extra_fields = False
242 filter_extra_fields = False
242 rhodecode_title = v.UnicodeString(strip=True, min=1, not_empty=True)
243 rhodecode_title = v.UnicodeString(strip=True, min=1, not_empty=True)
243 rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
244 rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
244 rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
245 rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
245
246
246 return _ApplicationSettingsForm
247 return _ApplicationSettingsForm
247
248
248
249
249 def ApplicationVisualisationForm():
250 def ApplicationVisualisationForm():
250 class _ApplicationVisualisationForm(formencode.Schema):
251 class _ApplicationVisualisationForm(formencode.Schema):
251 allow_extra_fields = True
252 allow_extra_fields = True
252 filter_extra_fields = False
253 filter_extra_fields = False
253 rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
254 rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
254 rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
255 rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
255 rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
256 rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
256
257
257 rhodecode_lightweight_dashboard = v.StringBoolean(if_missing=False)
258 rhodecode_lightweight_dashboard = v.StringBoolean(if_missing=False)
258 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
259 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
259
260
260 return _ApplicationVisualisationForm
261 return _ApplicationVisualisationForm
261
262
262
263
263 def ApplicationUiSettingsForm():
264 def ApplicationUiSettingsForm():
264 class _ApplicationUiSettingsForm(formencode.Schema):
265 class _ApplicationUiSettingsForm(formencode.Schema):
265 allow_extra_fields = True
266 allow_extra_fields = True
266 filter_extra_fields = False
267 filter_extra_fields = False
267 web_push_ssl = v.StringBoolean(if_missing=False)
268 web_push_ssl = v.StringBoolean(if_missing=False)
268 paths_root_path = All(
269 paths_root_path = All(
269 v.ValidPath(),
270 v.ValidPath(),
270 v.UnicodeString(strip=True, min=1, not_empty=True)
271 v.UnicodeString(strip=True, min=1, not_empty=True)
271 )
272 )
272 hooks_changegroup_update = v.StringBoolean(if_missing=False)
273 hooks_changegroup_update = v.StringBoolean(if_missing=False)
273 hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
274 hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
274 hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
275 hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
275 hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
276 hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
276
277
277 extensions_largefiles = v.StringBoolean(if_missing=False)
278 extensions_largefiles = v.StringBoolean(if_missing=False)
278 extensions_hgsubversion = v.StringBoolean(if_missing=False)
279 extensions_hgsubversion = v.StringBoolean(if_missing=False)
279 extensions_hggit = v.StringBoolean(if_missing=False)
280 extensions_hggit = v.StringBoolean(if_missing=False)
280
281
281 return _ApplicationUiSettingsForm
282 return _ApplicationUiSettingsForm
282
283
283
284
284 def DefaultPermissionsForm(perms_choices, register_choices, create_choices,
285 def DefaultPermissionsForm(perms_choices, register_choices, create_choices,
285 fork_choices):
286 fork_choices):
286 class _DefaultPermissionsForm(formencode.Schema):
287 class _DefaultPermissionsForm(formencode.Schema):
287 allow_extra_fields = True
288 allow_extra_fields = True
288 filter_extra_fields = True
289 filter_extra_fields = True
289 overwrite_default = v.StringBoolean(if_missing=False)
290 overwrite_default = v.StringBoolean(if_missing=False)
290 anonymous = v.StringBoolean(if_missing=False)
291 anonymous = v.StringBoolean(if_missing=False)
291 default_perm = v.OneOf(perms_choices)
292 default_perm = v.OneOf(perms_choices)
292 default_register = v.OneOf(register_choices)
293 default_register = v.OneOf(register_choices)
293 default_create = v.OneOf(create_choices)
294 default_create = v.OneOf(create_choices)
294 default_fork = v.OneOf(fork_choices)
295 default_fork = v.OneOf(fork_choices)
295
296
296 return _DefaultPermissionsForm
297 return _DefaultPermissionsForm
297
298
298
299
299 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
300 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
300 tls_kind_choices):
301 tls_kind_choices):
301 class _LdapSettingsForm(formencode.Schema):
302 class _LdapSettingsForm(formencode.Schema):
302 allow_extra_fields = True
303 allow_extra_fields = True
303 filter_extra_fields = True
304 filter_extra_fields = True
304 #pre_validators = [LdapLibValidator]
305 #pre_validators = [LdapLibValidator]
305 ldap_active = v.StringBoolean(if_missing=False)
306 ldap_active = v.StringBoolean(if_missing=False)
306 ldap_host = v.UnicodeString(strip=True,)
307 ldap_host = v.UnicodeString(strip=True,)
307 ldap_port = v.Number(strip=True,)
308 ldap_port = v.Number(strip=True,)
308 ldap_tls_kind = v.OneOf(tls_kind_choices)
309 ldap_tls_kind = v.OneOf(tls_kind_choices)
309 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices)
310 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices)
310 ldap_dn_user = v.UnicodeString(strip=True,)
311 ldap_dn_user = v.UnicodeString(strip=True,)
311 ldap_dn_pass = v.UnicodeString(strip=True,)
312 ldap_dn_pass = v.UnicodeString(strip=True,)
312 ldap_base_dn = v.UnicodeString(strip=True,)
313 ldap_base_dn = v.UnicodeString(strip=True,)
313 ldap_filter = v.UnicodeString(strip=True,)
314 ldap_filter = v.UnicodeString(strip=True,)
314 ldap_search_scope = v.OneOf(search_scope_choices)
315 ldap_search_scope = v.OneOf(search_scope_choices)
315 ldap_attr_login = All(
316 ldap_attr_login = All(
316 v.AttrLoginValidator(),
317 v.AttrLoginValidator(),
317 v.UnicodeString(strip=True,)
318 v.UnicodeString(strip=True,)
318 )
319 )
319 ldap_attr_firstname = v.UnicodeString(strip=True,)
320 ldap_attr_firstname = v.UnicodeString(strip=True,)
320 ldap_attr_lastname = v.UnicodeString(strip=True,)
321 ldap_attr_lastname = v.UnicodeString(strip=True,)
321 ldap_attr_email = v.UnicodeString(strip=True,)
322 ldap_attr_email = v.UnicodeString(strip=True,)
322
323
323 return _LdapSettingsForm
324 return _LdapSettingsForm
324
325
325
326
326 def UserExtraEmailForm():
327 def UserExtraEmailForm():
327 class _UserExtraEmailForm(formencode.Schema):
328 class _UserExtraEmailForm(formencode.Schema):
328 email = All(v.UniqSystemEmail(), v.Email)
329 email = All(v.UniqSystemEmail(), v.Email)
329
330
330 return _UserExtraEmailForm
331 return _UserExtraEmailForm
331
332
332
333
333 def PullRequestForm(repo_id):
334 def PullRequestForm(repo_id):
334 class _PullRequestForm(formencode.Schema):
335 class _PullRequestForm(formencode.Schema):
335 allow_extra_fields = True
336 allow_extra_fields = True
336 filter_extra_fields = True
337 filter_extra_fields = True
337
338
338 user = v.UnicodeString(strip=True, required=True)
339 user = v.UnicodeString(strip=True, required=True)
339 org_repo = v.UnicodeString(strip=True, required=True)
340 org_repo = v.UnicodeString(strip=True, required=True)
340 org_ref = v.UnicodeString(strip=True, required=True)
341 org_ref = v.UnicodeString(strip=True, required=True)
341 other_repo = v.UnicodeString(strip=True, required=True)
342 other_repo = v.UnicodeString(strip=True, required=True)
342 other_ref = v.UnicodeString(strip=True, required=True)
343 other_ref = v.UnicodeString(strip=True, required=True)
343 revisions = All(v.NotReviewedRevisions(repo_id)(), v.UniqueList(not_empty=True))
344 revisions = All(v.NotReviewedRevisions(repo_id)(), v.UniqueList(not_empty=True))
344 review_members = v.UniqueList(not_empty=True)
345 review_members = v.UniqueList(not_empty=True)
345
346
346 pullrequest_title = v.UnicodeString(strip=True, required=True, min=3)
347 pullrequest_title = v.UnicodeString(strip=True, required=True, min=3)
347 pullrequest_desc = v.UnicodeString(strip=True, required=False)
348 pullrequest_desc = v.UnicodeString(strip=True, required=False)
348
349
349 return _PullRequestForm
350 return _PullRequestForm
General Comments 0
You need to be logged in to leave comments. Login now