Changeset 12189
- Timestamp:
- 10 Dec 2014, 11:12:42 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/authentication.py
r11949 r12189 40 40 IBatchProcessor, IGNORE_MARKER, IFailedLoginInfo) 41 41 from waeup.ikoba.utils.batching import BatchProcessor 42 from waeup.ikoba.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.ikoba/trunk/src/waeup/ikoba/browser/batchprocessing.txt
r11954 r12189 147 147 ... isouaba,Issoufou Abba Moussa,Chief Developer,isouaba@abc.de,+49-234-567,[] 148 148 ... henrik,Henrik Bettermann,Admin,henrik@abc.de,+49-234-567,"['waeup.PortalManager', 'waeup.ImportManager']" 149 ... anne,Anne Palina,,anne@abc.de,+49-234-567,"['waeup.Nonsense']" 149 150 ... """) 150 151 … … 188 189 >>> browser.getControl('Perform import').click() 189 190 190 One linecould not be imported:191 Two lines could not be imported: 191 192 192 193 >>> print browser.contents 193 194 <!DOCTYPE html PUBLIC... 194 195 ... 195 ...Processing of 1rows failed...196 ...Processing of 2 rows failed... 196 197 ...Successfully processed 1 rows... 197 198 ... … … 204 205 name,roles,title,public_name,phone,email,--ERRORS-- 205 206 henrik,"['waeup.PortalManager', 'waeup.ImportManager']",Henrik Bettermann,Admin,+49-234-567,henrik@abc.de,This object already exists. Skipping. 207 anne,['waeup.Nonsense'],Anne Palina,,+49-234-567,anne@abc.de,roles: invalid role 206 208 207 209 >>> finished_file = dc_path + '/finished/newusers_zope.mgr.create.finished.csv' … … 218 220 ----------------------- 219 221 220 We 'edit' the pending file (setting code to ``FAC5`` and title 221 appropriately, and removing the --ERROR-- column) and finish the 222 import this way: 222 We 'edit' the pending file by removing anne and replacing henrik by gbenga 223 and finish the import this way: 223 224 224 225 >>> open(dc_path + '/newusers_zope.mgr.create.pending.csv', 'wb').write(
Note: See TracChangeset for help on using the changeset viewer.