Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py	(revision 13225)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py	(revision 13226)
@@ -22,4 +22,5 @@
 from hurry.query import Eq
 from hurry.query.interfaces import IQuery
+from zope.securitypolicy.interfaces import IPrincipalRoleManager
 from zope.component import getUtility
 from zope.component.interfaces import ComponentLookupError
@@ -74,4 +75,8 @@
         leave it that way. If not create one and delete the old one if
         appropriate.
+
+        Update applicants catalog.
+
+        Remove deprecated applicant ids from global role map.
         """
         app_folder = site.get('applicants', None)
@@ -103,4 +108,27 @@
             except ComponentLookupError: # in unit tests
                 pass
+
+            try:
+                removed_applicant_ids = []
+                cat = getUtility(ICatalog, name='applicants_catalog')
+                role_manager = IPrincipalRoleManager(grok.getSite())
+                principals = role_manager.getPrincipalsForRole('waeup.Applicant')
+                for principal in principals:
+                    applicant_id = principal[0]
+                    results = cat.searchResults(applicant_id=(applicant_id, applicant_id))
+                    if len(results):
+                        continue
+                    # The applicant does no longer exist.
+                    nothing_to_do = False
+                    role_manager.unsetRoleForPrincipal(
+                        'waeup.Applicant', applicant_id)
+                    removed_applicant_ids.append(applicant_id)
+                if len(removed_applicant_ids):
+                    logger.info(
+                        '%s: %s removed from global role map.'
+                        % (self.log_prefix, removed_applicant_ids))
+            except ComponentLookupError: # in unit tests
+                pass
+
             if nothing_to_do:
                 logger.info(
