public void cleanRemovedRole( String roleId ) { configCleaner.roleRemoved( getConfiguration(), roleId ); } }
public List<CRole> listRoles() { return Collections.unmodifiableList( getConfiguration().getRoles() ); }
public List<CUser> listUsers() { return Collections.unmodifiableList( getConfiguration().getUsers() ); }
public void cleanRemovedPrivilege( String privilegeId ) { configCleaner.privilegeRemoved( getConfiguration(), privilegeId ); }
public List<CPrivilege> listPrivileges() { return Collections.unmodifiableList( getConfiguration().getPrivileges() ); }
public List<CUserRoleMapping> listUserRoleMappings() { return Collections.unmodifiableList( getConfiguration().getUserRoleMappings() ); }
public void deleteUserRoleMapping( String userId, String source ) throws NoSuchRoleMappingException { boolean found = getConfiguration().removeUserRoleMappingByUserId( userId, source ); if ( !found ) { throw new NoSuchRoleMappingException( "No User Role Mapping for user: " + userId ); } }
public CPrivilege readPrivilege( String id ) throws NoSuchPrivilegeException { CPrivilege privilege = getConfiguration().getPrivilegeById( id ); if ( privilege != null ) { return privilege; } else { throw new NoSuchPrivilegeException( id ); } }
public CUser readUser( String id ) throws UserNotFoundException { CUser user = getConfiguration().getUserById( id ); if ( user != null ) { return user; } else { throw new UserNotFoundException( id ); } }
private CUserRoleMapping readCUserRoleMapping( String userId, String source ) throws NoSuchRoleMappingException { CUserRoleMapping mapping = getConfiguration().getUserRoleMappingByUserId( userId, source ); if ( mapping != null ) { return mapping; } else { throw new NoSuchRoleMappingException( "No User Role Mapping for user: " + userId ); } }
public CRole readRole( String id ) throws NoSuchRoleException { CRole role = getConfiguration().getRoleById( id ); if ( role != null ) { return role; } else { throw new NoSuchRoleException( id ); } }
public void deletePrivilege( String id, boolean clean ) throws NoSuchPrivilegeException { boolean found = getConfiguration().removePrivilegeById( id ); if ( !found ) { throw new NoSuchPrivilegeException( id ); } if ( clean ) { cleanRemovedPrivilege( id ); } }
protected void deleteRole( String id, boolean clean ) throws NoSuchRoleException { boolean found = getConfiguration().removeRoleById( id ); if ( !found ) { throw new NoSuchRoleException( id ); } if ( clean ) { cleanRemovedRole( id ); } }
public void deleteUser( String id ) throws UserNotFoundException { boolean found = getConfiguration().removeUserById( id ); if ( !found ) { throw new UserNotFoundException( id ); } // delete the user role mapping for this user too try { deleteUserRoleMapping( id, SecurityXmlUserManager.SOURCE ); } catch ( NoSuchRoleMappingException e ) { this.getLogger().debug( "User role mapping for user: " + id + " source: " + SecurityXmlUserManager.SOURCE + " could not be deleted because it does not exist." ); } }
private void createOrUpdateUserRoleMapping( CUserRoleMapping roleMapping ) { // delete first, ask questions later // we are always updating, its possible that this object could have already existed, because we cannot fully // sync with external realms. try { deleteUserRoleMapping( roleMapping.getUserId(), roleMapping.getSource() ); } catch ( NoSuchRoleMappingException e ) { // it didn't exist, thats ok. } // now add it getConfiguration().addUserRoleMapping( roleMapping ); }
public void createPrivilege( CPrivilege privilege, SecurityValidationContext context ) throws InvalidConfigurationException { if ( context == null ) { context = initializeContext(); } ValidationResponse vr = validator.validatePrivilege( context, privilege, false ); if ( vr.isValid() ) { getConfiguration().addPrivilege( privilege ); logValidationWarnings( vr ); } else { throw new InvalidConfigurationException( vr ); } }
public void createRole( CRole role, SecurityValidationContext context ) throws InvalidConfigurationException { if ( context == null ) { context = initializeContext(); } ValidationResponse vr = validator.validateRole( context, role, false ); if ( vr.isValid() ) { getConfiguration().addRole( role ); logValidationWarnings( vr ); } else { throw new InvalidConfigurationException( vr ); } }
public void updatePrivilege( CPrivilege privilege, SecurityValidationContext context ) throws InvalidConfigurationException, NoSuchPrivilegeException { if ( context == null ) { context = initializeContext(); } ValidationResponse vr = validator.validatePrivilege( context, privilege, true ); if ( vr.isValid() ) { deletePrivilege( privilege.getId(), false ); getConfiguration().addPrivilege( privilege ); logValidationWarnings( vr ); } else { throw new InvalidConfigurationException( vr ); } }
public void updateRole( CRole role, SecurityValidationContext context ) throws InvalidConfigurationException, NoSuchRoleException { if ( context == null ) { context = initializeContext(); } ValidationResponse vr = validator.validateRole( context, role, true ); if ( vr.isValid() ) { deleteRole( role.getId(), false ); getConfiguration().addRole( role ); logValidationWarnings( vr ); } else { throw new InvalidConfigurationException( vr ); } }
public void updateUser( CUser user, Set<String> roles, SecurityValidationContext context ) throws InvalidConfigurationException, UserNotFoundException { if ( context == null ) { context = initializeContext(); } ValidationResponse vr = validator.validateUser( context, user, roles, true ); if ( vr.isValid() ) { deleteUser( user.getId() ); getConfiguration().addUser( user ); this.createOrUpdateUserRoleMapping( this.buildUserRoleMapping( user.getId(), roles ) ); logValidationWarnings( vr ); } else { throw new InvalidConfigurationException( vr ); } }