public interface ProjectRoleManager
Modifier and Type | Interface and Description |
---|---|
static class |
ProjectRoleManager.ProjectIdToProjectRoleIdsMap
This class implements is backed by the map with project ID as a key and
a collection of project role IDs as the mapped value of the map.
|
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 name,
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 |
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
|
Collection<ProjectRole> getProjectRoles()
Collection<ProjectRole> getProjectRoles(ApplicationUser user, Project project)
ProjectRole
s that the user is currently a member of for the given project.
An anonymous or null user will not belong to any project roles and therefore this collection will be empty.user
- the userproject
- the projectIllegalArgumentException
- is thrown if the project
is nullProjectRole getProjectRole(Long id)
id
- IllegalArgumentException
- is thrown if the id
is nullProjectRole getProjectRole(String name)
name
- IllegalArgumentException
- is thrown if the name
is null, or an empty StringProjectRole createRole(ProjectRole projectRole)
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.IllegalArgumentException
- is thrown if projectRole
or projectRole.getName
are nullboolean isRoleNameUnique(String name)
name
- the name of the project role to checkvoid deleteRole(ProjectRole projectRole)
projectRole
- IllegalArgumentException
- is thrown if the projectRole
is nullvoid updateRole(ProjectRole projectRole)
projectRole
- IllegalArgumentException
- is thrown if the projectRole
or projectRole.getName()
is nullProjectRoleActors getProjectRoleActors(ProjectRole projectRole, Project project)
projectRole
and project
contextprojectRole
- project
- IllegalArgumentException
- if the given projectRole
or project
is nullvoid updateProjectRoleActors(ProjectRoleActors projectRoleActors)
projectRoleActors
- IllegalArgumentException
- if the given projectRoleActors
is null or the projectRoleActors
project, projectRole or roleActors is null.DefaultRoleActors getDefaultRoleActors(ProjectRole projectRole)
ProjectRole
projectRole
- IllegalArgumentException
- will be thrown if ProjectRole
is nullvoid updateDefaultRoleActors(DefaultRoleActors defaultRoleActors)
defaultRoleActors
- IllegalArgumentException
- if the given defaultRoleActors
is null or the projectRole
or roleActors is null.void applyDefaultsRolesToProject(Project project)
project
- the project to associate the role defaults withIllegalArgumentException
- if project
void removeAllRoleActorsByNameAndType(String key, String type)
key
- type
- this is the role type parameter, (ex. GroupRoleActor.TYPE, UserRoleActor.TYPE)IllegalArgumentException
- if name
or type
is nullvoid removeAllRoleActorsByProject(Project project)
project
- this is the project that the role actors are associated withIllegalArgumentException
- if the project
is nullboolean isUserInProjectRole(ApplicationUser user, ProjectRole projectRole, Project project)
user
- The user to check. If user is null, this will implicitly return false.projectRole
- The role.project
- The project.IllegalArgumentException
- if ProjectRole
or Project
is null.Collection<Long> getProjectIdsContainingRoleActorByNameAndType(String name, String type)
name
- 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)List<Long> roleActorOfTypeExistsForProjects(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String projectRoleParameter)
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.Map<Long,List<String>> getProjectIdsForUserInGroupsBecauseOfRole(List<Long> projectsToLimitBy, ProjectRole projectRole, String projectRoleType, String userName)
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 groupProjectRoleManager.ProjectIdToProjectRoleIdsMap createProjectIdToProjectRolesMap(ApplicationUser user, Collection<Long> projectIds)
Copyright © 2002-2022 Atlassian. All Rights Reserved.