Changeset 9313 for main


Ignore:
Timestamp:
8 Oct 2012, 09:16:59 (12 years ago)
Author:
Henrik Bettermann
Message:

Also site (global) roles must be unset when removin a user.

File:
1 edited

Legend:

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

    r9312 r9313  
    307307@grok.subscribe(IUserAccount, grok.IObjectRemovedEvent)
    308308def handle_account_removed(account, event):
    309     """When an account is removed, local roles might have to be deleted.
     309    """When an account is removed, local and global roles might
     310    have to be deleted.
    310311    """
    311312    local_roles = account.getLocalRoles()
    312313    principal = account.name
     314
    313315    for role_id, object_list in local_roles.items():
    314316        for object in object_list:
     
    316318                role_manager = IPrincipalRoleManager(object)
    317319            except TypeError:
    318                 # No role manager, no roles to remove
     320                # No Account object, no role manager, no local roles to remove
    319321                continue
    320322            role_manager.unsetRoleForPrincipal(role_id, principal)
     323    role_manager = IPrincipalRoleManager(grok.getSite())
     324    roles = account.getSiteRolesForPrincipal()
     325    for role_id in roles:
     326        role_manager.unsetRoleForPrincipal(role_id, principal)
    321327    return
    322328
     
    445451        # Log actions...
    446452        items_changed = ', '.join(changed)
    447         grok.getSite().logger.info('%s - %s - User updated: %s'
     453        grok.getSite().logger.info('%s - %s - updated: %s'
    448454            % (self.name, row['name'], items_changed))
    449455        return
Note: See TracChangeset for help on using the changeset viewer.