public class AuthorizationUtil extends Object
Provides some comon authorization methods.
| Constructor and Description |
|---|
AuthorizationUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasLevel(Identity identity,
Level level)
Checks if an user has given security level.
|
static boolean |
hasPartition(Identity identity,
Class<?> partitionType,
String... partitionNames)
Checks if an authenticated user is associated with a partition with the given type and name.
|
static boolean |
hasPermission(Identity identity,
Object resource,
Class<?> resourceClass,
Serializable resourceIdentifier,
String operation)
Checks if the user has permissions to a resource considering an operation.
|
static boolean |
hasRole(Identity identity,
PartitionManager partitionManager,
String roleName)
Checks if an authenticated user is granted with a role with the given name.
|
static boolean |
isLoggedIn(Identity identity)
Checks if the user is logged in.
|
static boolean |
isMember(Identity identity,
PartitionManager partitionManager,
String groupName)
Checks if an authenticated user is member of the a group with the given name.
|
public static boolean isLoggedIn(Identity identity)
Checks if the user is logged in.
identity - The Identity instance representing an authenticated user.public static boolean hasPermission(Identity identity, Object resource, Class<?> resourceClass, Serializable resourceIdentifier, String operation)
Checks if the user has permissions to a resource considering an operation.
identity - The Identity instance representing an authenticated user.resource - The resource.resourceClass - The resource class if specified.resourceIdentifier - The resource identifier, if specified.operation - The operation.public static boolean hasRole(Identity identity, PartitionManager partitionManager, String roleName)
Checks if an authenticated user is granted with a role with the given name.
identity - The Identity instance representing an authenticated user.partitionManager - roleName - The role name.public static boolean isMember(Identity identity, PartitionManager partitionManager, String groupName)
Checks if an authenticated user is member of the a group with the given name.
identity - The Identity instance representing an authenticated user.partitionManager - groupName - The group name.public static boolean hasPartition(Identity identity, Class<?> partitionType, String... partitionNames)
Checks if an authenticated user is associated with a partition with the given type and name.
identity - The Identity instance representing an authenticated user.partitionType - The required type of the partition. If null, all partition types should be considered.partitionNames - The name of the partitions that should be associated with an authenticated user.Copyright © 2015. All rights reserved.