Class AbstractCompiledPermissions
- java.lang.Object
-
- org.apache.jackrabbit.core.security.authorization.AbstractCompiledPermissions
-
- All Implemented Interfaces:
CompiledPermissions
public abstract class AbstractCompiledPermissions extends Object implements CompiledPermissions
AbstractCompiledPermissions
...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractCompiledPermissions.Result
Result of permission (and optionally privilege) evaluation for a given path.
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.core.security.authorization.CompiledPermissions
NO_PERMISSION
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCompiledPermissions()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract AbstractCompiledPermissions.Result
buildRepositoryResult()
Retrieve the result for repository level operations.protected abstract AbstractCompiledPermissions.Result
buildResult(Path absPath)
Retrieve the result for the specified path.boolean
canReadAll()
Returnstrue
if READ permission is granted everywhere.protected void
clearCache()
Removes all entries from the cache.void
close()
Indicate to thisCompiledPermissions
object that it is not used any more.protected abstract PrivilegeManagerImpl
getPrivilegeManagerImpl()
Retrieve the privilege manager.int
getPrivileges(Path absPath)
Returns thePrivilege
bits granted by the underlying policy if the givenabsPath
.Set<Privilege>
getPrivilegeSet(Path absPath)
Returns thePrivilege
s granted by the underlying policy at the givenabsPath
.AbstractCompiledPermissions.Result
getResult(Path absPath)
boolean
grants(Path absPath, int permissions)
Returnstrue
if the specified permissions are granted on the item identified by the givenpath
.boolean
hasPrivileges(Path absPath, Privilege... privileges)
Returnstrue
if the given privileges are granted at the specifiedabsPath
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.core.security.authorization.CompiledPermissions
canRead
-
-
-
-
Method Detail
-
getResult
public AbstractCompiledPermissions.Result getResult(Path absPath) throws RepositoryException
- Parameters:
absPath
- Absolute path to return the result for.- Returns:
- the
Result
for the giveabsPath
. - Throws:
RepositoryException
- if an error occurs.
-
buildResult
protected abstract AbstractCompiledPermissions.Result buildResult(Path absPath) throws RepositoryException
Retrieve the result for the specified path.- Parameters:
absPath
- Absolute path to build the result for.- Returns:
- Result for the specified
absPath
. - Throws:
RepositoryException
- If an error occurs.
-
buildRepositoryResult
protected abstract AbstractCompiledPermissions.Result buildRepositoryResult() throws RepositoryException
Retrieve the result for repository level operations.- Returns:
- The result instance for those permissions and privileges granted for repository level operations.
- Throws:
RepositoryException
-
getPrivilegeManagerImpl
protected abstract PrivilegeManagerImpl getPrivilegeManagerImpl() throws RepositoryException
Retrieve the privilege manager.- Returns:
- An instance of privilege manager.
- Throws:
RepositoryException
- If an error occurs.
-
clearCache
protected void clearCache()
Removes all entries from the cache.
-
close
public void close()
Description copied from interface:CompiledPermissions
Indicate to thisCompiledPermissions
object that it is not used any more.- Specified by:
close
in interfaceCompiledPermissions
- See Also:
CompiledPermissions.close()
-
grants
public boolean grants(Path absPath, int permissions) throws RepositoryException
Description copied from interface:CompiledPermissions
Returnstrue
if the specified permissions are granted on the item identified by the givenpath
.- Specified by:
grants
in interfaceCompiledPermissions
- Parameters:
absPath
- Absolute path pointing to an item. If the item does not exist yet (asking for 'add-node' and 'set-property' permission), it's direct ancestor must exist.permissions
- A combination of one or more of permission constants defined byPermission
encoded as a bitmask value- Returns:
true
if the specified permissions are granted,false
otherwise.- Throws:
RepositoryException
- if an error occurs.- See Also:
CompiledPermissions.grants(Path, int)
-
getPrivileges
public int getPrivileges(Path absPath) throws RepositoryException
Description copied from interface:CompiledPermissions
Returns thePrivilege
bits granted by the underlying policy if the givenabsPath
.- Specified by:
getPrivileges
in interfaceCompiledPermissions
- Parameters:
absPath
- Absolute path to aNode
.- Returns:
- the granted privileges at
absPath
. - Throws:
RepositoryException
- if an error occurs- See Also:
CompiledPermissions.getPrivileges(Path)
-
hasPrivileges
public boolean hasPrivileges(Path absPath, Privilege... privileges) throws RepositoryException
Description copied from interface:CompiledPermissions
Returnstrue
if the given privileges are granted at the specifiedabsPath
.- Specified by:
hasPrivileges
in interfaceCompiledPermissions
- Returns:
true
if the given privileges are granted at the specifiedabsPath
.- Throws:
RepositoryException
- See Also:
CompiledPermissions.hasPrivileges(org.apache.jackrabbit.spi.Path, javax.jcr.security.Privilege[])
-
getPrivilegeSet
public Set<Privilege> getPrivilegeSet(Path absPath) throws RepositoryException
Description copied from interface:CompiledPermissions
Returns thePrivilege
s granted by the underlying policy at the givenabsPath
.- Specified by:
getPrivilegeSet
in interfaceCompiledPermissions
- Parameters:
absPath
- Absolute path to aNode
.- Returns:
- the granted privileges at
absPath
. - Throws:
RepositoryException
- if an error occurs- See Also:
CompiledPermissions.getPrivilegeSet(Path)
-
canReadAll
public boolean canReadAll() throws RepositoryException
Description copied from interface:CompiledPermissions
Returnstrue
if READ permission is granted everywhere. This method acts as shortcut forCompiledPermissions.grants(Path, int)
where permissions isPermission.READ
and allows to shorten the evaluation time given the fact that a check for READ permission is considered to be the most frequent test.- Specified by:
canReadAll
in interfaceCompiledPermissions
- Returns:
true
if the READ permission is granted everywhere.- Throws:
RepositoryException
- if an error occurs- See Also:
CompiledPermissions.canReadAll()
-
-