public static void assertValid( Operation operation ) throws RbacObjectInvalidException { assertValid( null, operation ); }
public static void assertValid( Resource resource ) throws RbacObjectInvalidException { assertValid( null, resource ); }
public static void assertValid( UserAssignment assignment ) throws RbacObjectInvalidException { assertValid( null, assignment ); }
public static void assertValid( Role role ) throws RbacObjectInvalidException { assertValid( null, role ); }
public static void assertValid( Permission permission ) throws RbacObjectInvalidException { assertValid( null, permission ); }
public Resource saveResource( Resource resource ) throws RbacManagerException { triggerInit(); RBACObjectAssertions.assertValid( "Save Resource", resource ); resources.put( resource.getIdentifier(), resource ); return resource; }
public Operation saveOperation( Operation operation ) throws RbacManagerException { triggerInit(); RBACObjectAssertions.assertValid( "Save Operation", operation ); operations.put( operation.getName(), operation ); return operation; }
public UserAssignment saveUserAssignment( UserAssignment userAssignment ) throws RbacManagerException { triggerInit(); RBACObjectAssertions.assertValid( "Save UserAssignment", userAssignment ); fireRbacUserAssignmentSaved( userAssignment ); userAssignments.put( userAssignment.getPrincipal(), userAssignment ); return userAssignment; }
public static void assertValid( String scope, Permission permission ) throws RbacObjectInvalidException { if ( permission == null ) { throw new RbacObjectInvalidException( scope, "Null Permission object is invalid." ); } if ( StringUtils.isEmpty( permission.getName() ) ) { throw new RbacObjectInvalidException( scope, "Permission.name must not be empty." ); } assertValid( "Permission.operation", permission.getOperation() ); assertValid( "Permission.resource", permission.getResource() ); }
public void removeOperation( Operation operation ) throws RbacObjectNotFoundException, RbacManagerException { RBACObjectAssertions.assertValid( "Remove Operation", operation ); if ( operation.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent operation [" + operation.getName() + "]" ); } assertOpertionExists( operation.getName() ); operations.remove( operation.getName() ); }
public void removeResource( Resource resource ) throws RbacObjectNotFoundException, RbacManagerException { RBACObjectAssertions.assertValid( "Remove Resource", resource ); if ( resource.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent resource [" + resource.getIdentifier() + "]" ); } assertResourceExists( resource.getIdentifier() ); resources.remove( resource.getIdentifier() ); }
public void removePermission( Permission permission ) throws RbacObjectNotFoundException, RbacManagerException { RBACObjectAssertions.assertValid( "Remove Permission", permission ); if ( permission.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent permission [" + permission.getName() + "]" ); } assertPermissionExists( permission.getName() ); fireRbacPermissionRemoved( permission ); permissions.remove( permission.getName() ); }
public void removeRole( Role role ) throws RbacManagerException, RbacObjectNotFoundException { RBACObjectAssertions.assertValid( "Remove Role", role ); if ( role.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent role [" + role.getName() + "]" ); } assertRoleExists( role.getName() ); fireRbacRoleRemoved( role ); roles.remove( role.getName() ); }
public static void assertValid( String scope, Role role ) throws RbacObjectInvalidException { if ( role == null ) { throw new RbacObjectInvalidException( scope, "Null Role object is invalid." ); } if ( StringUtils.isEmpty( role.getName() ) ) { throw new RbacObjectInvalidException( scope, "Role.name must not be empty." ); } if ( role.getPermissions() != null ) { int i = 0; for ( Permission perm : role.getPermissions() ) { assertValid( "Role.permissions[" + i + "]", perm ); i++; } } }
public Permission savePermission( Permission permission ) throws RbacManagerException { triggerInit(); RBACObjectAssertions.assertValid( "Save Permission", permission ); permissions.put( permission.getName(), permission ); fireRbacPermissionSaved( permission ); saveOperation( permission.getOperation() ); saveResource( permission.getResource() ); return permission; }
public Role saveRole( Role role ) throws RbacManagerException { RBACObjectAssertions.assertValid( "Save Role", role ); triggerInit(); roles.put( role.getName(), role ); fireRbacRoleSaved( role ); if ( role.getPermissions() != null ) { for ( Permission p : role.getPermissions() ) { savePermission( p ); } } return role; }
public void removeUserAssignment( UserAssignment userAssignment ) throws RbacObjectNotFoundException, RbacManagerException { RBACObjectAssertions.assertValid( "Remove User Assignment", userAssignment ); if ( userAssignment.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent user assignment [" + userAssignment.getPrincipal() + "]" ); } fireRbacUserAssignmentRemoved( userAssignment ); assertUserAssignmentExists( userAssignment.getPrincipal() ); userAssignments.remove( userAssignment.getPrincipal() ); }
public void removeRole( Role role ) throws RbacManagerException { RBACObjectAssertions.assertValid( role ); if ( role.isPermanent() ) { throw new RbacPermanentException( "Unable to delete permanent role [" + role.getName() + "]" ); } rolesCache.remove( role.getName() ); if ( writableLdap ) { LdapConnection ldapConnection = null; DirContext context = null; try { ldapConnection = ldapConnectionFactory.getConnection(); context = ldapConnection.getDirContext(); ldapRoleMapper.removeRole( role.getName(), context ); } catch ( MappingException e ) { throw new RbacManagerException( e.getMessage(), e ); } catch ( LdapException e ) { throw new RbacManagerException( e.getMessage(), e ); } fireRbacRoleRemoved( role ); } }