@Entity public class DefaultAuthorizationService extends AbstractAuthorizationService
NAME_PARAM, QUERY_FIND_BY_NAME
Constructor and Description |
---|
DefaultAuthorizationService()
Constructs the authorization service.
|
DefaultAuthorizationService(UserAccessor aAccessor,
UserAdministration aUserAdmin,
String aName)
Constructs the service.
|
Modifier and Type | Method and Description |
---|---|
void |
appendRule(AuthorizationRule aRule)
Appends a new authorization rule to the end.
|
<T> T |
check(T aResource,
Operation aOperation)
Checks if the given operation is allowed on the resource.
|
protected List<AuthorizationRule> |
getMappedRules()
For OR mapping.
|
AuthorizationRule[] |
getRules()
Gets the authorization rules.
|
void |
insertRuleAfter(int aIndex,
AuthorizationRule aRule)
Inserts a rule.
|
boolean |
isAllowed(Object aResource,
Operation aOperation)
Checks whether an operation is allowed on a resource.
|
void |
removeRule(int aIndex)
Removes a rule.
|
protected void |
setMappedRules(List<AuthorizationRule> aRules)
For OR mapping.
|
void |
setUserAccessor(UserAccessor aUserAccessor)
Sets the user accessor so that the authorization service can get access
to the logged in user.
|
void |
setUserAdministration(UserAdministration aUserAdmin)
Sets the user administration so that the authorization service can check
information for the the current user.
|
getName
public DefaultAuthorizationService(UserAccessor aAccessor, UserAdministration aUserAdmin, String aName)
aAccessor
- User accessor.aUserAdmin
- User administration.aName
- Name of this instance of the service.public DefaultAuthorizationService()
public void setUserAccessor(UserAccessor aUserAccessor)
AuthorizationService
aUserAccessor
- User accessor.public void setUserAdministration(UserAdministration aUserAdmin)
AuthorizationService
aUserAdmin
- User administration.public boolean isAllowed(Object aResource, Operation aOperation)
AuthorizationService
aResource
- Resource.aOperation
- Operation.public <T> T check(T aResource, Operation aOperation)
AuthorizationService
T
- Type of resourceaResource
- Resource.aOperation
- Operation.public AuthorizationRule[] getRules()
AuthorizationService
public void appendRule(AuthorizationRule aRule)
AuthorizationService
aRule
- Rule to append.public void insertRuleAfter(int aIndex, AuthorizationRule aRule)
AuthorizationService
aIndex
- Index of the position of the rule after insertion.aRule
- Rule to insert.public void removeRule(int aIndex)
AuthorizationService
aIndex
- Index of the rule to remove.protected List<AuthorizationRule> getMappedRules()
protected void setMappedRules(List<AuthorizationRule> aRules)
aRules
- The rules.Copyright © 2022. All rights reserved.