Changeset 13226 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 24 Aug 2015, 19:53:21 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py
r13216 r13226 22 22 from hurry.query import Eq 23 23 from hurry.query.interfaces import IQuery 24 from zope.securitypolicy.interfaces import IPrincipalRoleManager 24 25 from zope.component import getUtility 25 26 from zope.component.interfaces import ComponentLookupError … … 74 75 leave it that way. If not create one and delete the old one if 75 76 appropriate. 77 78 Update applicants catalog. 79 80 Remove deprecated applicant ids from global role map. 76 81 """ 77 82 app_folder = site.get('applicants', None) … … 103 108 except ComponentLookupError: # in unit tests 104 109 pass 110 111 try: 112 removed_applicant_ids = [] 113 cat = getUtility(ICatalog, name='applicants_catalog') 114 role_manager = IPrincipalRoleManager(grok.getSite()) 115 principals = role_manager.getPrincipalsForRole('waeup.Applicant') 116 for principal in principals: 117 applicant_id = principal[0] 118 results = cat.searchResults(applicant_id=(applicant_id, applicant_id)) 119 if len(results): 120 continue 121 # The applicant does no longer exist. 122 nothing_to_do = False 123 role_manager.unsetRoleForPrincipal( 124 'waeup.Applicant', applicant_id) 125 removed_applicant_ids.append(applicant_id) 126 if len(removed_applicant_ids): 127 logger.info( 128 '%s: %s removed from global role map.' 129 % (self.log_prefix, removed_applicant_ids)) 130 except ComponentLookupError: # in unit tests 131 pass 132 105 133 if nothing_to_do: 106 134 logger.info(
Note: See TracChangeset for help on using the changeset viewer.