Changeset 12190
- Timestamp:
- 10 Dec 2014, 11:43:50 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r11891 r12190 4 4 1.3dev (unreleased) 5 5 =================== 6 7 * UserProcessor: Check if imported roles do exist in the portal. 6 8 7 9 * Enable localization of batch processing modules. -
main/waeup.kofa/trunk/src/waeup/kofa/authentication.py
r10055 r12190 40 40 IBatchProcessor, IGNORE_MARKER, IFailedLoginInfo) 41 41 from waeup.kofa.utils.batching import BatchProcessor 42 from waeup.kofa.permissions import get_all_roles 42 43 43 44 def setup_authentication(pau): … … 513 514 return 514 515 516 def checkConversion(self, row, mode='ignore'): 517 """Validates all values in row. 518 """ 519 errs, inv_errs, conv_dict = super( 520 UserProcessor, self).checkConversion(row, mode=mode) 521 # We need to check if roles exist. 522 roles = row.get('roles', None) 523 all_roles = [i[0] for i in get_all_roles()] 524 if roles not in ('', IGNORE_MARKER): 525 evalvalue = eval(roles) 526 for role in evalvalue: 527 if role not in all_roles: 528 errs.append(('roles','invalid role')) 529 return errs, inv_errs, conv_dict 530 515 531 class UsersPlugin(grok.GlobalUtility): 516 532 """A plugin that updates users. -
main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt
r11699 r12190 430 430 ... uli,Uli Fouquet,Chief Developer,uli@abc.de,+49-234-567,[] 431 431 ... henrik,Henrik Bettermann,Admin,henrik@abc.de,+49-234-567,"['waeup.PortalManager', 'waeup.ImportManager']" 432 ... anne,Anne Palina,,anne@abc.de,+49-234-567,"['waeup.Nonsense']" 432 433 ... """) 433 434 … … 619 620 ... 620 621 622 Oh no, we forgot Anne Palina. Her user record was not imported because 623 she has a non-existent role: 624 621 625 >>> sorted(os.listdir(dc_path)) 622 ['deleted', 'finished', 'logs', 'unfinished' ]626 ['deleted', 'finished', 'logs', 'unfinished', 'users_zope.mgr.create.pending.csv'] 623 627 624 628 >>> os.listdir(dc_path + '/unfinished') 625 [] 629 ['users_zope.mgr.csv'] 630 631 >>> pending_file = dc_path + '/users_zope.mgr.create.pending.csv' 632 >>> print open(pending_file).read() 633 name,roles,title,public_name,phone,email,--ERRORS-- 634 anne,['waeup.Nonsense'],Anne Palina,,+49-234-567,anne@abc.de,roles: invalid role 635 636 There are many finished-files: 626 637 627 638 >>> sorted(os.listdir(dc_path + '/finished')) 628 639 ['certificates_zope.mgr.create.finished.csv', ..., 629 'users_zope.mgr.create.finished.csv' , 'users_zope.mgr.csv']640 'users_zope.mgr.create.finished.csv'] 630 641 631 642 Processed (finished) Files
Note: See TracChangeset for help on using the changeset viewer.