Utilizing access control directly in host application logic is almost as easy as using a filter, once you've understood the supported methods it is as simple as checking a boolean result. Supported access control methodshasRoleboolean hasRole(String roleIdentifier) - Returns true if this Subject has the specified role, false otherwise.
- Parameters:
roleIdentifier - the application-specific role identifier (usually a role id or role name).- Returns:
- true if this Subject has the specified role, false otherwise.
)hasRolesboolean[] hasRoles(List<String> roleIdentifiers) - Checks if this Subject has the specified roles, returning a boolean array indicating which roles are associated.
This is primarily a performance-enhancing method to help reduce the number of hasRole(java.lang.String) invocations over the wire in client/server systems. - Parameters:
roleIdentifiers - the application-specific role identifiers to check (usually role ids or role names).- Returns:
- an array of booleans whose indices correspond to the index of the roles in the given identifiers. A true value indicates this Subject has the role at that index. False indicates this Subject does not have the role at that index.
isPermittedboolean isPermitted(String permission) - Returns true if this Subject is permitted to perform an action or access a resource summarized by the specified permission string.
This is an overloaded method for the corresponding type-safe Permission variant. Please see the class-level JavaDoc for more information on these String-based permission methods. - Parameters:
permission - the String representation of a Permission that is being checked.- Returns:
- true if this Subject is permitted, false otherwise.
- Since:
- 0.9
- See Also:
isPermitted(Permission permission)
|