Class ProjectRightHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.workspaces.project.rights.ProjectRightHelper
-
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Serviceable
public class ProjectRightHelper extends AbstractLogEnabled implements Serviceable, Component, PluginAware
Helper related to rights management for projects.
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__PROJECT_RIGHT_PROFILE
private static String
__RIGHT_ADD_MEMBER
Project Right to add a member to a projectprivate static String
__RIGHT_ADD_PLACE
Right to add a placeprivate static String
__RIGHT_ADD_TAG
Right to add a tagprivate static String
__RIGHT_DELETE_PLACE
Right to delete a placeprivate static String
__RIGHT_DELETE_TAG
Right to delete a tagprivate static String
__RIGHT_REMOVE_MEMBER
Project Right to remove a member from the projectprotected CurrentUserProvider
_currentUserProvider
Current user providerprotected WorkspaceModuleExtensionPoint
_moduleManagerEP
Module managers EPprivate String
_pluginName
private ProfileAssignmentStorageExtensionPoint
_profileAssignmentStorageEP
The profile storageprotected ProjectManager
_projectManager
Project managerprotected AmetysObjectResolver
_resolver
Ametys object resolverprotected RightManager
_rightManager
Right managerprotected RightProfilesDAO
_rightProfilesDao
Right profiles managerstatic String
ROLE
Avalon 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 Map<String,Object>
_getProjectRightData()
private boolean
_hasRightOnMembers(Project project, String rightId)
private boolean
_hasRightOnTagsOrPlaces(Project project, String rightId)
boolean
canAddMember(Project project)
Determines if the current user has right to add member on projectboolean
canAddPlace(Project project)
Determines if the current user has right to add places on projectboolean
canAddTag(Project project)
Determines if the current user has right to add tags on projectboolean
canEditMember(Project project)
Determines if the current user has right to edit member on projectboolean
canRemoveMember(Project project)
Determines if the current user has right to add member on projectboolean
canRemovePlace(Project project)
Determines if the current user has right to remove places on projectboolean
canRemoveTag(Project project)
Determines if the current user has right to remove tags on projectboolean
canViewMembers(Project project)
Determines if the current user can view the members of a projectString
getAllowedProfileOnModule(Project project, WorkspaceModule module, JCRProjectMember member)
Get the first allowed profile on project's module for a given memberList<Profile>
getProfileList()
Retrieves all project profile given the "profile list" configuration parameter Profile order is guaranteed to be the same as in the configuration parameter.Map<String,Object>
getProjectRightsData(String projectName)
Get the list of profiles and the list of modules available for rights affectation in the project.Map<String,Object>
getProjectRightsData(String projectName, boolean includeAllModules)
Get the list of profiles and the list of modules available for rights affectation in the project.boolean
hasReadAccess(ExplorerNode explorerNode)
Test if the current user has a read access on an explorer nodeboolean
hasReadAccess(Resource resource)
Test if the current user has a read access on a resourceboolean
hasReadAccess(Project project)
Test if the current user has a read access on the projectboolean
hasReadAccessOnExplorerNode(String explorerNodeId)
Test if the current user has a read access on an explorer nodeboolean
hasReadAccessOnProject(String projectId)
Test if the current user has a read access on the projectboolean
hasRight(String rightId, ExplorerNode explorerNode)
Test if the current user has the right on an explorer nodeboolean
hasRight(String rightId, Project project)
Test if the current user has the right on the projectboolean
hasRightOnExplorerNode(String rightId, String explorerNodeId)
Test if the current user has the right on an explorer nodeboolean
hasRightOnProject(String rightId, String projectId)
Test if the current user has the right on the projectvoid
service(ServiceManager manager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
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
-
__RIGHT_ADD_MEMBER
private static final String __RIGHT_ADD_MEMBER
Project Right to add a member to a project- See Also:
- Constant Field Values
-
__RIGHT_REMOVE_MEMBER
private static final String __RIGHT_REMOVE_MEMBER
Project Right to remove a member from the project- See Also:
- Constant Field Values
-
__RIGHT_ADD_TAG
private static final String __RIGHT_ADD_TAG
Right to add a tag- See Also:
- Constant Field Values
-
__RIGHT_DELETE_TAG
private static final String __RIGHT_DELETE_TAG
Right to delete a tag- See Also:
- Constant Field Values
-
__RIGHT_ADD_PLACE
private static final String __RIGHT_ADD_PLACE
Right to add a place- See Also:
- Constant Field Values
-
__RIGHT_DELETE_PLACE
private static final String __RIGHT_DELETE_PLACE
Right to delete a place- 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
-
_moduleManagerEP
protected WorkspaceModuleExtensionPoint _moduleManagerEP
Module managers EP
-
_profileAssignmentStorageEP
private ProfileAssignmentStorageExtensionPoint _profileAssignmentStorageEP
The profile storage
-
_pluginName
private String _pluginName
-
-
Constructor Detail
-
ProjectRightHelper
public ProjectRightHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
getProfileList
public List<Profile> getProfileList()
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
-
getAllowedProfileOnModule
public String getAllowedProfileOnModule(Project project, WorkspaceModule module, JCRProjectMember member)
Get the first allowed profile on project's module for a given member- Parameters:
project
- the projectmodule
- The workspace modulemember
- the member- Returns:
- the first allowed profile or null if not found
-
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
-
getProjectRightsData
@Obsolete public Map<String,Object> getProjectRightsData(String projectName, boolean includeAllModules)
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 ignoreincludeAllModules
- True to include modules not manager by the WorkspaceModuleManagerExtensionPoint- Returns:
- the project rights data
-
_getProfileRightData
private Map<String,Object> _getProfileRightData(Profile profile)
-
_getModuleRightData
private Map<String,Object> _getModuleRightData(Project project, WorkspaceModule module)
-
_getProjectRightData
@Obsolete private Map<String,Object> _getProjectRightData()
-
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)
-
hasRightOnProject
public boolean hasRightOnProject(String rightId, String projectId)
Test if the current user has the right on the project- Parameters:
rightId
- The right idprojectId
- The project id- Returns:
- true if has right
-
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
-
hasReadAccessOnProject
public boolean hasReadAccessOnProject(String projectId)
Test if the current user has a read access on the project- Parameters:
projectId
- The project id- Returns:
- true if has read access
-
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
-
hasRightOnExplorerNode
public boolean hasRightOnExplorerNode(String rightId, String explorerNodeId)
Test if the current user has the right on an explorer node- Parameters:
rightId
- The right idexplorerNodeId
- The explorer node id- Returns:
- true if has right
-
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
-
hasReadAccessOnExplorerNode
public boolean hasReadAccessOnExplorerNode(String explorerNodeId)
Test if the current user has a read access on an explorer node- Parameters:
explorerNodeId
- The explorer node id- Returns:
- true if has read access
-
hasReadAccess
public boolean hasReadAccess(ExplorerNode explorerNode)
Test if the current user has a read access on an explorer node- Parameters:
explorerNode
- The explorer node- Returns:
- true if has read access
-
hasReadAccess
public boolean hasReadAccess(Resource resource)
Test if the current user has a read access on a resource- Parameters:
resource
- The resource- Returns:
- true if has read access
-
-