Ignore:
Timestamp:
27 May 2011, 02:05:02 (13 years ago)
Author:
uli
Message:

#38

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/authentication.py

    r6182 r6203  
    174174        site = grok.getSite()
    175175        return site['users']
     176
     177@grok.subscribe(IUserAccount, grok.IObjectRemovedEvent)
     178def handle_account_removal(account, event):
     179    """When an account is removed, local roles might have to be deleted.
     180    """
     181    local_roles = account.getLocalRoles()
     182    principal = account.name
     183    for role_id, object_list in local_roles.items():
     184        for object in object_list:
     185            try:
     186                role_manager = IPrincipalRoleManager(object)
     187            except TypeError:
     188                # No role manager, no roles to remove
     189                continue
     190            role_manager.unsetRoleForPrincipal(role_id, principal)
     191    return
Note: See TracChangeset for help on using the changeset viewer.