Package org.apache.jackrabbit.api
Interface JackrabbitSession
- All Superinterfaces:
Session
- All Known Subinterfaces:
CRXSession
Jackrabbit specific extension of the JCR
Session
interface.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
A constant representing theadd_property
action string, used to determine if thisSession
has permission to add a new property.static final String
A constant representing thelocking
action string, used to determine if thisSession
has permission to lock or unlock a node.static final String
A constant representing themodify_access_control
action string, used to determine if thisSession
has permission to modify access control content at the given path.static final String
A constant representing themodify_property
action string, used to determine if thisSession
has permission to modify a property.static final String
A constant representing thenode_type_management
action string, used to determine if thisSession
has permission to write node type information of a node.static final String
A constant representing theread_access_control
action string, used to determine if thisSession
has permission to read access control content at the given path.static final String
A constant representing theremove_node
action string, used to determine if thisSession
has permission to remove a node.static final String
A constant representing theremove_property
action string, used to determine if thisSession
has permission to remove a property.static final String
A constant representing theuser_management
action string, used to determine if thisSession
has permission to perform user management operations at the given path.static final String
A constant representing theversioning
action string, used to determine if thisSession
has permission to perform version operations on a node.Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
-
Method Summary
Modifier and TypeMethodDescriptiongetItemOrNull
(String absPath) Returns the node at the specified absolute path in the workspace.getNodeOrNull
(String absPath) Returns the node at the specified absolute path in the workspace ornull
if no such node exists.default @Nullable Node
getParentOrNull
(@NotNull Item item) Returns the parent of the givenItem
ornull
if no parent exists (either because the givenItem
represents the root node or the current session does not have sufficient access to retrieve the parent).Returns thePrincipalManager
for the currentSession
.getPropertyOrNull
(String absPath) Returns the property at the specified absolute path in the workspace ornull
if no such node exists.Returns theUserManager
for the currentSession
.boolean
hasPermission
(@NotNull String absPath, @NotNull String... actions) Returnstrue
if thisSession
has permission to perform the specified actions at the specifiedabsPath
andfalse
otherwise.Methods inherited from interface javax.jcr.Session
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAccessControlManager, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNode, getNodeByIdentifier, getNodeByUUID, getProperty, getRepository, getRetentionManager, getRootNode, getUserID, getValueFactory, getWorkspace, hasCapability, hasPendingChanges, hasPermission, impersonate, importXML, isLive, itemExists, logout, move, nodeExists, propertyExists, refresh, removeItem, removeLockToken, save, setNamespacePrefix
-
Field Details
-
ACTION_ADD_PROPERTY
A constant representing theadd_property
action string, used to determine if thisSession
has permission to add a new property.- See Also:
-
ACTION_MODIFY_PROPERTY
A constant representing themodify_property
action string, used to determine if thisSession
has permission to modify a property.- See Also:
-
ACTION_REMOVE_PROPERTY
A constant representing theremove_property
action string, used to determine if thisSession
has permission to remove a property.- See Also:
-
ACTION_REMOVE_NODE
A constant representing theremove_node
action string, used to determine if thisSession
has permission to remove a node.- See Also:
-
ACTION_NODE_TYPE_MANAGEMENT
A constant representing thenode_type_management
action string, used to determine if thisSession
has permission to write node type information of a node.- See Also:
-
ACTION_VERSIONING
A constant representing theversioning
action string, used to determine if thisSession
has permission to perform version operations on a node.- See Also:
-
ACTION_LOCKING
A constant representing thelocking
action string, used to determine if thisSession
has permission to lock or unlock a node.- See Also:
-
ACTION_READ_ACCESS_CONTROL
A constant representing theread_access_control
action string, used to determine if thisSession
has permission to read access control content at the given path.- See Also:
-
ACTION_MODIFY_ACCESS_CONTROL
A constant representing themodify_access_control
action string, used to determine if thisSession
has permission to modify access control content at the given path.- See Also:
-
ACTION_USER_MANAGEMENT
A constant representing theuser_management
action string, used to determine if thisSession
has permission to perform user management operations at the given path.- See Also:
-
-
Method Details
-
hasPermission
boolean hasPermission(@NotNull @NotNull String absPath, @NotNull @NotNull String... actions) throws RepositoryException Returnstrue
if thisSession
has permission to perform the specified actions at the specifiedabsPath
andfalse
otherwise.The
actions
parameter is a list of action strings. Apart from the actions defined onSession
, this variant also allows to specify the following additional actions to provide better permission discovery:-
: Ifadd_property
hasPermission(path, "add_property")
returnstrue
, then thisSession
has permission to add a new property atpath
. -
: Ifmodify_property
hasPermission(path, "modify_property")
returnstrue
, then thisSession
has permission to change a property atpath
. -
: Ifremove_property
hasPermission(path, "remove_property")
returnstrue
, then thisSession
has permission to remove a property atpath
. -
: Ifremove_node
hasPermission(path, "remove_node")
returnstrue
, then thisSession
has permission to remove a node atpath
. -
: Ifnode_type_management
hasPermission(path, "node_type_management")
returnstrue
, then thisSession
has permission to explicitly set or change the node type information associated with a node atpath
. -
: Ifversioning
hasPermission(path, "versioning")
returnstrue
, then thisSession
has permission to perform version related operations on a node atpath
. -
: Iflocking
hasPermission(path, "locking")
returnstrue
, then thisSession
has permission to lock and unlock a node atpath
. -
: Ifread_access_control
hasPermission(path, "read_access_control")
returnstrue
, then thisSession
has permission to read access control content stored at an item atpath
. -
: Ifmodify_access_control
hasPermission(path, "modify_access_control")
returnstrue
, then thisSession
has permission to modify access control content at an item atpath
. -
: Ifuser_management
hasPermission(path, "user_management")
returnstrue
, then thisSession
has permission to perform user management operations at an item atpath
.
true
if thisSession
has permission to perform all of the listed actions at the specified path.The information returned through this method will only reflect the permission status (both JCR defined and implementation-specific) and not other restrictions that may exist, such as node type or other implementation enforced constraints. For example, even though
hasPermission
may indicate that a particularSession
may add a property at/A/B/C
, the node type of the node at/A/B
may prevent the addition of a property calledC
.- Parameters:
absPath
- an absolute path.actions
- one or several actions.- Returns:
true
if thisSession
has permission to perform the specified actions at the specifiedabsPath
.- Throws:
RepositoryException
- if an error occurs.- See Also:
-
-
getPrincipalManager
PrincipalManager getPrincipalManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryExceptionReturns thePrincipalManager
for the currentSession
.- Returns:
- the
PrincipalManager
associated with thisSession
. - Throws:
AccessDeniedException
- If the session lacks privileges to access the principal manager or principals in general.UnsupportedRepositoryOperationException
- If principal management is not supported.RepositoryException
- If another error occurs.- See Also:
-
getUserManager
UserManager getUserManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryExceptionReturns theUserManager
for the currentSession
.- Returns:
- the
UserManager
associated with thisSession
. - Throws:
AccessDeniedException
- If this session is not allowed to to access user data.UnsupportedRepositoryOperationException
- If user management is not supported.RepositoryException
- If another error occurs.- See Also:
-
getItemOrNull
Returns the node at the specified absolute path in the workspace. If no such node exists, then it returns the property at the specified path. If no such property exists, then it returnnull
.- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Item
ornull
. - Throws:
RepositoryException
- if another error occurs.- Since:
- 2.11.1
-
getPropertyOrNull
Returns the property at the specified absolute path in the workspace ornull
if no such node exists.- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Property
ornull
. - Throws:
RepositoryException
- if another error occurs.- Since:
- 2.11.1
-
getNodeOrNull
Returns the node at the specified absolute path in the workspace ornull
if no such node exists.- Parameters:
absPath
- An absolute path.- Returns:
- the specified
Node
ornull
. - Throws:
RepositoryException
- If another error occurs.- Since:
- 2.11.1
-
getParentOrNull
@Nullable default @Nullable Node getParentOrNull(@NotNull @NotNull Item item) throws RepositoryException Returns the parent of the givenItem
ornull
if no parent exists (either because the givenItem
represents the root node or the current session does not have sufficient access to retrieve the parent).- Parameters:
item
- AnItem
that has been obtained by the current session.- Returns:
- The parent node of the given
Item
ornull
. - Throws:
RepositoryException
- If another error occurs.- Since:
- 1.42
- See Also:
-