public interface UserPropertiesManager
UserPropertiesManager
interface provides access to
UserProperties
associated with a given authorizable.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_RANKING
Constant for the ranking property.
|
static java.util.Comparator<Node> |
DESCENDING_RANKING_COMPARATOR
Comparator used to sort UserProperties by descending ranking.
|
static java.lang.String |
GRANITE_RANKING
Constant for the ranking property name.
|
static java.lang.String |
JCR_TITLE
Constant for the UserProperties name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addReaders(UserProperties userProperties,
java.security.Principal... principals)
Grant read permission on the UserProperties to the given Principal.
|
UserPropertiesQueryParams |
createQueryParams()
Creates a new instance of
UserPropertiesQueryParams that can be used during a call to
query(UserPropertiesQueryParams, String) . |
UserProperties |
createUserProperties(java.lang.String authorizableId,
java.lang.String relPath)
Create a new instance of
UserProperties . |
java.util.Iterator<UserProperties> |
getMemberOfUserProperties(java.lang.String authorizableId,
java.lang.String relPath,
boolean declaredOnly)
Returns an iterator over the properties of all groups that the authorizable with
authorizableId is
a member of. |
java.util.Iterator<UserProperties> |
getMemberUserProperties(Group group,
java.lang.String relPath,
boolean declaredOnly)
Returns an iterator over the user properties of all members of the given group.
|
UserProperties |
getUserProperties(Authorizable authorizable,
java.lang.String relPath)
Retrieve the user properties identified by the given relative path and
the specified authorizable.
|
UserProperties |
getUserProperties(Node userPropertiesNode)
Retrieve the user properties identified by the given node.
|
UserProperties |
getUserProperties(java.lang.String authorizableId,
java.lang.String relPath)
Retrieve the user properties identified by the given relative path and
the specified authorizable ID.
|
UserProperties |
getUserProperties(java.lang.String authorizableId,
java.lang.String relRootPath,
java.util.Comparator<Node> comparator)
Retrieves with the given session a composite (aggregation) of
UserProperties associated with
the authorizable identified by the given authorizableId . |
UserPropertiesComposite |
getUserPropertiesComposite(java.lang.String authorizableId,
java.lang.String relRootPath)
Deprecated.
Use
getUserProperties(String, String, Comparator) instead. |
UserPropertiesComposite |
getUserPropertiesComposite(java.lang.String authorizableId,
java.lang.String[] relPaths)
Deprecated.
Use
getUserProperties(String, String, Comparator) instead. |
UserPropertiesComposite |
getUserPropertiesComposite(java.lang.String authorizableId,
java.lang.String relRootPath,
java.util.Comparator<Node> comparator)
Deprecated.
Use
getUserProperties(String, String, Comparator) instead. |
UserPropertiesComposite |
getUserPropertiesComposite(java.lang.String authorizableId,
UserPropertiesFilter filter)
Deprecated.
Use
getUserProperties(String, String, Comparator) instead. |
java.util.Iterator<UserProperties> |
query(UserPropertiesQueryParams params,
java.lang.String relPath)
Searches the user properties matching the given query parameters.
|
boolean |
removeReaders(UserProperties userProperties,
java.security.Principal... principals)
Remove read permission granted on the UserProperties to the given Principal.
|
static final java.lang.String JCR_TITLE
static final java.lang.String GRANITE_RANKING
static final int DEFAULT_RANKING
static final java.util.Comparator<Node> DESCENDING_RANKING_COMPARATOR
UserProperties createUserProperties(java.lang.String authorizableId, java.lang.String relPath) throws RepositoryException
UserProperties
. Please note that
javax.jcr.Session#save()
must be called by the editing JCR
session in order to persist the new user properties.authorizableId
- The ID of the associated authorizable.relPath
- A name or relative path identifying the new user properties.UserProperties
instance. Note that the
associated JCR node will be NEW
until
Session.save
is called to persist the changes.javax.jcr.RepositoryException
- If an error occurs or the specified
relative path is invalid.RepositoryException
UserProperties getUserProperties(java.lang.String authorizableId, java.lang.String relPath) throws RepositoryException
authorizableId
- Identifier of the target authorizable.relPath
- A name or relative path identifying the user properties.UserProperties
or null
if the authorizable does not exist or it has no user properties at the
specified relative path.RepositoryException
- If an error occurs or the specified
relative path is invalid.UserProperties getUserProperties(Authorizable authorizable, java.lang.String relPath) throws RepositoryException
authorizable
- The target authorizable.relPath
- A name or relative path identifying the user properties.UserProperties
or null
if the authorizable has no user properties at the specified relative path.RepositoryException
- If an error occurs or the specified
relative path is invalid.UserProperties getUserProperties(Node userPropertiesNode) throws RepositoryException
userPropertiesNode
- The node representing the user properties.RepositoryException
- If an exception occurs or if the given node
does not represent valid user properties (e.g. not associated with an
authorizable).UserProperties getUserProperties(java.lang.String authorizableId, java.lang.String relRootPath, java.util.Comparator<Node> comparator) throws RepositoryException
UserProperties
associated with
the authorizable identified by the given authorizableId
.
The UserProperties
are ordered using the given Comparator
prior to be aggregated.
See example in getUserPropertiesComposite(String, String)
.authorizableId
- The ID of the Authorizable
for which to retrieve the user properties composite.relRootPath
- relative root path for the properties to be obtained; if null
UserPropertiesService.PROFILES_ROOT
will be used as default.comparator
- The comparator used to sort candidates in a specific orderUserProperties
aggregating the properties contained below relRootPath
ordered using the given comparator
.RepositoryException
- If an error occurs during repository access or no authorizable was found with the given authorizableId
.UserPropertiesComposite getUserPropertiesComposite(java.lang.String authorizableId, java.lang.String[] relPaths) throws RepositoryException
getUserProperties(String, String, Comparator)
instead.UserProperties
associated with the authorizable identified by the
given authorizableId
and corresponding to and in the order of the given relPaths
. The
ordering is relevant for e.g. accessing a property found on multiple user property nodes, in which case it is
inherited according to the order (last has precedence).authorizableId
- The ID of the Authorizable
for which to retrieve the user properties composite.relPaths
- An array of strings denoting the desired relative paths of the user property nodes and
their order in which to be included in the composite.UserProperties
.RepositoryException
- If an error occurs during repository access or no authorizable was found with the
given authorizableId
.UserPropertiesComposite getUserPropertiesComposite(java.lang.String authorizableId, UserPropertiesFilter filter) throws RepositoryException
getUserProperties(String, String, Comparator)
instead.UserProperties
associated with the authorizable identified by the
given authorizableId
and included by the given filter
.authorizableId
- The ID of the Authorizable
for which to retrieve the user properties composite.filter
- A UserPropertiesFilter
by which user properties are included or excluded.UserPropertiesComposite
containing the UserProperties
included by the filter.RepositoryException
- If an error occurs during repository access or no authorizable was found with the
given authorizableId
.UserPropertiesComposite getUserPropertiesComposite(java.lang.String authorizableId, java.lang.String relRootPath) throws RepositoryException
getUserProperties(String, String, Comparator)
instead.UserProperties
associated with the authorizable identified by the
given authorizableId
. The UserProperties
are retrieved with the javax.jcr.Session
passed to the @{link UserPropertiesManager}, then are ordered by descending ranking using
DESCENDING_RANKING_COMPARATOR
prior to being aggregated. The table below illustrates this behavior.
Profile 1 value | Profile 2 value | Profile 3 value | Value returns by UserPropertiesComposite | |
---|---|---|---|---|
Is Readable by user session | No | Yes | Yes | - |
Ranking | 700 | 500 | 100 | - |
Name | Robert Jnr | Robert | Bob | Robert |
Age | (undefined) | (undefined) | 25 | 25 |
robert.private@example.com | (undefined) | (undefined) | (undefined) |
authorizableId
- The ID of the Authorizable
for which to retrieve the user properties composite.relRootPath
- relative root path of the UserProperties
to be aggregatedUserPropertiesComposite
containing the UserProperties
RepositoryException
- If an error occurs during repository access or no authorizable was found with the
given authorizableId
.UserPropertiesComposite getUserPropertiesComposite(java.lang.String authorizableId, java.lang.String relRootPath, java.util.Comparator<Node> comparator) throws RepositoryException
getUserProperties(String, String, Comparator)
instead.UserProperties
associated with
the authorizable identified by the given authorizableId
.
The UserProperties
are ordered using the given Comparator
prior to be aggregated.
The UserPropertiesComposite
will contain the most private properties accessible by the user session.
See example in getUserPropertiesComposite(String, String)
.authorizableId
- The ID of the Authorizable
for which to retrieve the user properties composite.relRootPath
- relative root pathcomparator
- The comparator used to sort candidates in a specific orderUserPropertiesComposite
containing the UserProperties
.RepositoryException
- If an error occurs during repository access or no authorizable was found with the
given authorizableId
.java.util.Iterator<UserProperties> getMemberOfUserProperties(java.lang.String authorizableId, java.lang.String relPath, boolean declaredOnly) throws RepositoryException
authorizableId
is
a member of. please note that only groups are included of which the underlying session has read access to.authorizableId
- the id of the authorizablerelPath
- the relative path to build the user properties fromdeclaredOnly
- if true
only declared groups are includedRepositoryException
- if an error occursAuthorizable.memberOf()
,
Authorizable.declaredMemberOf()
java.util.Iterator<UserProperties> getMemberUserProperties(Group group, java.lang.String relPath, boolean declaredOnly) throws RepositoryException
group
- the group to retrieve the members fromrelPath
- the relative path to build the user properties fromdeclaredOnly
- if true
only declared members are includedRepositoryException
- if an error occursGroup.getMembers()
,
Group.getDeclaredMembers()
boolean addReaders(UserProperties userProperties, java.security.Principal... principals) throws RepositoryException
UserPropertiesManager
instance.
Principal can be retrieved with PrincipalManager.getPrincipal(String)
.
Similarly Everyone Principal can be retrieved with PrincipalManager.getEveryone()
.userProperties
- user properties to which readers should be addedprincipals
- Principal to which read access must be grantedRepositoryException
- if an error occurs or the editing session is not allowed to modify access controlboolean removeReaders(UserProperties userProperties, java.security.Principal... principals) throws RepositoryException
UserPropertiesManager
instance.
Note that the Authorizable may keep having read access to the UserProperties if inherited from group membership
or glob permissions.userProperties
- user properties to which readers should be removedprincipals
- Principal to which read access must be revokedRepositoryException
- if an error occurs or the editing session is not allowed to modify access controlUserPropertiesQueryParams createQueryParams()
UserPropertiesQueryParams
that can be used during a call to
query(UserPropertiesQueryParams, String)
.UserPropertiesQueryParams
.java.util.Iterator<UserProperties> query(UserPropertiesQueryParams params, java.lang.String relPath) throws RepositoryException
The client of this method is responsible to review the underlying query performance related to the given
relPath
. Typically this is about creating an appropriate Oak index.
For example, inspect the authorizable
index.
See /oak:index/authorizables/
in your crx/de
instance.
Also the user has to have jcr:read
access to the node denoted by relPath
.
params
- the parameters of the query.
If the AuthorizableTypes criterion from the parameters is not specified, all the authorizable types
will be included in the query result.relPath
- the name or relative path identifying the user properties, such as profile
.UserProperties
as the result of the query.RepositoryException
- when there is an exception when accessing the repository."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"