@ParametersAreNonnullByDefault @PublicApi public interface

PermissionSchemeService

com.atlassian.jira.permission.PermissionSchemeService
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Service for managing permission schemes.

Summary

Public Methods
ServiceResult assignPermissionSchemeToProject(ApplicationUser user, Long schemeId, Long projectId)
Sets the specified permission scheme in the given project.
ServiceOutcome<PermissionScheme> createPermissionScheme(ApplicationUser user, PermissionSchemeInput permissionScheme)
Creates a new permission scheme.
ServiceResult deletePermissionScheme(ApplicationUser user, Long id)
Deletes a permission scheme.
ServiceOutcome<PermissionScheme> getPermissionScheme(ApplicationUser user, Long id)
Returns a permission scheme with the specified id.
ServiceOutcome<? extends List<PermissionScheme>> getPermissionSchemes(ApplicationUser user)
Returns all permission schemes sorted alphabetically by name.
ServiceOutcome<PermissionScheme> getSchemeAssignedToProject(ApplicationUser user, Long projectId)
Returns a permission scheme assigned to the specified project.
ServiceOutcome<PermissionScheme> updatePermissionScheme(ApplicationUser user, Long id, PermissionSchemeInput permissionScheme)
Updates a permission scheme identified by the given id.

Public Methods

public ServiceResult assignPermissionSchemeToProject (ApplicationUser user, Long schemeId, Long projectId)

Sets the specified permission scheme in the given project.

Parameters
user user that performs the operation. The user needs to be a JIRA administrator.
schemeId scheme to assign to the project
projectId project to assign the scheme to
Returns
  • service result marked as valid if successful, error collection otherwise

public ServiceOutcome<PermissionScheme> createPermissionScheme (ApplicationUser user, PermissionSchemeInput permissionScheme)

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.

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.

public ServiceResult deletePermissionScheme (ApplicationUser user, Long id)

Deletes a permission scheme.

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

public ServiceOutcome<PermissionScheme> getPermissionScheme (ApplicationUser user, Long id)

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.

Parameters
user user that performs the operation
id identifier of the permission scheme
Returns
  • A service outcome containing the permission scheme or an error collection if something went wrong.

public ServiceOutcome<? extends List<PermissionScheme>> getPermissionSchemes (ApplicationUser user)

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.

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.

public ServiceOutcome<PermissionScheme> getSchemeAssignedToProject (ApplicationUser user, Long projectId)

Returns a permission scheme assigned to the specified project.

If there is no scheme explicitly assigned, the default scheme is returned.

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.

public ServiceOutcome<PermissionScheme> updatePermissionScheme (ApplicationUser user, Long id, PermissionSchemeInput permissionScheme)

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 createPermissionScheme(ApplicationUser, PermissionSchemeInput) method.

Parameters
user user that performs the operation. The user needs to be a JIRA administrator.
id id of the scheme to be updated
permissionScheme new data of the permission scheme
Returns
  • A service outcome containing the updated permission scheme or an error collection if something went wrong.