Package lumis.portal.principal
Class PrincipalManager
- java.lang.Object
-
- lumis.portal.principal.PrincipalManager
-
- All Implemented Interfaces:
IPrincipalManager
,IPrincipalManagerSPI
,IConfigKeyChecker
public class PrincipalManager extends java.lang.Object implements IPrincipalManagerSPI
Manage Principals.- Since:
- 4.0.6
- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
ACCESS_ADMINISTRATOR
protected static int
ACCESS_OWNER
-
Constructor Summary
Constructors Constructor Description PrincipalManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction)
Add a Principal.protected java.util.Collection<CacheItem<PrincipalConfig>>
bulkLoadPrincipals(ICacheMultiDataProvider.IRequest request)
Read all principals given the cache request.void
delete(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction)
Remove a Principal.PrincipalConfig
get(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction)
Get the Principal.PrincipalConfig
getByShortId(SessionConfig sessionConfig, java.lang.String shortId, ITransaction transaction)
Get the Principal given the shortId.Principals
getCurrentUserPrincipals()
Returns the current user's principals.
This method follows the same rules ofIPrincipalManagerSPI.getPrincipalPrincipals(SessionConfig, String, boolean, ITransaction)
.java.util.Set<java.lang.String>
getPortalUserMembers(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction)
Returns the members that are (portal) users of the given principal.
The return value will be:
If the given principal is a user: a set with a single entry that is the given user itself. If the given principal is a user segmentation: a set with the users that are members of the given segmentation. If the given principal is a group: a set containing the result of a recursion in this method with each direct member of the given group.Principals
getPrincipalPrincipals(SessionConfig sessionConfig, java.lang.String principalId, boolean useSessionCache, ITransaction transaction)
Returns the principals of the given principal.
The return value will be:
If the given principal is a user: a set with an entry that is the given user itself and the result of the recursion in this method for each group and segmentation the user is member of.java.util.Set<java.lang.String>
getPrincipals(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction)
Returns the principals of the given principal.
The return value will be:
If the given principal is a user: a set with an entry that is the given user itself and the result of the recursion in this method for each group and segmentation the user is member of.boolean
isMember(SessionConfig sessionConfig, java.lang.String portalUserId, java.util.Collection<java.lang.String> principalIds, ITransaction transaction)
Check whether the principal is a member of any given principal.boolean
keyExists(SessionConfig sessionConfig, java.lang.Object configKey, java.lang.Object config, ITransaction transaction)
Checks if configId matches an already persisted objectvoid
update(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction)
Update a Principal.protected int
validateAccess(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction)
protected void
validateAdministrationAccess(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction)
-
-
-
Field Detail
-
ACCESS_OWNER
protected static final int ACCESS_OWNER
- See Also:
- Constant Field Values
-
ACCESS_ADMINISTRATOR
protected static final int ACCESS_ADMINISTRATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
bulkLoadPrincipals
protected java.util.Collection<CacheItem<PrincipalConfig>> bulkLoadPrincipals(ICacheMultiDataProvider.IRequest request) throws PortalException, DaoException
Read all principals given the cache request.- Parameters:
request
- the request.- Returns:
- all principals that fit in the cache size.
- Throws:
PortalException
DaoException
- Since:
- 11.0.0
-
add
public void add(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Add a Principal.- Specified by:
add
in interfaceIPrincipalManager
- Throws:
PortalException
-
update
public void update(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Update a Principal.- Specified by:
update
in interfaceIPrincipalManager
- Throws:
PortalException
-
delete
public void delete(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Remove a Principal.- Specified by:
delete
in interfaceIPrincipalManager
- Throws:
PortalException
-
get
public PrincipalConfig get(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Get the Principal.- Specified by:
get
in interfaceIPrincipalManager
- Returns:
- a PrincipalConfig.
- Throws:
PortalException
-
getByShortId
public PrincipalConfig getByShortId(SessionConfig sessionConfig, java.lang.String shortId, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Get the Principal given the shortId.- Specified by:
getByShortId
in interfaceIPrincipalManager
- Returns:
- a PrincipalConfig.
- Throws:
PortalException
-
validateAdministrationAccess
protected void validateAdministrationAccess(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
validateAccess
protected int validateAccess(SessionConfig sessionConfig, PrincipalConfig principal, ITransaction transaction) throws PortalException
- Throws:
PortalException
-
keyExists
public boolean keyExists(SessionConfig sessionConfig, java.lang.Object configKey, java.lang.Object config, ITransaction transaction)
Description copied from interface:IConfigKeyChecker
Checks if configId matches an already persisted object- Specified by:
keyExists
in interfaceIConfigKeyChecker
config
- Optional, allows a checker to read aditional fields to check composed keys- Returns:
- true if configId matches an already persisted object
-
getPortalUserMembers
public java.util.Set<java.lang.String> getPortalUserMembers(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Returns the members that are (portal) users of the given principal.
The return value will be:
- If the given principal is a user: a set with a single entry that is the given user itself.
- If the given principal is a user segmentation: a set with the users that are members of the given segmentation.
- If the given principal is a group: a set containing the result of a recursion in this method with each direct member of the given group.
- Specified by:
getPortalUserMembers
in interfaceIPrincipalManager
- Parameters:
sessionConfig
- the user's session.principalId
- the principal identifier.transaction
- the transaction.- Returns:
- the members that are (portal) users of the given principal.
- Throws:
PortalException
-
getPrincipals
public java.util.Set<java.lang.String> getPrincipals(SessionConfig sessionConfig, java.lang.String principalId, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Returns the principals of the given principal.
The return value will be:
- If the given principal is a user: a set with an entry that is the given user itself and the result of the recursion in this method for each group and segmentation the user is member of. The segmentations will not be calculated if the given principal is the guest user and there is no current monitor user in current thread.
- If the given principal is a user segmentation: a set with the given segmentation and the result of the recursion in this method with each group the given segmentation is member of.
- If the given principal is a group: a set containing the given group and the result of a recursion in this method with each group the given group is member of.
- Specified by:
getPrincipals
in interfaceIPrincipalManager
- Parameters:
sessionConfig
- the user's session.principalId
- the principal identifier.transaction
- the transaction.- Returns:
- the principals of the given principal.
- Throws:
PortalException
-
isMember
public boolean isMember(SessionConfig sessionConfig, java.lang.String portalUserId, java.util.Collection<java.lang.String> principalIds, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManager
Check whether the principal is a member of any given principal.- Specified by:
isMember
in interfaceIPrincipalManager
- Parameters:
sessionConfig
- the sesssion config.portalUserId
- the identifier of user.principalIds
- the identifiers of principals.transaction
- the transaction.- Returns:
- true whether the principal is member, otherwise false.
- Throws:
PortalException
-
getPrincipalPrincipals
public Principals getPrincipalPrincipals(SessionConfig sessionConfig, java.lang.String principalId, boolean useSessionCache, ITransaction transaction) throws PortalException
Description copied from interface:IPrincipalManagerSPI
Returns the principals of the given principal.
The return value will be:
- If the given principal is a user: a set with an entry that is the given user itself and the result of the recursion in this method for each group and segmentation the user is member of. The segmentations will not be calculated if the given principal is the guest user and there is no current monitor user in current thread.
- If the given principal is a user segmentation: a set with the given segmentation and the result of the recursion in this method with each group the given segmentation is member of.
- If the given principal is a group: a set containing the given group and the result of a recursion in this method with each group the given group is member of.
- Specified by:
getPrincipalPrincipals
in interfaceIPrincipalManagerSPI
- Parameters:
sessionConfig
- the user's session.principalId
- the principal identifier.useSessionCache
- indicates whether the session cache should be used.transaction
- the transaction.- Returns:
- the principals of the given principal.
- Throws:
PortalException
-
getCurrentUserPrincipals
public Principals getCurrentUserPrincipals() throws PortalException
Description copied from interface:IPrincipalManagerSPI
Returns the current user's principals.
This method follows the same rules ofIPrincipalManagerSPI.getPrincipalPrincipals(SessionConfig, String, boolean, ITransaction)
.- Specified by:
getCurrentUserPrincipals
in interfaceIPrincipalManagerSPI
- Returns:
- the current user's principals.
- Throws:
PortalException
-
-