Package org.ametys.core.group
Class GroupDirectoryContextHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.group.GroupDirectoryContextHelper
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class GroupDirectoryContextHelper
extends AbstractLogEnabled
implements Component, Serviceable, Initializable
Helper for associating
GroupDirectory
(ies) to contexts.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the cacheGet the cache as mapgetContextsForGroupDirectory
(String groupDirectoryId) Get the contexts that contain the group directorygetGroupDirectoriesOnContext
(String context) Gets the group directories linked to the given contextgetGroupDirectoriesOnContext
(String context, boolean checkRights) Gets the group directories linked to the given contextgetGroupDirectoriesOnContexts
(Set<String> contexts) Gets the group directories linked to at least one of the given contextsgetGroupDirectoriesOnContexts
(Set<String> contexts, boolean checkRights) Gets the group directories linked to at least one of the given contextsprotected Connection
Get the connection to the databasevoid
Links given group directories to a context.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
ADMIN_CONTEXT
The "admin" context- See Also:
-
-
Constructor Details
-
GroupDirectoryContextHelper
public GroupDirectoryContextHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getSQLConnection
Get the connection to the database- Returns:
- the SQL connection
-
link
Links given group directories to a context.- Parameters:
context
- The contextids
- The ids of the group directories to link- Returns:
- The ids of the linked group directories
-
getContextsForGroupDirectory
Get the contexts that contain the group directory- Parameters:
groupDirectoryId
- The id of the group directory- Returns:
- a
Set
of contexts
-
getGroupDirectoriesOnContext
public Set<String> getGroupDirectoriesOnContext(String context, boolean checkRights) throws AccessDeniedException Gets the group directories linked to the given context- Parameters:
context
- The contextcheckRights
-true
to check the rights of the user,false
otherwise- Returns:
- The ids of group directories linked to the context
- Throws:
AccessDeniedException
- If check right is set to true and the user tried to retrieve groups from unauthorized contexts
-
getGroupDirectoriesOnContext
Gets the group directories linked to the given context- Parameters:
context
- The context- Returns:
- The ids of group directories linked to the context
-
getGroupDirectoriesOnContexts
public Set<String> getGroupDirectoriesOnContexts(Set<String> contexts, boolean checkRights) throws AccessDeniedException Gets the group directories linked to at least one of the given contexts- Parameters:
contexts
- The contextscheckRights
-true
to check the rights of the user,false
otherwise- Returns:
- The ids of group directories linked to the contexts
- Throws:
AccessDeniedException
- If check right is set to true and the user tried to retrieve groups from unauthorized contexts
-
getGroupDirectoriesOnContexts
Gets the group directories linked to at least one of the given contexts- Parameters:
contexts
- The contexts- Returns:
- The ids of group directories linked to the contexts
-
_getCache
Get the cache- Returns:
- Non null cache
-
_getCacheAsMap
Get the cache as map- Returns:
- Non null cache
-