class DBService implements RolesProvider {

    void removePrincipalFromAllRoles(ObjectStoreConnection con, String principalName,
            String adminUser, String auditRef) {
        
        // extract all the roles that this principal is member of
        // we have to this here so that there are records of
        // entries in the role member audit logs and the domain
        // entries are properly invalidated
        
        List<PrincipalRole> roles;
        try {
            roles = con.listPrincipalRoles(null, principalName);
        } catch (ResourceException ex) {
            
            // if there is no such principal then we have nothing to do
            
            if (ex.getCode() == ResourceException.NOT_FOUND) {
                return;
            } else {
                throw ex;
            }
        }

        for (PrincipalRole role : roles) {
            
            final String domainName = role.getDomainName();
            final String roleName = role.getRoleName();
            
            // process our delete role member operation
            
            if (LOG.isDebugEnabled()) {
                LOG.debug("removePrincipalFromAllRoles: removing member {} from {}:role.{}",
                        principalName, domainName, roleName);
            }

            // we are going to ignore all errors here rather than
            // rejecting the full operation. our delete user will
            // eventually remove all these principals
            
            try {
                con.deleteRoleMember(domainName, roleName, principalName, adminUser, auditRef);
            } catch (ResourceException ex) {
                LOG.error("removePrincipalFromAllRoles: unable to remove {} from {}:role.{} - error {}",
                        principalName, domainName, roleName, ex.getMessage());
            }

            // update our role and domain time-stamps, and invalidate local cache entry
            
            con.updateRoleModTimestamp(domainName, roleName);
            con.updateDomainModTimestamp(domainName);
        }
    }

    public  DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator);

}