public class ProjectMemberManager extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ProjectMemberManager.ProjectMember
This class represents a member of a project.
|
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 |
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
|
protected PopulationContextHelper |
_populationContextHelper
The population context helper
|
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 UserDirectoryHelper |
_userDirectoryHelper
The user directory helper
|
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 |
_addProfile(JCRProjectMember member,
String profileId,
AmetysObject aclObject) |
private void |
_allowReadAccessOnProject(JCRProjectMember member,
Project project) |
private Set<String> |
_getAllowedProfile(JCRProjectMember member,
AmetysObject object) |
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 Set<UserIdentity> |
_getUsersOfGroupMember(JCRProjectMember projectMember) |
private boolean |
_isCurrentUser(boolean isTypeUser,
UserIdentity user) |
private boolean |
_isOnlyManager(Project project,
boolean isTypeUser,
UserIdentity user) |
private void |
_notifyAclUpdated(UserIdentity userIdentity,
AmetysObject aclContext,
Collection<String> aclProfiles) |
private void |
_removeManager(Project project,
boolean isTypeUser,
UserIdentity user) |
private void |
_removeManagerRights(Project project,
UserIdentity userIdentity) |
private void |
_removeMemberProfiles(JCRProjectMember member,
AmetysObject object) |
private void |
_removeMemberProfiles(Project project,
JCRProjectMember projectMember) |
private void |
_removeProfile(JCRProjectMember member,
String profileId,
AmetysObject aclObject) |
private void |
_setMemberProfiles(JCRProjectMember member,
Set<String> allowedProfiles,
AmetysObject object) |
private void |
_setProfileOnModule(JCRProjectMember member,
Project project,
WorkspaceModule module,
Set<String> allowedProfiles) |
private void |
_setReadAccess(JCRProjectMember member,
AmetysObject aclObject) |
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
|
private Set<UserIdentity> |
getGroupUsers(JCRProjectMember member) |
Map<String,Object> |
getMemberModuleRights(String projectName)
Retrieves the rights for the current user in the project
|
Long |
getMembersCount(Project project)
Count the total of unique users in the project and in the project's group
|
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
|
JCRProjectMember |
getProjectMember(Project project,
UserIdentity userIdentity)
Retrieve the member of a project corresponding to the user identity
|
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
|
List<ProjectMemberManager.ProjectMember> |
getProjectMembers(Project project,
boolean expandGroup)
Get the members of a project, sorted by managers, non empty role and name
|
List<Map<String,Object>> |
getProjectMembers(String projectName,
String lang,
boolean expandGroup,
boolean withUserContent)
Get the members of a project, sorted by managers, non empty role and name
|
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
|
private Predicate<JCRProjectMember> |
isUserOfType(JCRProjectMember.MemberType memberType) |
Map<String,Object> |
removeMember(String projectName,
String identity,
String type)
Remove a user from a project
|
void |
service(ServiceManager manager) |
void |
setMemberProfiles(Map<String,String> newProfiles,
JCRProjectMember projectMember,
Project project,
boolean newMember)
Set the profiles for a member
|
void |
setProjectManager(String projectName,
String profileId,
List<UserIdentity> managers)
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
@Obsolete private static final String __PROJECT_RIGHT_PROFILE
private static final String __PROJECT_MEMBERS_NODE
private static final String __PROJECT_MEMBERS_NODE_TYPE
private static final String __PROJECT_MEMBER_NODE_TYPE
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
protected PopulationContextHelper _populationContextHelper
protected UserDirectoryHelper _userDirectoryHelper
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 userpublic void setMemberProfiles(Map<String,String> newProfiles, JCRProjectMember projectMember, Project project, boolean newMember)
newProfiles
- The allowed profile by moduleprojectMember
- The memberproject
- The projectnewMember
- true if it is a new created memberprivate void _setProfileOnModule(JCRProjectMember member, Project project, WorkspaceModule module, Set<String> allowedProfiles)
private Set<String> _getAllowedProfile(JCRProjectMember member, AmetysObject object)
private void _setMemberProfiles(JCRProjectMember member, Set<String> allowedProfiles, AmetysObject object)
private void _removeProfile(JCRProjectMember member, String profileId, AmetysObject aclObject)
private void _addProfile(JCRProjectMember member, String profileId, AmetysObject aclObject)
private void _setReadAccess(JCRProjectMember member, AmetysObject aclObject)
private void _allowReadAccessOnProject(JCRProjectMember member, Project project)
private List<ModifiablePage> _getProjectDashboardPages(Project project)
private void _removeMemberProfiles(JCRProjectMember member, AmetysObject object)
public Map<String,Object> getCurrentUser()
public Map<String,Object> getProjectMembers()
public List<Map<String,Object>> getProjectMembers(String projectName, String lang, boolean expandGroup, boolean withUserContent) throws IllegalAccessException, AmetysRepositoryException
projectName
- the project's namelang
- the language to get user contentexpandGroup
- true to expand the user of a groupwithUserContent
- true to get the user contentIllegalAccessException
- if an error occurredAmetysRepositoryException
- if an error occurredpublic List<ProjectMemberManager.ProjectMember> getProjectMembers(Project project, boolean expandGroup) throws IllegalAccessException, AmetysRepositoryException
project
- the projectexpandGroup
- true to expand the user of a groupIllegalAccessException
- if an error occurredAmetysRepositoryException
- 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 JCRProjectMember getProjectMember(Project project, UserIdentity userIdentity)
project
- The projectuserIdentity
- The user identityprivate Set<UserIdentity> _getUsersOfGroupMember(JCRProjectMember projectMember)
public void setProjectManager(String projectName, String profileId, List<UserIdentity> managers)
projectName
- The project nameprofileId
- The profile id to affectmanagers
- The managers' user identityprivate 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 boolean _isCurrentUser(boolean isTypeUser, UserIdentity user)
private boolean _isOnlyManager(Project project, boolean isTypeUser, UserIdentity user)
private JCRProjectMember _getProjectMember(Project project, GroupIdentity group)
private JCRProjectMember _getProjectMember(Project project, UserIdentity user)
private void _removeManager(Project project, boolean isTypeUser, 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 grouppublic Long getMembersCount(Project project)
project
- The projectprivate Set<UserIdentity> getGroupUsers(JCRProjectMember member)
private Predicate<JCRProjectMember> isUserOfType(JCRProjectMember.MemberType memberType)