org.entityfs.util.security
Class AccessGranterAccessController
java.lang.Object
org.entityfs.AbstractAccessController
org.entityfs.util.security.AccessGranterAccessController
- All Implemented Interfaces:
- AccessController
public class AccessGranterAccessController
- extends AbstractAccessController
A AccessController
that uses an AccessGranter
to check
access. If it is created with a null
AccessGranter
, it is
considered to be disabled.
The subject of the current thread is stored as an
InheritableThreadLocal
.
- Since:
- 1.0
- Author:
- Karl Gustafsson
Method Summary |
boolean |
hasPermission(Permission p)
Does the current Subject have the permission? It is up to the
access controller implementation to know how to find the current subject. |
boolean |
isEnabled()
Check if the AccessController is enabled. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AccessGranterAccessController
public AccessGranterAccessController(AccessGranter ag)
hasPermission
public boolean hasPermission(Permission p)
- Description copied from interface:
AccessController
- Does the current
Subject
have the permission? It is up to the
access controller implementation to know how to find the current subject.
Most implementations will use some kind of ThreadLocal
to store
the subject.
The AccessController.checkPermission(Permission)
method performs the same checks
as this method, but throws an AccessDeniedException
if the
subject does not have the requested permission.
- Parameters:
p
- The permission. When EntityFS methods are calling this method,
this is always an EntityPermission
.
- Returns:
true
if the subject has the permission, false
if
not.- See Also:
AccessController.checkPermission(Permission)
isEnabled
public boolean isEnabled()
- Description copied from interface:
AccessController
- Check if the
AccessController
is enabled. A disabled access
controller grants all access requests.
- Returns:
true
if this access controller is enabled.