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 JCRSession
interface.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_ADD_PROPERTY
A constant representing theadd_property
action string, used to determine if thisSession
has permission to add a new property.static String
ACTION_LOCKING
A constant representing thelocking
action string, used to determine if thisSession
has permission to lock or unlock a node.static String
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.static String
ACTION_MODIFY_PROPERTY
A constant representing themodify_property
action string, used to determine if thisSession
has permission to modify a property.static String
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.static String
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.static String
ACTION_REMOVE_NODE
A constant representing theremove_node
action string, used to determine if thisSession
has permission to remove a node.static String
ACTION_REMOVE_PROPERTY
A constant representing theremove_property
action string, used to determine if thisSession
has permission to remove a property.static String
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.static String
ACTION_VERSIONING
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Item
getItemOrNull(String absPath)
Returns the node at the specified absolute path in the workspace.Node
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).PrincipalManager
getPrincipalManager()
Returns thePrincipalManager
for the currentSession
.Property
getPropertyOrNull(String absPath)
Returns the property at the specified absolute path in the workspace ornull
if no such node exists.UserManager
getUserManager()
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 Detail
-
ACTION_ADD_PROPERTY
static final String ACTION_ADD_PROPERTY
A constant representing theadd_property
action string, used to determine if thisSession
has permission to add a new property.
-
ACTION_MODIFY_PROPERTY
static final String ACTION_MODIFY_PROPERTY
A constant representing themodify_property
action string, used to determine if thisSession
has permission to modify a property.
-
ACTION_REMOVE_PROPERTY
static final String ACTION_REMOVE_PROPERTY
A constant representing theremove_property
action string, used to determine if thisSession
has permission to remove a property.
-
ACTION_REMOVE_NODE
static final String ACTION_REMOVE_NODE
A constant representing theremove_node
action string, used to determine if thisSession
has permission to remove a node.
-
ACTION_NODE_TYPE_MANAGEMENT
static final String 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.
-
ACTION_VERSIONING
static final String ACTION_VERSIONING
A constant representing theversioning
action string, used to determine if thisSession
has permission to perform version operations on a node.
-
ACTION_LOCKING
static final String ACTION_LOCKING
A constant representing thelocking
action string, used to determine if thisSession
has permission to lock or unlock a node.
-
ACTION_READ_ACCESS_CONTROL
static final String 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.
-
ACTION_MODIFY_ACCESS_CONTROL
static final String 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.
-
ACTION_USER_MANAGEMENT
static final String 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.
-
-
Method Detail
-
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:-
{@code add_property}
: IfhasPermission(path, "add_property")
returnstrue
, then thisSession
has permission to add a new property atpath
. -
{@code modify_property}
: IfhasPermission(path, "modify_property")
returnstrue
, then thisSession
has permission to change a property atpath
. -
{@code remove_property}
: IfhasPermission(path, "remove_property")
returnstrue
, then thisSession
has permission to remove a property atpath
. -
{@code remove_node}
: IfhasPermission(path, "remove_node")
returnstrue
, then thisSession
has permission to remove a node atpath
. -
{@code node_type_management}
: IfhasPermission(path, "node_type_management")
returnstrue
, then thisSession
has permission to explicitly set or change the node type information associated with a node atpath
. -
{@code versioning}
: IfhasPermission(path, "versioning")
returnstrue
, then thisSession
has permission to perform version related operations on a node atpath
. -
{@code locking}
: IfhasPermission(path, "locking")
returnstrue
, then thisSession
has permission to lock and unlock a node atpath
. -
{@code read_access_control}
: IfhasPermission(path, "read_access_control")
returnstrue
, then thisSession
has permission to read access control content stored at an item atpath
. -
{@code modify_access_control}
: IfhasPermission(path, "modify_access_control")
returnstrue
, then thisSession
has permission to modify access control content at an item atpath
. -
{@code user_management}
: IfhasPermission(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:
Session.hasPermission(String, String)
-
-
getPrincipalManager
PrincipalManager getPrincipalManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Returns 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:
PrincipalManager
-
getUserManager
UserManager getUserManager() throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Returns 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:
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
Item
ornull
. - 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 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
Node getNodeOrNull(String absPath) throws RepositoryException
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:
Item.getParent()
-
-