public class DefaultProjectRoleManager extends Object implements ProjectRoleManager, GroupConfigurable
ProjectRoleManager
ProjectRoleManager.ProjectIdToProjectRoleIdsMap
Constructor and Description |
---|
DefaultProjectRoleManager(ProjectRoleAndActorStore projectRoleAndActorStore) |
Modifier and Type | Method and Description |
---|---|
void |
applyDefaultsRolesToProject(Project project)
This method will insert all the default roles into the role associations for the provided project.
|
ProjectRoleManager.ProjectIdToProjectRoleIdsMap |
createProjectIdToProjectRolesMap(ApplicationUser user,
Collection<Long> projectIds) |
ProjectRole |
createRole(ProjectRole projectRole)
Creates a project role object
|
void |
deleteRole(ProjectRole projectRole)
Deletes a project role object
|
DefaultRoleActors |
getDefaultRoleActors(ProjectRole projectRole)
This method will return the default role actors for a
ProjectRole |
Collection<Long> |
getProjectIdsContainingRoleActorByNameAndType(String key,
String type)
Returns the project id's which contain a role actor of the specified name and type within any role.
|
Map<Long,List<String>> |
getProjectIdsForUserInGroupsBecauseOfRole(List<Long> projectsToLimitBy,
ProjectRole projectRole,
String projectRoleType,
String userName)
Returns a Map of Lists.
|
ProjectRole |
getProjectRole(Long id)
Retrieves a project role object
|
ProjectRole |
getProjectRole(String name)
Retrieves a project role object by name
|
ProjectRoleActors |
getProjectRoleActors(ProjectRole projectRole,
Project project)
This method will retrieve the object that represents the actors associate with the given
projectRole
and project context |
Collection<ProjectRole> |
getProjectRoles()
Get all the ProjectRoles available in JIRA.
|
Collection<ProjectRole> |
getProjectRoles(ApplicationUser user,
Project project)
This will return all the
ProjectRole s that the user is currently a member of for the given project. |
boolean |
isGroupUsed(com.atlassian.crowd.embedded.api.Group group)
Determine whether configuration exists for the specified
Group . |
boolean |
isRoleNameUnique(String name)
Will tell you if a role name exists or not.
|
boolean |
isUserInProjectRole(ApplicationUser user,
ProjectRole projectRole,
Project project)
Returns true only if the given user is in the given project role for the
given project.
|
void |
removeAllRoleActorsByNameAndType(String key,
String type)
This will remove all role actors with the specified name and the specified type.
|
void |
removeAllRoleActorsByProject(Project project)
Will remove all role actors associated with the specified project.
|
List<Long> |
roleActorOfTypeExistsForProjects(List<Long> projectsToLimitBy,
ProjectRole projectRole,
String projectRoleType,
String projectRoleParameter)
Returns a list of projectId's for which the role actor of the specified type exists in the project for the
provided projectRole.
|
void |
updateDefaultRoleActors(DefaultRoleActors defaultRoleActors)
This method will update the associations of actors for the default projectRole, specified by the given
defaultRoleActors object.
|
void |
updateProjectRoleActors(ProjectRoleActors projectRoleActors)
Commits the given ProjectRoleActors to permanent store, saving any updates made.
|
void |
updateRole(ProjectRole projectRole)
Updates a project role object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isGroupUsed
public DefaultProjectRoleManager(ProjectRoleAndActorStore projectRoleAndActorStore)
public Collection<ProjectRole> getProjectRoles()
ProjectRoleManager
getProjectRoles
in interface ProjectRoleManager
public Collection<ProjectRole> getProjectRoles(ApplicationUser user, Project project)
ProjectRoleManager
ProjectRole
s that the user is currently a member of for the given project.getProjectRoles
in interface ProjectRoleManager
user
- the userproject
- the projectpublic ProjectRole getProjectRole(Long id)
ProjectRoleManager
getProjectRole
in interface ProjectRoleManager
public ProjectRole getProjectRole(String name)
ProjectRoleManager
getProjectRole
in interface ProjectRoleManager
public ProjectRole createRole(ProjectRole projectRole)
ProjectRoleManager
createRole
in interface ProjectRoleManager
projectRole
- the project role to create, if the id field is non-null then this will be ignored. Only the
roles name and description are used by this method.public boolean isRoleNameUnique(String name)
ProjectRoleManager
isRoleNameUnique
in interface ProjectRoleManager
name
- the name of the project role to checkpublic void deleteRole(ProjectRole projectRole)
ProjectRoleManager
deleteRole
in interface ProjectRoleManager
public void updateRole(ProjectRole projectRole)
ProjectRoleManager
updateRole
in interface ProjectRoleManager
public ProjectRoleActors getProjectRoleActors(ProjectRole projectRole, Project project)
ProjectRoleManager
projectRole
and project
contextgetProjectRoleActors
in interface ProjectRoleManager
public void updateProjectRoleActors(ProjectRoleActors projectRoleActors)
ProjectRoleManager
updateProjectRoleActors
in interface ProjectRoleManager
public DefaultRoleActors getDefaultRoleActors(ProjectRole projectRole)
ProjectRoleManager
ProjectRole
getDefaultRoleActors
in interface ProjectRoleManager
public void updateDefaultRoleActors(DefaultRoleActors defaultRoleActors)
ProjectRoleManager
updateDefaultRoleActors
in interface ProjectRoleManager
public void applyDefaultsRolesToProject(Project project)
ProjectRoleManager
applyDefaultsRolesToProject
in interface ProjectRoleManager
project
- the project to associate the role defaults withpublic void removeAllRoleActorsByNameAndType(String key, String type)
ProjectRoleManager
removeAllRoleActorsByNameAndType
in interface ProjectRoleManager
type
- this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)public void removeAllRoleActorsByProject(Project project)
ProjectRoleManager
removeAllRoleActorsByProject
in interface ProjectRoleManager
project
- this is the project that the role actors are associated withpublic boolean isUserInProjectRole(ApplicationUser user, ProjectRole projectRole, Project project)
ProjectRoleManager
isUserInProjectRole
in interface ProjectRoleManager
user
- The user to check. If user is null, this will implicitly return false.projectRole
- The role.project
- The project.public Collection<Long> getProjectIdsContainingRoleActorByNameAndType(String key, String type)
ProjectRoleManager
getProjectIdsContainingRoleActorByNameAndType
in interface ProjectRoleManager
key
- this is the name that the role actor is stored under (ex. username of 'admin', group name of
'jira-users')type
- this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)public List<Long> roleActorOfTypeExistsForProjects(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String projectRoleParameter)
ProjectRoleManager
roleActorOfTypeExistsForProjects
in interface ProjectRoleManager
projectsToLimitBy
- this will limit the range of projects the method queries. This is a list of Long, project
id's. The returned list will be either the same as this list or a subset.projectRole
- the project role to find out if an actor is a member of.projectRoleType
- the type of role actor you want to query for, in most cases this will be UserRoleActor.TYPE.projectRoleParameter
- the parameter describing the role actor, in the case of a UserRoleActor this will be
the username.public Map<Long,List<String>> getProjectIdsForUserInGroupsBecauseOfRole(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String userName)
ProjectRoleManager
getProjectIdsForUserInGroupsBecauseOfRole
in interface ProjectRoleManager
projectsToLimitBy
- this will limit the range of projects the method queries. This is a list of Long, project
id's. The returned list will be either the same as this list or a subset.projectRole
- the project role to find out if an actor is a member of.projectRoleType
- the type of role actor you want to query for, in most cases this will be UserRoleActor.TYPE.userName
- the username to find out if the user is in the role because of a grouppublic ProjectRoleManager.ProjectIdToProjectRoleIdsMap createProjectIdToProjectRolesMap(ApplicationUser user, Collection<Long> projectIds)
createProjectIdToProjectRolesMap
in interface ProjectRoleManager
public boolean isGroupUsed(@Nonnull com.atlassian.crowd.embedded.api.Group group)
GroupConfigurable
Group
.isGroupUsed
in interface GroupConfigurable
group
- that may or may not exist.Copyright © 2002-2015 Atlassian. All Rights Reserved.