Interface CompiledPermissions
-
- All Known Implementing Classes:
AbstractCompiledPermissions
public interface CompiledPermissionsCompiledPermissionsrepresents the evaluation of anAccessControlPolicythat applies for a given set ofPrincipals (normally obtained from the Subject of a Session).
-
-
Field Summary
Fields Modifier and Type Field Description static CompiledPermissionsNO_PERMISSIONStatic implementation of aCompiledPermissionsthat doesn't grant any permissions at all.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancanRead(Path itemPath, ItemId itemId)Returnstrueif READ permission is granted for the existing item with the givenPathand/orItemId.booleancanReadAll()Returnstrueif READ permission is granted everywhere.voidclose()Indicate to thisCompiledPermissionsobject that it is not used any more.intgetPrivileges(Path absPath)Deprecated.UsegetPrivilegeSet(Path)instead.Set<Privilege>getPrivilegeSet(Path absPath)Returns thePrivileges granted by the underlying policy at the givenabsPath.booleangrants(Path absPath, int permissions)Returnstrueif the specified permissions are granted on the item identified by the givenpath.booleanhasPrivileges(Path absPath, Privilege... privileges)Returnstrueif the given privileges are granted at the specifiedabsPath.
-
-
-
Field Detail
-
NO_PERMISSION
static final CompiledPermissions NO_PERMISSION
Static implementation of aCompiledPermissionsthat doesn't grant any permissions at all.
-
-
Method Detail
-
close
void close()
Indicate to thisCompiledPermissionsobject that it is not used any more.
-
grants
boolean grants(Path absPath, int permissions) throws RepositoryException
Returnstrueif the specified permissions are granted on the item identified by the givenpath.- 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 byPermissionencoded as a bitmask value- Returns:
trueif the specified permissions are granted,falseotherwise.- Throws:
RepositoryException- if an error occurs.
-
getPrivileges
@Deprecated int getPrivileges(Path absPath) throws RepositoryException
Deprecated.UsegetPrivilegeSet(Path)instead.Returns thePrivilegebits granted by the underlying policy if the givenabsPath.- Parameters:
absPath- Absolute path to aNode.- Returns:
- the granted privileges at
absPath. - Throws:
RepositoryException- if an error occurs
-
hasPrivileges
boolean hasPrivileges(Path absPath, Privilege... privileges) throws RepositoryException
Returnstrueif the given privileges are granted at the specifiedabsPath.- Parameters:
absPath-privileges-- Returns:
trueif the given privileges are granted at the specifiedabsPath.- Throws:
RepositoryException
-
getPrivilegeSet
Set<Privilege> getPrivilegeSet(Path absPath) throws RepositoryException
Returns thePrivileges granted by the underlying policy at the givenabsPath.- Parameters:
absPath- Absolute path to aNode.- Returns:
- the granted privileges at
absPath. - Throws:
RepositoryException- if an error occurs
-
canReadAll
boolean canReadAll() throws RepositoryExceptionReturnstrueif READ permission is granted everywhere. This method acts as shortcut forgrants(Path, int)where permissions isPermission.READand allows to shorten the evaluation time given the fact that a check for READ permission is considered to be the most frequent test.- Returns:
trueif the READ permission is granted everywhere.- Throws:
RepositoryException- if an error occurs
-
canRead
boolean canRead(Path itemPath, ItemId itemId) throws RepositoryException
Returnstrueif READ permission is granted for the existing item with the givenPathand/orItemId. This method acts as shortcut forgrants(Path, int)where permissions isPermission.READand allows to shorten the evaluation time given the fact that a check for READ permissions is considered to be the most frequent test.
If both Path and ItemId are notnullit is left to the implementation which parameter to use.n- Parameters:
itemPath- The path to the item ornullif the ID should be used to determine the READ permission.itemId- The itemId ornullif the path should be used to determine the READ permission.- Returns:
trueif the READ permission is granted.- Throws:
RepositoryException- If no item exists with the specified path or itemId or if some other error occurs.
-
-