public static void assertValid( String scope, Operation operation ) throws RbacObjectInvalidException { if ( operation == null ) { throw new RbacObjectInvalidException( scope, "Null Operation object is invalid." ); } if ( StringUtils.isEmpty( operation.getName() ) ) { throw new RbacObjectInvalidException( scope, "Operation.name must not be empty." ); } }
public static void assertValid( String scope, Resource resource ) throws RbacObjectInvalidException { if ( resource == null ) { throw new RbacObjectInvalidException( scope, "Null Resource object is invalid." ); } if ( StringUtils.isEmpty( resource.getIdentifier() ) ) { throw new RbacObjectInvalidException( scope, "Resource.identifier must not be empty." ); } }
throw new RbacObjectInvalidException( scope, "Null UserAssigment object is invalid." ); throw new RbacObjectInvalidException( scope, "UserAssigment.principal cannot be empty." ); throw new RbacObjectInvalidException( scope, "UserAssignment.roles cannot be null." ); throw new RbacObjectInvalidException( scope, "UserAssignment.rolename[" + i + "] cannot be empty." );
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 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++; } } }