Class ProjectRightHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.project.rights.ProjectRightHelper
-
- All Implemented Interfaces:
LogEnabled,Component,Serviceable
public class ProjectRightHelper extends AbstractLogEnabled implements Serviceable, Component
Helper related to rights management for projects.
-
-
Field Summary
Fields Modifier and Type Field Description private static String__PROJECT_RIGHT_PROFILEprotected Map<String,WorkspaceModule>_contentTypesToModuleAssociation ContentTypeId, Moduleprotected CurrentUserProvider_currentUserProviderCurrent user providerprotected WorkspaceModuleExtensionPoint_moduleManagerEPModule managers EPprivate Set<String>_profileIdsprotected ProjectManager_projectManagerProject managerprotected AmetysObjectResolver_resolverAmetys object resolverprotected RightManager_rightManagerRight managerprotected RightProfilesDAO_rightProfilesDaoRight profiles managerprotected WorkspaceModuleExtensionPoint_workspaceModuleEPWorkspace Module ExtensionPointstatic StringROLEAvalon Role
-
Constructor Summary
Constructors Constructor Description ProjectRightHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,Object>_getModuleRightData(Project project, WorkspaceModule module)private Map<String,Object>_getProfileRightData(Profile profile)private boolean_hasRightOnMembers(Project project, String rightId)private boolean_hasRightOnTagsOrPlaces(Project project, String rightId)booleancanAddMember(Project project)Determines if the current user has right to add member on projectbooleancanAddPlace(Project project)Determines if the current user has right to add places on projectbooleancanAddTag(Project project)Determines if the current user has right to add tags on projectbooleancanEditMember(Project project)Determines if the current user has right to edit member on projectbooleancanRemoveMember(Project project)Determines if the current user has right to add member on projectbooleancanRemovePlace(Project project)Determines if the current user has right to remove places on projectbooleancanRemoveTag(Project project)Determines if the current user has right to remove tags on projectbooleancanViewMembers(Project project)Determines if the current user can view the members of a projectSet<Profile>getProfiles()Retrieves all project profile given the "profile list" configuration parameter Profile order is guaranteed to be the same as in the configuration parameter.Set<String>getProfilesIds()Retrieves all project profiles ids given the "profile list" configuration parameter Profile order is guaranteed to be the same as in the configuration parameter.Map<String,WorkspaceModule>getProjectContentTypesAndModules()The association of all project content types and associated modulesMap<String,Object>getProjectRightsData(String projectName)Get the list of profiles and the list of modules available for rights affectation in the project.booleanhasReadAccess(Project project)Test if the current user has a read access on the projectbooleanhasRight(String rightId, ExplorerNode explorerNode)Test if the current user has the right on an explorer nodebooleanhasRight(String rightId, Project project)Test if the current user has the right on the projectvoidservice(ServiceManager manager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__PROJECT_RIGHT_PROFILE
@Obsolete private static final String __PROJECT_RIGHT_PROFILE
- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
Ametys object resolver
-
_projectManager
protected ProjectManager _projectManager
Project manager
-
_rightManager
protected RightManager _rightManager
Right manager
-
_rightProfilesDao
protected RightProfilesDAO _rightProfilesDao
Right profiles manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
Current user provider
-
_workspaceModuleEP
protected WorkspaceModuleExtensionPoint _workspaceModuleEP
Workspace Module ExtensionPoint
-
_contentTypesToModule
protected Map<String,WorkspaceModule> _contentTypesToModule
Association ContentTypeId, Module
-
_moduleManagerEP
protected WorkspaceModuleExtensionPoint _moduleManagerEP
Module managers EP
-
_profileIds
private Set<String> _profileIds
-
-
Constructor Detail
-
ProjectRightHelper
public ProjectRightHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getProjectContentTypesAndModules
public Map<String,WorkspaceModule> getProjectContentTypesAndModules()
The association of all project content types and associated modules- Returns:
- The association
-
getProfilesIds
public Set<String> getProfilesIds()
Retrieves all project profiles ids given the "profile list" configuration parameter Profile order is guaranteed to be the same as in the configuration parameter.- Returns:
- the projects
-
getProfiles
public Set<Profile> getProfiles()
Retrieves all project profile given the "profile list" configuration parameter Profile order is guaranteed to be the same as in the configuration parameter.- Returns:
- the projects
-
getProjectRightsData
public Map<String,Object> getProjectRightsData(String projectName)
Get the list of profiles and the list of modules available for rights affectation in the project.- Parameters:
projectName- The project to check if the modules are activated. Can be null to ignore- Returns:
- the project rights data
-
_getProfileRightData
private Map<String,Object> _getProfileRightData(Profile profile)
-
_getModuleRightData
private Map<String,Object> _getModuleRightData(Project project, WorkspaceModule module)
-
canViewMembers
public boolean canViewMembers(Project project)
Determines if the current user can view the members of a project- Parameters:
project- the project- Returns:
- true if user can view members
-
canAddMember
public boolean canAddMember(Project project)
Determines if the current user has right to add member on project- Parameters:
project- the project- Returns:
- true if user can add member
-
canEditMember
public boolean canEditMember(Project project)
Determines if the current user has right to edit member on project- Parameters:
project- the project- Returns:
- true if user can edit member
-
canRemoveMember
public boolean canRemoveMember(Project project)
Determines if the current user has right to add member on project- Parameters:
project- the project- Returns:
- true if user can remove member
-
_hasRightOnMembers
private boolean _hasRightOnMembers(Project project, String rightId)
-
canAddTag
public boolean canAddTag(Project project)
Determines if the current user has right to add tags on project- Parameters:
project- the project- Returns:
- true if user can add tags
-
canRemoveTag
public boolean canRemoveTag(Project project)
Determines if the current user has right to remove tags on project- Parameters:
project- the project- Returns:
- true if user can remove tags
-
canAddPlace
public boolean canAddPlace(Project project)
Determines if the current user has right to add places on project- Parameters:
project- the project- Returns:
- true if user can add places
-
canRemovePlace
public boolean canRemovePlace(Project project)
Determines if the current user has right to remove places on project- Parameters:
project- the project- Returns:
- true if user can remove places
-
_hasRightOnTagsOrPlaces
private boolean _hasRightOnTagsOrPlaces(Project project, String rightId)
-
hasRight
public boolean hasRight(String rightId, Project project)
Test if the current user has the right on the project- Parameters:
rightId- The right idproject- The project- Returns:
- true if has right
-
hasReadAccess
public boolean hasReadAccess(Project project)
Test if the current user has a read access on the project- Parameters:
project- The project- Returns:
- true if has read access
-
hasRight
public boolean hasRight(String rightId, ExplorerNode explorerNode)
Test if the current user has the right on an explorer node- Parameters:
rightId- The right idexplorerNode- The explorer node- Returns:
- true if has right
-
-