public class

WorkflowBasedPermissionManager

extends DefaultPermissionManager
java.lang.Object
   ↳ com.atlassian.jira.security.DefaultPermissionManager
     ↳ com.atlassian.jira.security.WorkflowBasedPermissionManager
Known Direct Subclasses

Class Overview

Permission manager which allows workflow permissions to be further restricted for each workflow step, in the workflow XML descriptor. For instance, if the workflow contains a step:

    <step id="1" name="Open">
    <meta name="jira.status.id">1</meta>
    <meta name="jira.permission.comment.group">${pkey}-bizusers</meta>
    <meta name="jira.permission.comment.user">qa</meta>
    <meta name="jira.permission.edit.group.1">jira-developers</meta>
    <meta name="jira.permission.edit.group.2">jira-editors</meta>
    <meta name="jira.permission.edit.projectrole">10001</meta>
 
then only members of the project's bizusers group and user 'qa' will be able to comment on open issues, and only members of 'jira-developers' and 'jira-editors' groups or members of the project role with id '10001' will be able to edit issues. Assuming, of course, these users already have the relevant permission in the permission scheme.

Meta attributes can also modify subtasks' permissions. For example if the 'Bug' workflow's Open step has:

             <meta name="jira.permission.subtasks.edit.group">jira-qa</meta>
 
Then subtasks of Bugs will only be editable by 'jira-qa' members, when their parent is in the Open state.

The format is 'jira.permission.[subtasks.]{permission}.{type}[.suffix]', where:

  • {permission} is a short name specified in Permissions
  • {type} is a type (group, user, assignee, reporter, lead, userCF, projectrole) of permission granted, or denied to deny the permission.
  • subtasks., if specified, indicates that the permission applies to the subtasks of issues in this step.

    Important:Workflow permissions can only restrict permissions set in the permission scheme, not grant permissions.

Summary

Public Constructors
WorkflowBasedPermissionManager(WorkflowPermissionFactory workflowPermissionFactory, PermissionContextFactory permissionContextFactory, ProjectPermissionTypesManager projectPermissionTypesManager)
Public Methods
boolean hasPermission(int permissionId, GenericValue projectOrIssue, User user)
Checks to see if this has permission to see the specified entity
Check Permissions scheme(s) if the entity is project
Check Permissions scheme(s) and issue level security scheme(s) if the entity is an issue
boolean hasPermission(ProjectPermissionKey permissionsKey, Project project, User user)
boolean hasPermission(ProjectPermissionKey permissionKey, Issue issue, User user)
boolean hasPermission(int permissionsId, Project project, User user)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(ProjectPermissionKey permissionsKey, GenericValue entity, User user, boolean issueCreation)
boolean hasPermission(int permissionsId, Project project, ApplicationUser user)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(ProjectPermissionKey permissionKey, GenericValue projectOrIssue, User user)
boolean hasPermission(ProjectPermissionKey permissionsKey, Project project, ApplicationUser user, boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(ProjectPermissionKey permissionsKey, Project project, ApplicationUser user)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(int permissionId, GenericValue entity, User user, boolean issueCreation)
Does the same as hasPermission(int, org.ofbiz.core.entity.GenericValue, User) except the entity is a project GenericValue.
boolean hasPermission(int permissionsId, Project project, User user, boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(int permissionsId, Project project, ApplicationUser user, boolean issueCreation)
Checks whether the specified user has a specified permission within the context of a specified project.
boolean hasPermission(int permissionsId, Issue issue, User user)
Checks to see if this user has permission to see the specified issue.
boolean hasPermission(int permissionsId, Issue issue, ApplicationUser user)
Checks to see if this user has permission to see the specified issue.
boolean hasPermission(ProjectPermissionKey permissionsKey, Issue issue, ApplicationUser user)
Checks to see if this user has permission to see the specified issue.
boolean hasPermission(ProjectPermissionKey permissionsKey, Project project, User user, boolean issueCreation)
[Expand]
Inherited Methods
From class com.atlassian.jira.security.DefaultPermissionManager
From class java.lang.Object
From interface com.atlassian.jira.security.PermissionManager

Public Constructors

public WorkflowBasedPermissionManager (WorkflowPermissionFactory workflowPermissionFactory, PermissionContextFactory permissionContextFactory, ProjectPermissionTypesManager projectPermissionTypesManager)

Public Methods

public boolean hasPermission (int permissionId, GenericValue projectOrIssue, User user)

Checks to see if this has permission to see the specified entity
Check Permissions scheme(s) if the entity is project
Check Permissions scheme(s) and issue level security scheme(s) if the entity is an issue

Parameters
permissionId Not a global permission
projectOrIssue not null must be Project or Issue
user User object, possibly null if JIRA is accessed anonymously
Returns
  • True if there are sufficient rights to access the entity supplied

public boolean hasPermission (ProjectPermissionKey permissionsKey, Project project, User user)

public boolean hasPermission (ProjectPermissionKey permissionKey, Issue issue, User user)

public boolean hasPermission (int permissionsId, Project project, User user)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (ProjectPermissionKey permissionsKey, GenericValue entity, User user, boolean issueCreation)

public boolean hasPermission (int permissionsId, Project project, ApplicationUser user)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (ProjectPermissionKey permissionKey, GenericValue projectOrIssue, User user)

public boolean hasPermission (ProjectPermissionKey permissionsKey, Project project, ApplicationUser user, boolean issueCreation)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsKey A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
issueCreation Whether this permission is being checked during issue creation
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (ProjectPermissionKey permissionsKey, Project project, ApplicationUser user)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsKey A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (int permissionId, GenericValue entity, User user, boolean issueCreation)

Does the same as hasPermission(int, org.ofbiz.core.entity.GenericValue, User) except the entity is a project GenericValue.

Parameters
permissionId Not a global permission
entity Not null.
user User object, possibly null if JIRA is accessed anonymously
issueCreation Whether this permission is being checked during issue creation
Returns
  • True if there are sufficient rights to access the entity supplied

public boolean hasPermission (int permissionsId, Project project, User user, boolean issueCreation)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
issueCreation Whether this permission is being checked during issue creation
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (int permissionsId, Project project, ApplicationUser user, boolean issueCreation)

Checks whether the specified user has a specified permission within the context of a specified project.

Parameters
permissionsId A non-global permission, i.e. a permission that is granted via a project context
project The project that is the context of the permission check.
user The person to perform the permission check for
issueCreation Whether this permission is being checked during issue creation
Returns
  • true if the user has the specified permission in the context of the supplied project

public boolean hasPermission (int permissionsId, Issue issue, User user)

Checks to see if this user has permission to see the specified issue.

Note that if the issue's generic value is null, it is assumed that the issue is currently being created, and so the permission check call is deferred to the issue's project object, with the issueCreation flag set to true. See JRA-14788 for more info.

Parameters
permissionsId Not a global permission
issue The Issue (cannot be null)
user User object, possibly null if JIRA is accessed anonymously
Returns
  • True if there are sufficient rights to access the entity supplied

public boolean hasPermission (int permissionsId, Issue issue, ApplicationUser user)

Checks to see if this user has permission to see the specified issue.

Note that if the issue's generic value is null, it is assumed that the issue is currently being created, and so the permission check call is deferred to the issue's project object, with the issueCreation flag set to true. See JRA-14788 for more info.

Parameters
permissionsId Not a global permission
issue The Issue (cannot be null)
user User object, possibly null if JIRA is accessed anonymously
Returns
  • True if there are sufficient rights to access the entity supplied

public boolean hasPermission (ProjectPermissionKey permissionsKey, Issue issue, ApplicationUser user)

Checks to see if this user has permission to see the specified issue.

Note that if the issue's generic value is null, it is assumed that the issue is currently being created, and so the permission check call is deferred to the issue's project object, with the issueCreation flag set to true. See JRA-14788 for more info.

Parameters
permissionsKey Not a global permission key
issue The Issue (cannot be null)
user User object, possibly null if JIRA is accessed anonymously
Returns
  • True if there are sufficient rights to access the entity supplied

public boolean hasPermission (ProjectPermissionKey permissionsKey, Project project, User user, boolean issueCreation)