##// END OF EJS Templates
fixes #376 Cannot edit user (using container auth)
marcink -
r2072:98f91283 beta
parent child Browse files
Show More
@@ -1,552 +1,553 b''
1 1 .. _changelog:
2 2
3 3 Changelog
4 4 =========
5 5
6 6
7 7 1.3.3 (**2012-XX-XX**)
8 8 ----------------------
9 9
10 10 :status: in-progress
11 11 :branch: beta
12 12
13 13 news
14 14 ++++
15 15
16 16
17 17 fixes
18 18 +++++
19 19
20 20 - fixed some python2.5 compatibility issues
21 21 - fixed issues with removed repos was accidentally added as groups, after
22 22 full rescan of paths
23 - fixes #376 Cannot edit user (using container auth)
23 24
24 25 1.3.2 (**2012-02-28**)
25 26 ----------------------
26 27
27 28 news
28 29 ++++
29 30
30 31
31 32 fixes
32 33 +++++
33 34
34 35 - fixed git protocol issues with repos-groups
35 36 - fixed git remote repos validator that prevented from cloning remote git repos
36 37 - fixes #370 ending slashes fixes for repo and groups
37 38 - fixes #368 improved git-protocol detection to handle other clients
38 39 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
39 40 Moved To Root
40 41 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
41 42 - fixed #373 missing cascade drop on user_group_to_perm table
42 43
43 44 1.3.1 (**2012-02-27**)
44 45 ----------------------
45 46
46 47 news
47 48 ++++
48 49
49 50
50 51 fixes
51 52 +++++
52 53
53 54 - redirection loop occurs when remember-me wasn't checked during login
54 55 - fixes issues with git blob history generation
55 56 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
56 57
57 58 1.3.0 (**2012-02-26**)
58 59 ----------------------
59 60
60 61 news
61 62 ++++
62 63
63 64 - code review, inspired by github code-comments
64 65 - #215 rst and markdown README files support
65 66 - #252 Container-based and proxy pass-through authentication support
66 67 - #44 branch browser. Filtering of changelog by branches
67 68 - mercurial bookmarks support
68 69 - new hover top menu, optimized to add maximum size for important views
69 70 - configurable clone url template with possibility to specify protocol like
70 71 ssh:// or http:// and also manually alter other parts of clone_url.
71 72 - enabled largefiles extension by default
72 73 - optimized summary file pages and saved a lot of unused space in them
73 74 - #239 option to manually mark repository as fork
74 75 - #320 mapping of commit authors to RhodeCode users
75 76 - #304 hashes are displayed using monospace font
76 77 - diff configuration, toggle white lines and context lines
77 78 - #307 configurable diffs, whitespace toggle, increasing context lines
78 79 - sorting on branches, tags and bookmarks using YUI datatable
79 80 - improved file filter on files page
80 81 - implements #330 api method for listing nodes ar particular revision
81 82 - #73 added linking issues in commit messages to chosen issue tracker url
82 83 based on user defined regular expression
83 84 - added linking of changesets in commit messages
84 85 - new compact changelog with expandable commit messages
85 86 - firstname and lastname are optional in user creation
86 87 - #348 added post-create repository hook
87 88 - #212 global encoding settings is now configurable from .ini files
88 89 - #227 added repository groups permissions
89 90 - markdown gets codehilite extensions
90 91 - new API methods, delete_repositories, grante/revoke permissions for groups
91 92 and repos
92 93
93 94
94 95 fixes
95 96 +++++
96 97
97 98 - rewrote dbsession management for atomic operations, and better error handling
98 99 - fixed sorting of repo tables
99 100 - #326 escape of special html entities in diffs
100 101 - normalized user_name => username in api attributes
101 102 - fixes #298 ldap created users with mixed case emails created conflicts
102 103 on saving a form
103 104 - fixes issue when owner of a repo couldn't revoke permissions for users
104 105 and groups
105 106 - fixes #271 rare JSON serialization problem with statistics
106 107 - fixes #337 missing validation check for conflicting names of a group with a
107 108 repositories group
108 109 - #340 fixed session problem for mysql and celery tasks
109 110 - fixed #331 RhodeCode mangles repository names if the a repository group
110 111 contains the "full path" to the repositories
111 112 - #355 RhodeCode doesn't store encrypted LDAP passwords
112 113
113 114 1.2.5 (**2012-01-28**)
114 115 ----------------------
115 116
116 117 news
117 118 ++++
118 119
119 120 fixes
120 121 +++++
121 122
122 123 - #340 Celery complains about MySQL server gone away, added session cleanup
123 124 for celery tasks
124 125 - #341 "scanning for repositories in None" log message during Rescan was missing
125 126 a parameter
126 127 - fixed creating archives with subrepos. Some hooks were triggered during that
127 128 operation leading to crash.
128 129 - fixed missing email in account page.
129 130 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
130 131 forking on windows impossible
131 132
132 133 1.2.4 (**2012-01-19**)
133 134 ----------------------
134 135
135 136 news
136 137 ++++
137 138
138 139 - RhodeCode is bundled with mercurial series 2.0.X by default, with
139 140 full support to largefiles extension. Enabled by default in new installations
140 141 - #329 Ability to Add/Remove Groups to/from a Repository via AP
141 142 - added requires.txt file with requirements
142 143
143 144 fixes
144 145 +++++
145 146
146 147 - fixes db session issues with celery when emailing admins
147 148 - #331 RhodeCode mangles repository names if the a repository group
148 149 contains the "full path" to the repositories
149 150 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
150 151 - DB session cleanup after hg protocol operations, fixes issues with
151 152 `mysql has gone away` errors
152 153 - #333 doc fixes for get_repo api function
153 154 - #271 rare JSON serialization problem with statistics enabled
154 155 - #337 Fixes issues with validation of repository name conflicting with
155 156 a group name. A proper message is now displayed.
156 157 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
157 158 doesn't work
158 159 - #316 fixes issues with web description in hgrc files
159 160
160 161 1.2.3 (**2011-11-02**)
161 162 ----------------------
162 163
163 164 news
164 165 ++++
165 166
166 167 - added option to manage repos group for non admin users
167 168 - added following API methods for get_users, create_user, get_users_groups,
168 169 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
169 170 get_repo, create_repo, add_user_to_repo
170 171 - implements #237 added password confirmation for my account
171 172 and admin edit user.
172 173 - implements #291 email notification for global events are now sent to all
173 174 administrator users, and global config email.
174 175
175 176 fixes
176 177 +++++
177 178
178 179 - added option for passing auth method for smtp mailer
179 180 - #276 issue with adding a single user with id>10 to usergroups
180 181 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
181 182 - #288 fixes managing of repos in a group for non admin user
182 183
183 184 1.2.2 (**2011-10-17**)
184 185 ----------------------
185 186
186 187 news
187 188 ++++
188 189
189 190 - #226 repo groups are available by path instead of numerical id
190 191
191 192 fixes
192 193 +++++
193 194
194 195 - #259 Groups with the same name but with different parent group
195 196 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
196 197 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
197 198 - #265 ldap save fails sometimes on converting attributes to booleans,
198 199 added getter and setter into model that will prevent from this on db model level
199 200 - fixed problems with timestamps issues #251 and #213
200 201 - fixes #266 RhodeCode allows to create repo with the same name and in
201 202 the same parent as group
202 203 - fixes #245 Rescan of the repositories on Windows
203 204 - fixes #248 cannot edit repos inside a group on windows
204 205 - fixes #219 forking problems on windows
205 206
206 207 1.2.1 (**2011-10-08**)
207 208 ----------------------
208 209
209 210 news
210 211 ++++
211 212
212 213
213 214 fixes
214 215 +++++
215 216
216 217 - fixed problems with basic auth and push problems
217 218 - gui fixes
218 219 - fixed logger
219 220
220 221 1.2.0 (**2011-10-07**)
221 222 ----------------------
222 223
223 224 news
224 225 ++++
225 226
226 227 - implemented #47 repository groups
227 228 - implemented #89 Can setup google analytics code from settings menu
228 229 - implemented #91 added nicer looking archive urls with more download options
229 230 like tags, branches
230 231 - implemented #44 into file browsing, and added follow branch option
231 232 - implemented #84 downloads can be enabled/disabled for each repository
232 233 - anonymous repository can be cloned without having to pass default:default
233 234 into clone url
234 235 - fixed #90 whoosh indexer can index chooses repositories passed in command
235 236 line
236 237 - extended journal with day aggregates and paging
237 238 - implemented #107 source code lines highlight ranges
238 239 - implemented #93 customizable changelog on combined revision ranges -
239 240 equivalent of githubs compare view
240 241 - implemented #108 extended and more powerful LDAP configuration
241 242 - implemented #56 users groups
242 243 - major code rewrites optimized codes for speed and memory usage
243 244 - raw and diff downloads are now in git format
244 245 - setup command checks for write access to given path
245 246 - fixed many issues with international characters and unicode. It uses utf8
246 247 decode with replace to provide less errors even with non utf8 encoded strings
247 248 - #125 added API KEY access to feeds
248 249 - #109 Repository can be created from external Mercurial link (aka. remote
249 250 repository, and manually updated (via pull) from admin panel
250 251 - beta git support - push/pull server + basic view for git repos
251 252 - added followers page and forks page
252 253 - server side file creation (with binary file upload interface)
253 254 and edition with commits powered by codemirror
254 255 - #111 file browser file finder, quick lookup files on whole file tree
255 256 - added quick login sliding menu into main page
256 257 - changelog uses lazy loading of affected files details, in some scenarios
257 258 this can improve speed of changelog page dramatically especially for
258 259 larger repositories.
259 260 - implements #214 added support for downloading subrepos in download menu.
260 261 - Added basic API for direct operations on rhodecode via JSON
261 262 - Implemented advanced hook management
262 263
263 264 fixes
264 265 +++++
265 266
266 267 - fixed file browser bug, when switching into given form revision the url was
267 268 not changing
268 269 - fixed propagation to error controller on simplehg and simplegit middlewares
269 270 - fixed error when trying to make a download on empty repository
270 271 - fixed problem with '[' chars in commit messages in journal
271 272 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
272 273 - journal fork fixes
273 274 - removed issue with space inside renamed repository after deletion
274 275 - fixed strange issue on formencode imports
275 276 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
276 277 - #150 fixes for errors on repositories mapped in db but corrupted in
277 278 filesystem
278 279 - fixed problem with ascendant characters in realm #181
279 280 - fixed problem with sqlite file based database connection pool
280 281 - whoosh indexer and code stats share the same dynamic extensions map
281 282 - fixes #188 - relationship delete of repo_to_perm entry on user removal
282 283 - fixes issue #189 Trending source files shows "show more" when no more exist
283 284 - fixes issue #197 Relative paths for pidlocks
284 285 - fixes issue #198 password will require only 3 chars now for login form
285 286 - fixes issue #199 wrong redirection for non admin users after creating a repository
286 287 - fixes issues #202, bad db constraint made impossible to attach same group
287 288 more than one time. Affects only mysql/postgres
288 289 - fixes #218 os.kill patch for windows was missing sig param
289 290 - improved rendering of dag (they are not trimmed anymore when number of
290 291 heads exceeds 5)
291 292
292 293 1.1.8 (**2011-04-12**)
293 294 ----------------------
294 295
295 296 news
296 297 ++++
297 298
298 299 - improved windows support
299 300
300 301 fixes
301 302 +++++
302 303
303 304 - fixed #140 freeze of python dateutil library, since new version is python2.x
304 305 incompatible
305 306 - setup-app will check for write permission in given path
306 307 - cleaned up license info issue #149
307 308 - fixes for issues #137,#116 and problems with unicode and accented characters.
308 309 - fixes crashes on gravatar, when passed in email as unicode
309 310 - fixed tooltip flickering problems
310 311 - fixed came_from redirection on windows
311 312 - fixed logging modules, and sql formatters
312 313 - windows fixes for os.kill issue #133
313 314 - fixes path splitting for windows issues #148
314 315 - fixed issue #143 wrong import on migration to 1.1.X
315 316 - fixed problems with displaying binary files, thanks to Thomas Waldmann
316 317 - removed name from archive files since it's breaking ui for long repo names
317 318 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
318 319 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
319 320 Thomas Waldmann
320 321 - fixed issue #166 summary pager was skipping 10 revisions on second page
321 322
322 323
323 324 1.1.7 (**2011-03-23**)
324 325 ----------------------
325 326
326 327 news
327 328 ++++
328 329
329 330 fixes
330 331 +++++
331 332
332 333 - fixed (again) #136 installation support for FreeBSD
333 334
334 335
335 336 1.1.6 (**2011-03-21**)
336 337 ----------------------
337 338
338 339 news
339 340 ++++
340 341
341 342 fixes
342 343 +++++
343 344
344 345 - fixed #136 installation support for FreeBSD
345 346 - RhodeCode will check for python version during installation
346 347
347 348 1.1.5 (**2011-03-17**)
348 349 ----------------------
349 350
350 351 news
351 352 ++++
352 353
353 354 - basic windows support, by exchanging pybcrypt into sha256 for windows only
354 355 highly inspired by idea of mantis406
355 356
356 357 fixes
357 358 +++++
358 359
359 360 - fixed sorting by author in main page
360 361 - fixed crashes with diffs on binary files
361 362 - fixed #131 problem with boolean values for LDAP
362 363 - fixed #122 mysql problems thanks to striker69
363 364 - fixed problem with errors on calling raw/raw_files/annotate functions
364 365 with unknown revisions
365 366 - fixed returned rawfiles attachment names with international character
366 367 - cleaned out docs, big thanks to Jason Harris
367 368
368 369 1.1.4 (**2011-02-19**)
369 370 ----------------------
370 371
371 372 news
372 373 ++++
373 374
374 375 fixes
375 376 +++++
376 377
377 378 - fixed formencode import problem on settings page, that caused server crash
378 379 when that page was accessed as first after server start
379 380 - journal fixes
380 381 - fixed option to access repository just by entering http://server/<repo_name>
381 382
382 383 1.1.3 (**2011-02-16**)
383 384 ----------------------
384 385
385 386 news
386 387 ++++
387 388
388 389 - implemented #102 allowing the '.' character in username
389 390 - added option to access repository just by entering http://server/<repo_name>
390 391 - celery task ignores result for better performance
391 392
392 393 fixes
393 394 +++++
394 395
395 396 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
396 397 apollo13 and Johan Walles
397 398 - small fixes in journal
398 399 - fixed problems with getting setting for celery from .ini files
399 400 - registration, password reset and login boxes share the same title as main
400 401 application now
401 402 - fixed #113: to high permissions to fork repository
402 403 - fixed problem with '[' chars in commit messages in journal
403 404 - removed issue with space inside renamed repository after deletion
404 405 - db transaction fixes when filesystem repository creation failed
405 406 - fixed #106 relation issues on databases different than sqlite
406 407 - fixed static files paths links to use of url() method
407 408
408 409 1.1.2 (**2011-01-12**)
409 410 ----------------------
410 411
411 412 news
412 413 ++++
413 414
414 415
415 416 fixes
416 417 +++++
417 418
418 419 - fixes #98 protection against float division of percentage stats
419 420 - fixed graph bug
420 421 - forced webhelpers version since it was making troubles during installation
421 422
422 423 1.1.1 (**2011-01-06**)
423 424 ----------------------
424 425
425 426 news
426 427 ++++
427 428
428 429 - added force https option into ini files for easier https usage (no need to
429 430 set server headers with this options)
430 431 - small css updates
431 432
432 433 fixes
433 434 +++++
434 435
435 436 - fixed #96 redirect loop on files view on repositories without changesets
436 437 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
437 438 and server crashed with errors
438 439 - fixed large tooltips problems on main page
439 440 - fixed #92 whoosh indexer is more error proof
440 441
441 442 1.1.0 (**2010-12-18**)
442 443 ----------------------
443 444
444 445 news
445 446 ++++
446 447
447 448 - rewrite of internals for vcs >=0.1.10
448 449 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
449 450 with older clients
450 451 - anonymous access, authentication via ldap
451 452 - performance upgrade for cached repos list - each repository has its own
452 453 cache that's invalidated when needed.
453 454 - performance upgrades on repositories with large amount of commits (20K+)
454 455 - main page quick filter for filtering repositories
455 456 - user dashboards with ability to follow chosen repositories actions
456 457 - sends email to admin on new user registration
457 458 - added cache/statistics reset options into repository settings
458 459 - more detailed action logger (based on hooks) with pushed changesets lists
459 460 and options to disable those hooks from admin panel
460 461 - introduced new enhanced changelog for merges that shows more accurate results
461 462 - new improved and faster code stats (based on pygments lexers mapping tables,
462 463 showing up to 10 trending sources for each repository. Additionally stats
463 464 can be disabled in repository settings.
464 465 - gui optimizations, fixed application width to 1024px
465 466 - added cut off (for large files/changesets) limit into config files
466 467 - whoosh, celeryd, upgrade moved to paster command
467 468 - other than sqlite database backends can be used
468 469
469 470 fixes
470 471 +++++
471 472
472 473 - fixes #61 forked repo was showing only after cache expired
473 474 - fixes #76 no confirmation on user deletes
474 475 - fixes #66 Name field misspelled
475 476 - fixes #72 block user removal when he owns repositories
476 477 - fixes #69 added password confirmation fields
477 478 - fixes #87 RhodeCode crashes occasionally on updating repository owner
478 479 - fixes #82 broken annotations on files with more than 1 blank line at the end
479 480 - a lot of fixes and tweaks for file browser
480 481 - fixed detached session issues
481 482 - fixed when user had no repos he would see all repos listed in my account
482 483 - fixed ui() instance bug when global hgrc settings was loaded for server
483 484 instance and all hgrc options were merged with our db ui() object
484 485 - numerous small bugfixes
485 486
486 487 (special thanks for TkSoh for detailed feedback)
487 488
488 489
489 490 1.0.2 (**2010-11-12**)
490 491 ----------------------
491 492
492 493 news
493 494 ++++
494 495
495 496 - tested under python2.7
496 497 - bumped sqlalchemy and celery versions
497 498
498 499 fixes
499 500 +++++
500 501
501 502 - fixed #59 missing graph.js
502 503 - fixed repo_size crash when repository had broken symlinks
503 504 - fixed python2.5 crashes.
504 505
505 506
506 507 1.0.1 (**2010-11-10**)
507 508 ----------------------
508 509
509 510 news
510 511 ++++
511 512
512 513 - small css updated
513 514
514 515 fixes
515 516 +++++
516 517
517 518 - fixed #53 python2.5 incompatible enumerate calls
518 519 - fixed #52 disable mercurial extension for web
519 520 - fixed #51 deleting repositories don't delete it's dependent objects
520 521
521 522
522 523 1.0.0 (**2010-11-02**)
523 524 ----------------------
524 525
525 526 - security bugfix simplehg wasn't checking for permissions on commands
526 527 other than pull or push.
527 528 - fixed doubled messages after push or pull in admin journal
528 529 - templating and css corrections, fixed repo switcher on chrome, updated titles
529 530 - admin menu accessible from options menu on repository view
530 531 - permissions cached queries
531 532
532 533 1.0.0rc4 (**2010-10-12**)
533 534 --------------------------
534 535
535 536 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
536 537 - removed cache_manager settings from sqlalchemy meta
537 538 - added sqlalchemy cache settings to ini files
538 539 - validated password length and added second try of failure on paster setup-app
539 540 - fixed setup database destroy prompt even when there was no db
540 541
541 542
542 543 1.0.0rc3 (**2010-10-11**)
543 544 -------------------------
544 545
545 546 - fixed i18n during installation.
546 547
547 548 1.0.0rc2 (**2010-10-11**)
548 549 -------------------------
549 550
550 551 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
551 552 occure. After vcs is fixed it'll be put back again.
552 553 - templating/css rewrites, optimized css. No newline at end of file
@@ -1,773 +1,773 b''
1 1 """ this is forms validation classes
2 2 http://formencode.org/module-formencode.validators.html
3 3 for list off all availible validators
4 4
5 5 we can create our own validators
6 6
7 7 The table below outlines the options which can be used in a schema in addition to the validators themselves
8 8 pre_validators [] These validators will be applied before the schema
9 9 chained_validators [] These validators will be applied after the schema
10 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 11 filter_extra_fields False If True, then keys that aren't associated with a validator are removed
12 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 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 16 <name> = formencode.validators.<name of validator>
17 17 <name> must equal form name
18 18 list=[1,2,3,4,5]
19 19 for SELECT use formencode.All(OneOf(list), Int())
20 20
21 21 """
22 22 import os
23 23 import re
24 24 import logging
25 25 import traceback
26 26
27 27 import formencode
28 28 from formencode import All
29 29 from formencode.validators import UnicodeString, OneOf, Int, Number, Regex, \
30 30 Email, Bool, StringBoolean, Set
31 31
32 32 from pylons.i18n.translation import _
33 33 from webhelpers.pylonslib.secure_form import authentication_token
34 34
35 35 from rhodecode.config.routing import ADMIN_PREFIX
36 36 from rhodecode.lib.utils import repo_name_slug
37 37 from rhodecode.lib.auth import authenticate, get_crypt_password
38 38 from rhodecode.lib.exceptions import LdapImportError
39 39 from rhodecode.model.db import User, UsersGroup, RepoGroup, Repository
40 40 from rhodecode import BACKENDS
41 41
42 42 log = logging.getLogger(__name__)
43 43
44 44
45 45 #this is needed to translate the messages using _() in validators
46 46 class State_obj(object):
47 47 _ = staticmethod(_)
48 48
49 49
50 50 #==============================================================================
51 51 # VALIDATORS
52 52 #==============================================================================
53 53 class ValidAuthToken(formencode.validators.FancyValidator):
54 54 messages = {'invalid_token': _('Token mismatch')}
55 55
56 56 def validate_python(self, value, state):
57 57
58 58 if value != authentication_token():
59 59 raise formencode.Invalid(
60 60 self.message('invalid_token',
61 61 state, search_number=value),
62 62 value,
63 63 state
64 64 )
65 65
66 66
67 67 def ValidUsername(edit, old_data):
68 68 class _ValidUsername(formencode.validators.FancyValidator):
69 69
70 70 def validate_python(self, value, state):
71 71 if value in ['default', 'new_user']:
72 72 raise formencode.Invalid(_('Invalid username'), value, state)
73 73 #check if user is unique
74 74 old_un = None
75 75 if edit:
76 76 old_un = User.get(old_data.get('user_id')).username
77 77
78 78 if old_un != value or not edit:
79 79 if User.get_by_username(value, case_insensitive=True):
80 80 raise formencode.Invalid(_('This username already '
81 81 'exists') , value, state)
82 82
83 83 if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None:
84 84 raise formencode.Invalid(
85 85 _('Username may only contain alphanumeric characters '
86 86 'underscores, periods or dashes and must begin with '
87 87 'alphanumeric character'),
88 88 value,
89 89 state
90 90 )
91 91
92 92 return _ValidUsername
93 93
94 94
95 95 def ValidUsersGroup(edit, old_data):
96 96
97 97 class _ValidUsersGroup(formencode.validators.FancyValidator):
98 98
99 99 def validate_python(self, value, state):
100 100 if value in ['default']:
101 101 raise formencode.Invalid(_('Invalid group name'), value, state)
102 102 #check if group is unique
103 103 old_ugname = None
104 104 if edit:
105 105 old_ugname = UsersGroup.get(
106 106 old_data.get('users_group_id')).users_group_name
107 107
108 108 if old_ugname != value or not edit:
109 109 if UsersGroup.get_by_group_name(value, cache=False,
110 110 case_insensitive=True):
111 111 raise formencode.Invalid(_('This users group '
112 112 'already exists'), value,
113 113 state)
114 114
115 115 if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None:
116 116 raise formencode.Invalid(
117 117 _('RepoGroup name may only contain alphanumeric characters '
118 118 'underscores, periods or dashes and must begin with '
119 119 'alphanumeric character'),
120 120 value,
121 121 state
122 122 )
123 123
124 124 return _ValidUsersGroup
125 125
126 126
127 127 def ValidReposGroup(edit, old_data):
128 128 class _ValidReposGroup(formencode.validators.FancyValidator):
129 129
130 130 def validate_python(self, value, state):
131 131 # TODO WRITE VALIDATIONS
132 132 group_name = value.get('group_name')
133 133 group_parent_id = value.get('group_parent_id')
134 134
135 135 # slugify repo group just in case :)
136 136 slug = repo_name_slug(group_name)
137 137
138 138 # check for parent of self
139 139 parent_of_self = lambda: (
140 140 old_data['group_id'] == int(group_parent_id)
141 141 if group_parent_id else False
142 142 )
143 143 if edit and parent_of_self():
144 144 e_dict = {
145 145 'group_parent_id': _('Cannot assign this group as parent')
146 146 }
147 147 raise formencode.Invalid('', value, state,
148 148 error_dict=e_dict)
149 149
150 150 old_gname = None
151 151 if edit:
152 152 old_gname = RepoGroup.get(old_data.get('group_id')).group_name
153 153
154 154 if old_gname != group_name or not edit:
155 155
156 156 # check group
157 157 gr = RepoGroup.query()\
158 158 .filter(RepoGroup.group_name == slug)\
159 159 .filter(RepoGroup.group_parent_id == group_parent_id)\
160 160 .scalar()
161 161
162 162 if gr:
163 163 e_dict = {
164 164 'group_name': _('This group already exists')
165 165 }
166 166 raise formencode.Invalid('', value, state,
167 167 error_dict=e_dict)
168 168
169 169 # check for same repo
170 170 repo = Repository.query()\
171 171 .filter(Repository.repo_name == slug)\
172 172 .scalar()
173 173
174 174 if repo:
175 175 e_dict = {
176 176 'group_name': _('Repository with this name already exists')
177 177 }
178 178 raise formencode.Invalid('', value, state,
179 179 error_dict=e_dict)
180 180
181 181 return _ValidReposGroup
182 182
183 183
184 184 class ValidPassword(formencode.validators.FancyValidator):
185 185
186 186 def to_python(self, value, state):
187 187
188 188 if not value:
189 189 return
190 190
191 191 if value.get('password'):
192 192 try:
193 193 value['password'] = get_crypt_password(value['password'])
194 194 except UnicodeEncodeError:
195 195 e_dict = {'password': _('Invalid characters in password')}
196 196 raise formencode.Invalid('', value, state, error_dict=e_dict)
197 197
198 198 if value.get('password_confirmation'):
199 199 try:
200 200 value['password_confirmation'] = \
201 201 get_crypt_password(value['password_confirmation'])
202 202 except UnicodeEncodeError:
203 203 e_dict = {
204 204 'password_confirmation': _('Invalid characters in password')
205 205 }
206 206 raise formencode.Invalid('', value, state, error_dict=e_dict)
207 207
208 208 if value.get('new_password'):
209 209 try:
210 210 value['new_password'] = \
211 211 get_crypt_password(value['new_password'])
212 212 except UnicodeEncodeError:
213 213 e_dict = {'new_password': _('Invalid characters in password')}
214 214 raise formencode.Invalid('', value, state, error_dict=e_dict)
215 215
216 216 return value
217 217
218 218
219 219 class ValidPasswordsMatch(formencode.validators.FancyValidator):
220 220
221 221 def validate_python(self, value, state):
222 222
223 223 pass_val = value.get('password') or value.get('new_password')
224 224 if pass_val != value['password_confirmation']:
225 225 e_dict = {'password_confirmation':
226 226 _('Passwords do not match')}
227 227 raise formencode.Invalid('', value, state, error_dict=e_dict)
228 228
229 229
230 230 class ValidAuth(formencode.validators.FancyValidator):
231 231 messages = {
232 232 'invalid_password':_('invalid password'),
233 233 'invalid_login':_('invalid user name'),
234 234 'disabled_account':_('Your account is disabled')
235 235 }
236 236
237 237 # error mapping
238 238 e_dict = {'username': messages['invalid_login'],
239 239 'password': messages['invalid_password']}
240 240 e_dict_disable = {'username': messages['disabled_account']}
241 241
242 242 def validate_python(self, value, state):
243 243 password = value['password']
244 244 username = value['username']
245 245 user = User.get_by_username(username)
246 246
247 247 if authenticate(username, password):
248 248 return value
249 249 else:
250 250 if user and user.active is False:
251 251 log.warning('user %s is disabled' % username)
252 252 raise formencode.Invalid(
253 253 self.message('disabled_account',
254 254 state=State_obj),
255 255 value, state,
256 256 error_dict=self.e_dict_disable
257 257 )
258 258 else:
259 259 log.warning('user %s failed to authenticate' % username)
260 260 raise formencode.Invalid(
261 261 self.message('invalid_password',
262 262 state=State_obj), value, state,
263 263 error_dict=self.e_dict
264 264 )
265 265
266 266
267 267 class ValidRepoUser(formencode.validators.FancyValidator):
268 268
269 269 def to_python(self, value, state):
270 270 try:
271 271 User.query().filter(User.active == True)\
272 272 .filter(User.username == value).one()
273 273 except Exception:
274 274 raise formencode.Invalid(_('This username is not valid'),
275 275 value, state)
276 276 return value
277 277
278 278
279 279 def ValidRepoName(edit, old_data):
280 280 class _ValidRepoName(formencode.validators.FancyValidator):
281 281 def to_python(self, value, state):
282 282
283 283 repo_name = value.get('repo_name')
284 284
285 285 slug = repo_name_slug(repo_name)
286 286 if slug in [ADMIN_PREFIX, '']:
287 287 e_dict = {'repo_name': _('This repository name is disallowed')}
288 288 raise formencode.Invalid('', value, state, error_dict=e_dict)
289 289
290 290 if value.get('repo_group'):
291 291 gr = RepoGroup.get(value.get('repo_group'))
292 292 group_path = gr.full_path
293 293 # value needs to be aware of group name in order to check
294 294 # db key This is an actual just the name to store in the
295 295 # database
296 296 repo_name_full = group_path + RepoGroup.url_sep() + repo_name
297 297
298 298 else:
299 299 group_path = ''
300 300 repo_name_full = repo_name
301 301
302 302 value['repo_name_full'] = repo_name_full
303 303 rename = old_data.get('repo_name') != repo_name_full
304 304 create = not edit
305 305 if rename or create:
306 306
307 307 if group_path != '':
308 308 if Repository.get_by_repo_name(repo_name_full):
309 309 e_dict = {
310 310 'repo_name': _('This repository already exists in '
311 311 'a group "%s"') % gr.group_name
312 312 }
313 313 raise formencode.Invalid('', value, state,
314 314 error_dict=e_dict)
315 315 elif RepoGroup.get_by_group_name(repo_name_full):
316 316 e_dict = {
317 317 'repo_name': _('There is a group with this name '
318 318 'already "%s"') % repo_name_full
319 319 }
320 320 raise formencode.Invalid('', value, state,
321 321 error_dict=e_dict)
322 322
323 323 elif Repository.get_by_repo_name(repo_name_full):
324 324 e_dict = {'repo_name': _('This repository '
325 325 'already exists')}
326 326 raise formencode.Invalid('', value, state,
327 327 error_dict=e_dict)
328 328
329 329 return value
330 330
331 331 return _ValidRepoName
332 332
333 333
334 334 def ValidForkName(*args, **kwargs):
335 335 return ValidRepoName(*args, **kwargs)
336 336
337 337
338 338 def SlugifyName():
339 339 class _SlugifyName(formencode.validators.FancyValidator):
340 340
341 341 def to_python(self, value, state):
342 342 return repo_name_slug(value)
343 343
344 344 return _SlugifyName
345 345
346 346
347 347 def ValidCloneUri():
348 348 from rhodecode.lib.utils import make_ui
349 349
350 350 def url_handler(repo_type, url, proto, ui=None):
351 351 if repo_type == 'hg':
352 352 from mercurial.httprepo import httprepository, httpsrepository
353 353 if proto == 'https':
354 354 httpsrepository(make_ui('db'), url).capabilities
355 355 elif proto == 'http':
356 356 httprepository(make_ui('db'), url).capabilities
357 357 elif repo_type == 'git':
358 358 #TODO: write a git url validator
359 359 pass
360 360
361 361 class _ValidCloneUri(formencode.validators.FancyValidator):
362 362
363 363 def to_python(self, value, state):
364 364
365 365 repo_type = value.get('repo_type')
366 366 url = value.get('clone_uri')
367 367 e_dict = {'clone_uri': _('invalid clone url')}
368 368
369 369 if not url:
370 370 pass
371 371 elif url.startswith('https'):
372 372 try:
373 373 url_handler(repo_type, url, 'https', make_ui('db'))
374 374 except Exception:
375 375 log.error(traceback.format_exc())
376 376 raise formencode.Invalid('', value, state, error_dict=e_dict)
377 377 elif url.startswith('http'):
378 378 try:
379 379 url_handler(repo_type, url, 'http', make_ui('db'))
380 380 except Exception:
381 381 log.error(traceback.format_exc())
382 382 raise formencode.Invalid('', value, state, error_dict=e_dict)
383 383 else:
384 384 e_dict = {'clone_uri': _('Invalid clone url, provide a '
385 385 'valid clone http\s url')}
386 386 raise formencode.Invalid('', value, state, error_dict=e_dict)
387 387
388 388 return value
389 389
390 390 return _ValidCloneUri
391 391
392 392
393 393 def ValidForkType(old_data):
394 394 class _ValidForkType(formencode.validators.FancyValidator):
395 395
396 396 def to_python(self, value, state):
397 397 if old_data['repo_type'] != value:
398 398 raise formencode.Invalid(_('Fork have to be the same '
399 399 'type as original'), value, state)
400 400
401 401 return value
402 402 return _ValidForkType
403 403
404 404
405 405 def ValidPerms(type_='repo'):
406 406 if type_ == 'group':
407 407 EMPTY_PERM = 'group.none'
408 408 elif type_ == 'repo':
409 409 EMPTY_PERM = 'repository.none'
410 410
411 411 class _ValidPerms(formencode.validators.FancyValidator):
412 412 messages = {
413 413 'perm_new_member_name':
414 414 _('This username or users group name is not valid')
415 415 }
416 416
417 417 def to_python(self, value, state):
418 418 perms_update = []
419 419 perms_new = []
420 420 # build a list of permission to update and new permission to create
421 421 for k, v in value.items():
422 422 # means new added member to permissions
423 423 if k.startswith('perm_new_member'):
424 424 new_perm = value.get('perm_new_member', False)
425 425 new_member = value.get('perm_new_member_name', False)
426 426 new_type = value.get('perm_new_member_type')
427 427
428 428 if new_member and new_perm:
429 429 if (new_member, new_perm, new_type) not in perms_new:
430 430 perms_new.append((new_member, new_perm, new_type))
431 431 elif k.startswith('u_perm_') or k.startswith('g_perm_'):
432 432 member = k[7:]
433 433 t = {'u': 'user',
434 434 'g': 'users_group'
435 435 }[k[0]]
436 436 if member == 'default':
437 437 if value.get('private'):
438 438 # set none for default when updating to private repo
439 439 v = EMPTY_PERM
440 440 perms_update.append((member, v, t))
441 441
442 442 value['perms_updates'] = perms_update
443 443 value['perms_new'] = perms_new
444 444
445 445 # update permissions
446 446 for k, v, t in perms_new:
447 447 try:
448 448 if t is 'user':
449 449 self.user_db = User.query()\
450 450 .filter(User.active == True)\
451 451 .filter(User.username == k).one()
452 452 if t is 'users_group':
453 453 self.user_db = UsersGroup.query()\
454 454 .filter(UsersGroup.users_group_active == True)\
455 455 .filter(UsersGroup.users_group_name == k).one()
456 456
457 457 except Exception:
458 458 msg = self.message('perm_new_member_name',
459 459 state=State_obj)
460 460 raise formencode.Invalid(
461 461 msg, value, state, error_dict={'perm_new_member_name': msg}
462 462 )
463 463 return value
464 464 return _ValidPerms
465 465
466 466
467 467 class ValidSettings(formencode.validators.FancyValidator):
468 468
469 469 def to_python(self, value, state):
470 470 # settings form can't edit user
471 471 if 'user' in value:
472 472 del['value']['user']
473 473 return value
474 474
475 475
476 476 class ValidPath(formencode.validators.FancyValidator):
477 477 def to_python(self, value, state):
478 478
479 479 if not os.path.isdir(value):
480 480 msg = _('This is not a valid path')
481 481 raise formencode.Invalid(msg, value, state,
482 482 error_dict={'paths_root_path': msg})
483 483 return value
484 484
485 485
486 486 def UniqSystemEmail(old_data):
487 487 class _UniqSystemEmail(formencode.validators.FancyValidator):
488 488 def to_python(self, value, state):
489 489 value = value.lower()
490 if old_data.get('email', '').lower() != value:
490 if (old_data.get('email') or '').lower() != value:
491 491 user = User.get_by_email(value, case_insensitive=True)
492 492 if user:
493 493 raise formencode.Invalid(
494 494 _("This e-mail address is already taken"), value, state
495 495 )
496 496 return value
497 497
498 498 return _UniqSystemEmail
499 499
500 500
501 501 class ValidSystemEmail(formencode.validators.FancyValidator):
502 502 def to_python(self, value, state):
503 503 value = value.lower()
504 504 user = User.get_by_email(value, case_insensitive=True)
505 505 if user is None:
506 506 raise formencode.Invalid(
507 507 _("This e-mail address doesn't exist."), value, state
508 508 )
509 509
510 510 return value
511 511
512 512
513 513 class LdapLibValidator(formencode.validators.FancyValidator):
514 514
515 515 def to_python(self, value, state):
516 516
517 517 try:
518 518 import ldap
519 519 except ImportError:
520 520 raise LdapImportError
521 521 return value
522 522
523 523
524 524 class AttrLoginValidator(formencode.validators.FancyValidator):
525 525
526 526 def to_python(self, value, state):
527 527
528 528 if not value or not isinstance(value, (str, unicode)):
529 529 raise formencode.Invalid(
530 530 _("The LDAP Login attribute of the CN must be specified - "
531 531 "this is the name of the attribute that is equivalent "
532 532 "to 'username'"), value, state
533 533 )
534 534
535 535 return value
536 536
537 537
538 538 #==============================================================================
539 539 # FORMS
540 540 #==============================================================================
541 541 class LoginForm(formencode.Schema):
542 542 allow_extra_fields = True
543 543 filter_extra_fields = True
544 544 username = UnicodeString(
545 545 strip=True,
546 546 min=1,
547 547 not_empty=True,
548 548 messages={
549 549 'empty': _('Please enter a login'),
550 550 'tooShort': _('Enter a value %(min)i characters long or more')}
551 551 )
552 552
553 553 password = UnicodeString(
554 554 strip=True,
555 555 min=3,
556 556 not_empty=True,
557 557 messages={
558 558 'empty': _('Please enter a password'),
559 559 'tooShort': _('Enter %(min)i characters or more')}
560 560 )
561 561
562 562 remember = StringBoolean(if_missing=False)
563 563
564 564 chained_validators = [ValidAuth]
565 565
566 566
567 567 def UserForm(edit=False, old_data={}):
568 568 class _UserForm(formencode.Schema):
569 569 allow_extra_fields = True
570 570 filter_extra_fields = True
571 571 username = All(UnicodeString(strip=True, min=1, not_empty=True),
572 572 ValidUsername(edit, old_data))
573 573 if edit:
574 574 new_password = All(UnicodeString(strip=True, min=6, not_empty=False))
575 575 password_confirmation = All(UnicodeString(strip=True, min=6,
576 576 not_empty=False))
577 577 admin = StringBoolean(if_missing=False)
578 578 else:
579 579 password = All(UnicodeString(strip=True, min=6, not_empty=True))
580 580 password_confirmation = All(UnicodeString(strip=True, min=6,
581 581 not_empty=False))
582 582
583 583 active = StringBoolean(if_missing=False)
584 584 name = UnicodeString(strip=True, min=1, not_empty=False)
585 585 lastname = UnicodeString(strip=True, min=1, not_empty=False)
586 586 email = All(Email(not_empty=True), UniqSystemEmail(old_data))
587 587
588 588 chained_validators = [ValidPasswordsMatch, ValidPassword]
589 589
590 590 return _UserForm
591 591
592 592
593 593 def UsersGroupForm(edit=False, old_data={}, available_members=[]):
594 594 class _UsersGroupForm(formencode.Schema):
595 595 allow_extra_fields = True
596 596 filter_extra_fields = True
597 597
598 598 users_group_name = All(UnicodeString(strip=True, min=1, not_empty=True),
599 599 ValidUsersGroup(edit, old_data))
600 600
601 601 users_group_active = StringBoolean(if_missing=False)
602 602
603 603 if edit:
604 604 users_group_members = OneOf(available_members, hideList=False,
605 605 testValueList=True,
606 606 if_missing=None, not_empty=False)
607 607
608 608 return _UsersGroupForm
609 609
610 610
611 611 def ReposGroupForm(edit=False, old_data={}, available_groups=[]):
612 612 class _ReposGroupForm(formencode.Schema):
613 613 allow_extra_fields = True
614 614 filter_extra_fields = False
615 615
616 616 group_name = All(UnicodeString(strip=True, min=1, not_empty=True),
617 617 SlugifyName())
618 618 group_description = UnicodeString(strip=True, min=1,
619 619 not_empty=True)
620 620 group_parent_id = OneOf(available_groups, hideList=False,
621 621 testValueList=True,
622 622 if_missing=None, not_empty=False)
623 623
624 624 chained_validators = [ValidReposGroup(edit, old_data), ValidPerms('group')]
625 625
626 626 return _ReposGroupForm
627 627
628 628
629 629 def RegisterForm(edit=False, old_data={}):
630 630 class _RegisterForm(formencode.Schema):
631 631 allow_extra_fields = True
632 632 filter_extra_fields = True
633 633 username = All(ValidUsername(edit, old_data),
634 634 UnicodeString(strip=True, min=1, not_empty=True))
635 635 password = All(UnicodeString(strip=True, min=6, not_empty=True))
636 636 password_confirmation = All(UnicodeString(strip=True, min=6, not_empty=True))
637 637 active = StringBoolean(if_missing=False)
638 638 name = UnicodeString(strip=True, min=1, not_empty=False)
639 639 lastname = UnicodeString(strip=True, min=1, not_empty=False)
640 640 email = All(Email(not_empty=True), UniqSystemEmail(old_data))
641 641
642 642 chained_validators = [ValidPasswordsMatch, ValidPassword]
643 643
644 644 return _RegisterForm
645 645
646 646
647 647 def PasswordResetForm():
648 648 class _PasswordResetForm(formencode.Schema):
649 649 allow_extra_fields = True
650 650 filter_extra_fields = True
651 651 email = All(ValidSystemEmail(), Email(not_empty=True))
652 652 return _PasswordResetForm
653 653
654 654
655 655 def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
656 656 repo_groups=[]):
657 657 class _RepoForm(formencode.Schema):
658 658 allow_extra_fields = True
659 659 filter_extra_fields = False
660 660 repo_name = All(UnicodeString(strip=True, min=1, not_empty=True),
661 661 SlugifyName())
662 662 clone_uri = All(UnicodeString(strip=True, min=1, not_empty=False))
663 663 repo_group = OneOf(repo_groups, hideList=True)
664 664 repo_type = OneOf(supported_backends)
665 665 description = UnicodeString(strip=True, min=1, not_empty=True)
666 666 private = StringBoolean(if_missing=False)
667 667 enable_statistics = StringBoolean(if_missing=False)
668 668 enable_downloads = StringBoolean(if_missing=False)
669 669
670 670 if edit:
671 671 #this is repo owner
672 672 user = All(UnicodeString(not_empty=True), ValidRepoUser)
673 673
674 674 chained_validators = [ValidCloneUri()(),
675 675 ValidRepoName(edit, old_data),
676 676 ValidPerms()]
677 677 return _RepoForm
678 678
679 679
680 680 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
681 681 repo_groups=[]):
682 682 class _RepoForkForm(formencode.Schema):
683 683 allow_extra_fields = True
684 684 filter_extra_fields = False
685 685 repo_name = All(UnicodeString(strip=True, min=1, not_empty=True),
686 686 SlugifyName())
687 687 repo_group = OneOf(repo_groups, hideList=True)
688 688 repo_type = All(ValidForkType(old_data), OneOf(supported_backends))
689 689 description = UnicodeString(strip=True, min=1, not_empty=True)
690 690 private = StringBoolean(if_missing=False)
691 691 copy_permissions = StringBoolean(if_missing=False)
692 692 update_after_clone = StringBoolean(if_missing=False)
693 693 fork_parent_id = UnicodeString()
694 694 chained_validators = [ValidForkName(edit, old_data)]
695 695
696 696 return _RepoForkForm
697 697
698 698
699 699 def RepoSettingsForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
700 700 repo_groups=[]):
701 701 class _RepoForm(formencode.Schema):
702 702 allow_extra_fields = True
703 703 filter_extra_fields = False
704 704 repo_name = All(UnicodeString(strip=True, min=1, not_empty=True),
705 705 SlugifyName())
706 706 description = UnicodeString(strip=True, min=1, not_empty=True)
707 707 repo_group = OneOf(repo_groups, hideList=True)
708 708 private = StringBoolean(if_missing=False)
709 709
710 710 chained_validators = [ValidRepoName(edit, old_data), ValidPerms(),
711 711 ValidSettings]
712 712 return _RepoForm
713 713
714 714
715 715 def ApplicationSettingsForm():
716 716 class _ApplicationSettingsForm(formencode.Schema):
717 717 allow_extra_fields = True
718 718 filter_extra_fields = False
719 719 rhodecode_title = UnicodeString(strip=True, min=1, not_empty=True)
720 720 rhodecode_realm = UnicodeString(strip=True, min=1, not_empty=True)
721 721 rhodecode_ga_code = UnicodeString(strip=True, min=1, not_empty=False)
722 722
723 723 return _ApplicationSettingsForm
724 724
725 725
726 726 def ApplicationUiSettingsForm():
727 727 class _ApplicationUiSettingsForm(formencode.Schema):
728 728 allow_extra_fields = True
729 729 filter_extra_fields = False
730 730 web_push_ssl = OneOf(['true', 'false'], if_missing='false')
731 731 paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=1, not_empty=True))
732 732 hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False)
733 733 hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False)
734 734 hooks_pretxnchangegroup_push_logger = OneOf(['True', 'False'], if_missing=False)
735 735 hooks_preoutgoing_pull_logger = OneOf(['True', 'False'], if_missing=False)
736 736
737 737 return _ApplicationUiSettingsForm
738 738
739 739
740 740 def DefaultPermissionsForm(perms_choices, register_choices, create_choices):
741 741 class _DefaultPermissionsForm(formencode.Schema):
742 742 allow_extra_fields = True
743 743 filter_extra_fields = True
744 744 overwrite_default = StringBoolean(if_missing=False)
745 745 anonymous = OneOf(['True', 'False'], if_missing=False)
746 746 default_perm = OneOf(perms_choices)
747 747 default_register = OneOf(register_choices)
748 748 default_create = OneOf(create_choices)
749 749
750 750 return _DefaultPermissionsForm
751 751
752 752
753 753 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices, tls_kind_choices):
754 754 class _LdapSettingsForm(formencode.Schema):
755 755 allow_extra_fields = True
756 756 filter_extra_fields = True
757 757 pre_validators = [LdapLibValidator]
758 758 ldap_active = StringBoolean(if_missing=False)
759 759 ldap_host = UnicodeString(strip=True,)
760 760 ldap_port = Number(strip=True,)
761 761 ldap_tls_kind = OneOf(tls_kind_choices)
762 762 ldap_tls_reqcert = OneOf(tls_reqcert_choices)
763 763 ldap_dn_user = UnicodeString(strip=True,)
764 764 ldap_dn_pass = UnicodeString(strip=True,)
765 765 ldap_base_dn = UnicodeString(strip=True,)
766 766 ldap_filter = UnicodeString(strip=True,)
767 767 ldap_search_scope = OneOf(search_scope_choices)
768 768 ldap_attr_login = All(AttrLoginValidator, UnicodeString(strip=True,))
769 769 ldap_attr_firstname = UnicodeString(strip=True,)
770 770 ldap_attr_lastname = UnicodeString(strip=True,)
771 771 ldap_attr_email = UnicodeString(strip=True,)
772 772
773 773 return _LdapSettingsForm
General Comments 0
You need to be logged in to leave comments. Login now