public class ProjectMemberManager extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Field and Description |
---|---|
private static String |
__PROJECT_MEMBER_NODE_TYPE
The type of a project user node type
|
private static String |
__PROJECT_MEMBERS_NODE
Constants for users project node
|
private static String |
__PROJECT_MEMBERS_NODE_TYPE
The type of the project users node type
|
private static String |
__PROJECT_RIGHT_PROFILE |
private static String |
__RIGHTS_ADD_MEMBER_TO_PROJECT
Project Right to add a member to a project
|
private static String |
__RIGHTS_REMOVE_MEMBER_TO_PROJECT
Project Right to remove a member from the project
|
static String |
__WORKSPACES_SERVICE_MEMBERS
The id of the members service
|
protected Context |
_context
Avalon context
|
protected CurrentUserProvider |
_currentUserProvider
Current user provider
|
protected GroupManager |
_groupManager
The groups manager
|
protected WorkspaceModuleExtensionPoint |
_moduleManagerEP
Module managers EP
|
protected ObservationManager |
_observationManager
The observation manager
|
private PopulationContextHelper |
_populationContextHelper |
protected ProfileAssignmentStorageExtensionPoint |
_profileAssignmentStorageExtensionPoint
Profile assignment storage
|
protected ProjectManager |
_projectManager
Project manager
|
protected ProjectRightHelper |
_projectRightHelper
Project rights helper
|
protected AmetysObjectResolver |
_resolver
Ametys object resolver
|
protected RightManager |
_rightManager
Rights manager
|
protected RightProfilesDAO |
_rightProfilesDAO
Profiles right manager
|
protected UserHelper |
_userHelper
The user helper
|
protected UserManager |
_userManager
Users manager
|
static String |
ROLE
Avalon Role
|
Constructor and Description |
---|
ProjectMemberManager() |
Modifier and Type | Method and Description |
---|---|
private void |
_allowReadAccessOnProjectDashboard(JCRProjectMember member,
Project project) |
private Map<String,String> |
_getMemberProfiles(JCRProjectMember member,
Project project) |
protected JCRProjectMember |
_getOrCreateProjectMember(Project project,
Predicate<? super AmetysObject> findMemberPredicate)
Retrieve or create a member in a project
|
private List<ModifiablePage> |
_getProjectDashboardPages(Project project) |
private JCRProjectMember |
_getProjectMember(Project project,
GroupIdentity group) |
private JCRProjectMember |
_getProjectMember(Project project,
UserIdentity user) |
protected ModifiableTraversableAmetysObject |
_getProjectMembersNode(Project project)
Retrieves the users node of the project
The users node will be created if necessary
|
private void |
_notifyAclUpdated(UserIdentity userIdentity,
AmetysObject aclContext,
Collection<String> aclProfiles) |
private void |
_removeManagerRights(Project project,
UserIdentity userIdentity) |
private void |
_removeMemberProfiles(JCRProjectMember member,
AmetysObject object) |
private void |
_removeMemberProfiles(JCRProjectMember member,
List<Profile> projectProfiles,
AmetysObject object,
Set<String> updatedProfiles,
Set<String> currentAllowedProfiles) |
private void |
_removeMemberProfiles(Project project,
JCRProjectMember projectMember) |
private void |
_removeReadAccessOnProjectDashboard(JCRProjectMember member,
Project project) |
private void |
_setMemberProfiles(JCRProjectMember member,
List<Profile> projectProfiles,
List<String> allowedProfiles,
AmetysObject object) |
private void |
_setMemberProfiles(JCRProjectMember member,
List<Profile> projectProfiles,
List<String> allowedProfiles,
AmetysObject object,
Set<String> updatedProfiles,
Set<String> currentAllowedProfiles) |
private void |
_setMemberProfiles(Map<String,String> newProfiles,
JCRProjectMember projectMember,
Project project,
boolean newMember) |
private void |
_updateReadAccessOnModulePage(JCRProjectMember member,
Page modulePage,
boolean allowed) |
boolean |
addProjectMember(Project project,
UserIdentity user)
Add a user to a project with open inscriptions, using the default values
|
void |
contextualize(Context context) |
Map<String,Object> |
getCurrentUser()
Get the current user information
|
Map<String,Object> |
getMemberModuleRights(String projectName)
Retrieves the rights for the current user in the project
|
JCRProjectMember |
getOrCreateProjectMember(Project project,
GroupIdentity groupIdentity)
Retrieve or create a group as a member in a project
|
JCRProjectMember |
getOrCreateProjectMember(Project project,
UserIdentity userIdentity)
Retrieve or create a user in a project
|
Map<String,Object> |
getProjectMemberData(String projectName,
String identity,
String type)
Retrieve the data of a member of a project, or the default data if no user is provided
|
Map<String,Object> |
getProjectMembers()
Get the members of current project or all the members of all projects in where is no current project
|
Set<JCRProjectMember> |
getProjectMembers(Project project)
Get the list of users of the project
|
Map<String,Object> |
getProjectMembers(String projectName)
Get the list of users of the project
|
protected Map<String,Object> |
group2Json(Group group)
Get the JSON representation of a group
|
boolean |
isProjectMember(Project project,
UserIdentity userIdentity)
Test if an user is a member of a project
|
Map<String,Object> |
removeMember(String projectName,
String identity,
String type)
Remove a user from a project
|
void |
service(ServiceManager manager) |
void |
setProjectManager(String projectName,
String profileId,
UserIdentity userIdentity)
Set the manager of a project
|
Map<String,Object> |
setProjectMemberData(String projectName,
String identity,
String type,
Map<String,String> newProfiles,
String role)
Set the user data in the project
|
getLogger, setLogger
public static final String __WORKSPACES_SERVICE_MEMBERS
private static final String __PROJECT_MEMBERS_NODE
private static final String __PROJECT_MEMBERS_NODE_TYPE
private static final String __PROJECT_MEMBER_NODE_TYPE
private static final String __RIGHTS_ADD_MEMBER_TO_PROJECT
private static final String __RIGHTS_REMOVE_MEMBER_TO_PROJECT
private static final String __PROJECT_RIGHT_PROFILE
protected ProjectManager _projectManager
protected ProjectRightHelper _projectRightHelper
protected RightProfilesDAO _rightProfilesDAO
protected ProfileAssignmentStorageExtensionPoint _profileAssignmentStorageExtensionPoint
protected AmetysObjectResolver _resolver
protected RightManager _rightManager
protected CurrentUserProvider _currentUserProvider
protected UserManager _userManager
protected ObservationManager _observationManager
protected WorkspaceModuleExtensionPoint _moduleManagerEP
protected UserHelper _userHelper
protected GroupManager _groupManager
private PopulationContextHelper _populationContextHelper
public ProjectMemberManager()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public Map<String,Object> getProjectMemberData(String projectName, String identity, String type) throws IllegalAccessException
projectName
- The name of the projectidentity
- The user or group identity. If null, return the default profiles for a new usertype
- The type of the identity. Can be "user" or "group"IllegalAccessException
- If the user cannot execute this operationprivate Map<String,String> _getMemberProfiles(JCRProjectMember member, Project project)
public Map<String,Object> setProjectMemberData(String projectName, String identity, String type, Map<String,String> newProfiles, String role) throws IllegalAccessException
projectName
- The project nameidentity
- The user or group identity.type
- The type of the identity. Can be "user" or "group"newProfiles
- The profiles to affect, mapped by modulerole
- The user role inside the projectIllegalAccessException
- If the user cannot execute this operationpublic boolean addProjectMember(Project project, UserIdentity user)
project
- The projectuser
- The userprivate void _setMemberProfiles(Map<String,String> newProfiles, JCRProjectMember projectMember, Project project, boolean newMember)
private void _setMemberProfiles(JCRProjectMember member, List<Profile> projectProfiles, List<String> allowedProfiles, AmetysObject object)
private void _setMemberProfiles(JCRProjectMember member, List<Profile> projectProfiles, List<String> allowedProfiles, AmetysObject object, Set<String> updatedProfiles, Set<String> currentAllowedProfiles)
private void _removeMemberProfiles(JCRProjectMember member, List<Profile> projectProfiles, AmetysObject object, Set<String> updatedProfiles, Set<String> currentAllowedProfiles)
private void _allowReadAccessOnProjectDashboard(JCRProjectMember member, Project project)
private List<ModifiablePage> _getProjectDashboardPages(Project project)
private void _removeReadAccessOnProjectDashboard(JCRProjectMember member, Project project)
private void _updateReadAccessOnModulePage(JCRProjectMember member, Page modulePage, boolean allowed)
private void _removeMemberProfiles(JCRProjectMember member, AmetysObject object)
public Map<String,Object> getCurrentUser()
public Map<String,Object> getProjectMembers()
public Map<String,Object> getProjectMembers(String projectName) throws IllegalAccessException, AmetysRepositoryException
projectName
- The project nameAmetysRepositoryException
- If an error occurredIllegalAccessException
- If an error occurredpublic Map<String,Object> getMemberModuleRights(String projectName)
projectName
- The project Namepublic Set<JCRProjectMember> getProjectMembers(Project project)
project
- The projectpublic boolean isProjectMember(Project project, UserIdentity userIdentity)
project
- The projectuserIdentity
- The user identitypublic void setProjectManager(String projectName, String profileId, UserIdentity userIdentity)
projectName
- The project nameprofileId
- The profile id to affectuserIdentity
- The userprivate void _removeManagerRights(Project project, UserIdentity userIdentity)
private void _notifyAclUpdated(UserIdentity userIdentity, AmetysObject aclContext, Collection<String> aclProfiles)
public JCRProjectMember getOrCreateProjectMember(Project project, UserIdentity userIdentity)
project
- The projectuserIdentity
- the userpublic JCRProjectMember getOrCreateProjectMember(Project project, GroupIdentity groupIdentity)
project
- The projectgroupIdentity
- the groupprotected JCRProjectMember _getOrCreateProjectMember(Project project, Predicate<? super AmetysObject> findMemberPredicate)
project
- The projectfindMemberPredicate
- The predicate to find the member nodepublic Map<String,Object> removeMember(String projectName, String identity, String type) throws IllegalAccessException
projectName
- The project nameidentity
- The identity of the user or group, who must be a member of the projecttype
- The type of the member, user or groupIllegalAccessException
- If the user cannot execute this operationprivate JCRProjectMember _getProjectMember(Project project, GroupIdentity group)
private JCRProjectMember _getProjectMember(Project project, UserIdentity user)
private void _removeMemberProfiles(Project project, JCRProjectMember projectMember)
protected ModifiableTraversableAmetysObject _getProjectMembersNode(Project project)
project
- The projectprotected Map<String,Object> group2Json(Group group)
group
- The group