Class DefaultPermissionSchemeService
- All Implemented Interfaces:
PermissionSchemeService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPermissionSchemeService
(PermissionSchemeManager permissionSchemeManager, GlobalPermissionManager globalPermissions, PermissionGrantValidator permissionGrantValidator, PermissionSchemeRepresentationConverter representationConverter, ProjectService projectService, I18nHelper i18n, UserKeyService userKeyService, UserManager userManager) -
Method Summary
Modifier and TypeMethodDescriptionassignPermissionSchemeToProject
(ApplicationUser user, Long schemeId, Long projectId) Sets the specified permission scheme in the given project.createPermissionScheme
(ApplicationUser user, PermissionSchemeInput permissionScheme) Creates a new permission scheme.deletePermissionScheme
(ApplicationUser user, Long id) Deletes a permission scheme.getPermissionScheme
(ApplicationUser user, Long id) Returns a permission scheme with the specified id.ServiceOutcome<com.google.common.collect.ImmutableList<PermissionScheme>>
Returns all permission schemes sorted alphabetically by name.getSchemeAssignedToProject
(ApplicationUser user, Long projectId) Returns a permission scheme assigned to the specified project.updatePermissionScheme
(ApplicationUser user, Long id, PermissionSchemeInput permissionScheme) Updates a permission scheme identified by the given id.
-
Constructor Details
-
DefaultPermissionSchemeService
public DefaultPermissionSchemeService(PermissionSchemeManager permissionSchemeManager, GlobalPermissionManager globalPermissions, PermissionGrantValidator permissionGrantValidator, PermissionSchemeRepresentationConverter representationConverter, ProjectService projectService, I18nHelper i18n, UserKeyService userKeyService, UserManager userManager)
-
-
Method Details
-
getPermissionSchemes
public ServiceOutcome<com.google.common.collect.ImmutableList<PermissionScheme>> getPermissionSchemes(ApplicationUser user) Description copied from interface:PermissionSchemeService
Returns all permission schemes sorted alphabetically by name.Only schemes the user has access to will be returned. That means all the schemes if the user is a JIRA administrator, or the schemes assigned to projects the user administers.
- Specified by:
getPermissionSchemes
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation- Returns:
- A service outcome containing an immutable list of permission schemes or an error collection if something went wrong.
-
getPermissionScheme
public ServiceOutcome<PermissionScheme> getPermissionScheme(@Nullable ApplicationUser user, Long id) Description copied from interface:PermissionSchemeService
Returns a permission scheme with the specified id.The user needs to have access to the permission scheme. That means the user needs to be a JIRA administrator or administer a project which has the scheme assigned.
- Specified by:
getPermissionScheme
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operationid
- identifier of the permission scheme- Returns:
- A service outcome containing the permission scheme or an error collection if something went wrong.
-
createPermissionScheme
public ServiceOutcome<PermissionScheme> createPermissionScheme(@Nullable ApplicationUser user, PermissionSchemeInput permissionScheme) Description copied from interface:PermissionSchemeService
Creates a new permission scheme. Permission scheme entities will also be created if provided.The permission scheme is validated thoroughly, e.g. if there is a permission for a group, then the group must exist, ditto for project roles, users, custom fields etc. Custom fields must be of proper types.
Note that permission scheme names must be unique.
- Specified by:
createPermissionScheme
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation. The user needs to be a JIRA administrator.permissionScheme
- permission scheme to create- Returns:
- A service outcome containing the created permission scheme or an error collection if something went wrong.
-
updatePermissionScheme
public ServiceOutcome<PermissionScheme> updatePermissionScheme(@Nullable ApplicationUser user, Long id, PermissionSchemeInput permissionScheme) Description copied from interface:PermissionSchemeService
Updates a permission scheme identified by the given id. Simple fields like name and description will be updated as well as permission scheme entities. After the update, the stored permission scheme will be exactly the same as the argument.Validation is the same as in the
PermissionSchemeService.createPermissionScheme(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.permission.PermissionSchemeInput)
method.- Specified by:
updatePermissionScheme
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation. The user needs to be a JIRA administrator.id
- id of the scheme to be updatedpermissionScheme
- new data of the permission scheme- Returns:
- A service outcome containing the updated permission scheme or an error collection if something went wrong.
-
deletePermissionScheme
Description copied from interface:PermissionSchemeService
Deletes a permission scheme.- Specified by:
deletePermissionScheme
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation. The user needs to be a JIRA administrator.id
- identifier of the permission scheme to be deleted- Returns:
- A service result marked as valid if successful, error collection otherwise
-
assignPermissionSchemeToProject
public ServiceResult assignPermissionSchemeToProject(@Nullable ApplicationUser user, Long schemeId, Long projectId) Description copied from interface:PermissionSchemeService
Sets the specified permission scheme in the given project.- Specified by:
assignPermissionSchemeToProject
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation. The user needs to be a JIRA administrator.schemeId
- scheme to assign to the projectprojectId
- project to assign the scheme to- Returns:
- service result marked as valid if successful, error collection otherwise
-
getSchemeAssignedToProject
public ServiceOutcome<PermissionScheme> getSchemeAssignedToProject(@Nullable ApplicationUser user, Long projectId) Description copied from interface:PermissionSchemeService
Returns a permission scheme assigned to the specified project.If there is no scheme explicitly assigned, the default scheme is returned.
- Specified by:
getSchemeAssignedToProject
in interfacePermissionSchemeService
- Parameters:
user
- user that performs the operation. The user needs a permission to administer the project.projectId
- identifier of the project- Returns:
- A service outcome containing the permission scheme or an error collection if something went wrong.
-