Package org.apache.jackrabbit.api
Interface JackrabbitSession
-
- All Superinterfaces:
Session
- All Known Implementing Classes:
SessionImpl
@ProviderType public interface JackrabbitSession extends Session
Jackrabbit specific extension of the JCRSessioninterface.
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTION_ADD_PROPERTYA constant representing theadd_propertyaction string, used to determine if thisSessionhas permission to add a new property.static StringACTION_LOCKINGA constant representing thelockingaction string, used to determine if thisSessionhas permission to lock or unlock a node.static StringACTION_MODIFY_ACCESS_CONTROLA constant representing themodify_access_controlaction string, used to determine if thisSessionhas permission to modify access control content at the given path.static StringACTION_MODIFY_PROPERTYA constant representing themodify_propertyaction string, used to determine if thisSessionhas permission to modify a property.static StringACTION_NODE_TYPE_MANAGEMENTA constant representing thenode_type_managementaction string, used to determine if thisSessionhas permission to write node type information of a node.static StringACTION_READ_ACCESS_CONTROLA constant representing theread_access_controlaction string, used to determine if thisSessionhas permission to read access control content at the given path.static StringACTION_REMOVE_NODEA constant representing theremove_nodeaction string, used to determine if thisSessionhas permission to remove a node.static StringACTION_REMOVE_PROPERTYA constant representing theremove_propertyaction string, used to determine if thisSessionhas permission to remove a property.static StringACTION_USER_MANAGEMENTA constant representing theuser_managementaction string, used to determine if thisSessionhas permission to perform user management operations at the given path.static StringACTION_VERSIONINGA constant representing theversioningaction string, used to determine if thisSessionhas 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @NotNull Set<Principal>getBoundPrincipals()Returns the set of principals associated with this session.@NotNull StringgetExpandedName(@NotNull Item item)Returns the expanded name of the givenItem.@NotNull StringgetExpandedPath(@NotNull Item item)Returns the expanded path of the givenItem.ItemgetItemOrNull(String absPath)Returns the node at the specified absolute path in the workspace.NodegetNodeOrNull(String absPath)Returns the node at the specified absolute path in the workspace ornullif no such node exists.default @Nullable NodegetParentOrNull(@NotNull Item item)Returns the parent of the givenItemornullif no parent exists (either because the givenItemrepresents the root node or the current session does not have sufficient access to retrieve the parent).PrincipalManagergetPrincipalManager()Returns thePrincipalManagerfor the currentSession.PropertygetPropertyOrNull(String absPath)Returns the property at the specified absolute path in the workspace ornullif no such node exists.UserManagergetUserManager()Returns theUserManagerfor the currentSession.booleanhasPermission(@NotNull String absPath, @NotNull String... actions)Returnstrueif thisSessionhas permission to perform the specified actions at the specifiedabsPathandfalseotherwise.-
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 Detail
-
ACTION_ADD_PROPERTY
static final String ACTION_ADD_PROPERTY
A constant representing theadd_propertyaction string, used to determine if thisSessionhas permission to add a new property.
-
ACTION_MODIFY_PROPERTY
static final String ACTION_MODIFY_PROPERTY
A constant representing themodify_propertyaction string, used to determine if thisSessionhas permission to modify a property.
-
ACTION_REMOVE_PROPERTY
static final String ACTION_REMOVE_PROPERTY
A constant representing theremove_propertyaction string, used to determine if thisSessionhas permission to remove a property.
-
ACTION_REMOVE_NODE
static final String ACTION_REMOVE_NODE
A constant representing theremove_nodeaction string, used to determine if thisSessionhas permission to remove a node.
-
ACTION_NODE_TYPE_MANAGEMENT
static final String ACTION_NODE_TYPE_MANAGEMENT
A constant representing thenode_type_managementaction string, used to determine if thisSessionhas permission to write node type information of a node.
-
ACTION_VERSIONING
static final String ACTION_VERSIONING
A constant representing theversioningaction string, used to determine if thisSessionhas permission to perform version operations on a node.
-
ACTION_LOCKING
static final String ACTION_LOCKING
A constant representing thelockingaction string, used to determine if thisSessionhas permission to lock or unlock a node.
-
ACTION_READ_ACCESS_CONTROL
static final String ACTION_READ_ACCESS_CONTROL
A constant representing theread_access_controlaction string, used to determine if thisSessionhas permission to read access control content at the given path.
-
ACTION_MODIFY_ACCESS_CONTROL
static final String ACTION_MODIFY_ACCESS_CONTROL
A constant representing themodify_access_controlaction string, used to determine if thisSessionhas permission to modify access control content at the given path.
-
ACTION_USER_MANAGEMENT
static final String ACTION_USER_MANAGEMENT
A constant representing theuser_managementaction string, used to determine if thisSessionhas permission to perform user management operations at the given path.
-
-
Method Detail
-
hasPermission
boolean hasPermission(@NotNull @NotNull String absPath, @NotNull @NotNull String... actions) throws RepositoryExceptionReturnstrueif thisSessionhas permission to perform the specified actions at the specifiedabsPathandfalseotherwise.The
actionsparameter 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:-
{@code add_property}: IfhasPermission(path, "add_property")returnstrue, then thisSessionhas permission to add a new property atpath. -
{@code modify_property}: IfhasPermission(path, "modify_property")returnstrue, then thisSessionhas permission to change a property atpath. -
{@code remove_property}: IfhasPermission(path, "remove_property")returnstrue, then thisSessionhas permission to remove a property atpath. -
{@code remove_node}: IfhasPermission(path, "remove_node")returnstrue, then thisSessionhas permission to remove a node atpath. -
{@code node_type_management}: IfhasPermission(path, "node_type_management")returnstrue, then thisSessionhas permission to explicitly set or change the node type information associated with a node atpath. -
{@code versioning}: IfhasPermission(path, "versioning")returnstrue, then thisSessionhas permission to perform version related operations on a node atpath. -
{@code locking}: IfhasPermission(path, "locking")returnstrue, then thisSessionhas permission to lock and unlock a node atpath. -
{@code read_access_control}: IfhasPermission(path, "read_access_control")returnstrue, then thisSessionhas permission to read access control content stored at an item atpath. -
{@code modify_access_control}: IfhasPermission(path, "modify_access_control")returnstrue, then thisSessionhas permission to modify access control content at an item atpath. -
{@code user_management}: IfhasPermission(path, "user_management")returnstrue, then thisSessionhas permission to perform user management operations at an item atpath.
trueif thisSessionhas 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
hasPermissionmay indicate that a particularSessionmay add a property at/A/B/C, the node type of the node at/A/Bmay prevent the addition of a property calledC.- Parameters:
absPath- an absolute path.actions- one or several actions.- Returns:
trueif thisSessionhas permission to perform the specified actions at the specifiedabsPath.- Throws:
RepositoryException- if an error occurs.- See Also:
Session.hasPermission(String, String)
-
-
getPrincipalManager
PrincipalManager getPrincipalManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Returns thePrincipalManagerfor the currentSession.- Returns:
- the
PrincipalManagerassociated 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:
PrincipalManager
-
getUserManager
UserManager getUserManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Returns theUserManagerfor the currentSession.- Returns:
- the
UserManagerassociated 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:
UserManager
-
getItemOrNull
Item getItemOrNull(String absPath) throws RepositoryException
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
Itemornull. - Throws:
RepositoryException- if another error occurs.- Since:
- 2.11.1
-
getPropertyOrNull
Property getPropertyOrNull(String absPath) throws RepositoryException
Returns the property at the specified absolute path in the workspace ornullif no such node exists.- Parameters:
absPath- An absolute path.- Returns:
- the specified
Propertyornull. - Throws:
RepositoryException- if another error occurs.- Since:
- 2.11.1
-
getNodeOrNull
Node getNodeOrNull(String absPath) throws RepositoryException
Returns the node at the specified absolute path in the workspace ornullif no such node exists.- Parameters:
absPath- An absolute path.- Returns:
- the specified
Nodeornull. - 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 givenItemornullif no parent exists (either because the givenItemrepresents the root node or the current session does not have sufficient access to retrieve the parent).- Parameters:
item- AnItemthat has been obtained by the current session.- Returns:
- The parent node of the given
Itemornull. - Throws:
RepositoryException- If another error occurs.- Since:
- 1.42
- See Also:
Item.getParent()
-
getExpandedName
@NotNull @NotNull String getExpandedName(@NotNull @NotNull Item item) throws RepositoryException
Returns the expanded name of the givenItem.- Parameters:
item- the item for which to retrieve the name- Returns:
- the name of the item in expanded form.
- Throws:
NamespaceException- when no expanded name can be determined (for instance, if the registered namespace (name) is invalid)RepositoryException- if another error occurs- Since:
- 1.78.0
- See Also:
- JCR 2.0, 3.2.5.1 Expanded Form
-
getExpandedPath
@NotNull @NotNull String getExpandedPath(@NotNull @NotNull Item item) throws RepositoryException
Returns the expanded path of the givenItem.- Parameters:
item- the item for which to retrieve the name- Returns:
- the path of the item in expanded form.
- Throws:
NamespaceException- when no expanded name can be determined (for instance, if the registered namespace (name) is invalid)RepositoryException- if another error occurs.- Since:
- 1.78.0
- See Also:
- JCR 2.0, 3.2.5.1 Expanded Form
-
getBoundPrincipals
@NotNull default @NotNull Set<Principal> getBoundPrincipals() throws RepositoryException
Returns the set of principals associated with this session.- Returns:
- the set of principals associated with this session. Usually this set is unmodifiable.
- Throws:
RepositoryException- in case principal information cannot be retrieved.IllegalStateException- if user information is not available or if the user is a system user.- Since:
- 1.84
-
-