public class JpaAuthorizationService extends Object implements AuthorizationService
DefaultAuthorizationService which
refreshes the state of the service at certain time intervals.| Constructor and Description |
|---|
JpaAuthorizationService(String aName,
javax.persistence.EntityManager aEntityManager,
UserAccessor aAccessor,
UserAdministration aUserAdmin,
long aRefreshInterval)
Constructs the persistent 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.
|
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.
|
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.
|
public JpaAuthorizationService(String aName, javax.persistence.EntityManager aEntityManager, UserAccessor aAccessor, UserAdministration aUserAdmin, long aRefreshInterval)
aName - Name of the service.aEntityManager - Entity manager.aAccessor - User accessor.aUserAdmin - User administration.aRefresh - Whether or not to refresh the state of the service at the
start of every operation.public void setUserAccessor(UserAccessor aUserAccessor)
AuthorizationServicesetUserAccessor in interface AuthorizationServiceaUserAccessor - User accessor.public void setUserAdministration(UserAdministration aUserAdmin)
AuthorizationServicesetUserAdministration in interface AuthorizationServiceaUserAdmin - User administration.public boolean isAllowed(Object aResource, Operation aOperation)
AuthorizationServiceisAllowed in interface AuthorizationServiceaResource - Resource.aOperation - Operation.public <T> T check(T aResource,
Operation aOperation)
AuthorizationServicecheck in interface AuthorizationServiceT - Type of resourceaResource - Resource.aOperation - Operation.public AuthorizationRule[] getRules()
AuthorizationServicegetRules in interface AuthorizationServicepublic void appendRule(AuthorizationRule aRule)
AuthorizationServiceappendRule in interface AuthorizationServiceaRule - Rule to append.public void removeRule(int aIndex)
AuthorizationServiceremoveRule in interface AuthorizationServiceaIndex - Index of the rule to remove.public void insertRuleAfter(int aIndex,
AuthorizationRule aRule)
AuthorizationServiceinsertRuleAfter in interface AuthorizationServiceaIndex - Index of the position of the rule after insertion.aRule - Rule to insert.Copyright © 2025. All rights reserved.