Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Check whether a given user has permission to perform an operation on an issue. This can include workflow properties if required.

Check the permission scheme

boolean hasPermission(String permission, Issue issue, ApplicationUser user) returns true if the permission short name is valid and the user has the permission according to the project permission scheme.

Check the permission scheme and workflow properties

boolean hasWorkflowPermission(String permission, Issue issue, ApplicationUser user) returns true if the permission short name is valid and the user has the permission according to the project permission scheme and any workflow properties for the current workflow status.

Permission short names

The first parameter of the two permission methods takes the “short name” of a project permission. For example, “browse” is the short name of the BROWSE_PROJECTS permission.

Expand
titleClick here to see all short names and the project permissions they correspond to.

Short name

Project permission

project

ADMINISTER_PROJECTS

browse

BROWSE_PROJECTS

viewversioncontrol

VIEW_DEV_TOOLS

viewworkflowreadonly

VIEW_READONLY_WORKFLOW

create

CREATE_ISSUES

edit

EDIT_ISSUES

transition

TRANSITION_ISSUES

scheduleissue

SCHEDULE_ISSUES

move

MOVE_ISSUES

assignable

ASSIGNABLE_USER

assign

ASSIGN_ISSUES

resolve

RESOLVE_ISSUES

close

CLOSE_ISSUES

modifyreporter

MODIFY_REPORTER

delete

DELETE_ISSUES

link

LINK_ISSUES

setsecurity

SET_ISSUE_SECURITY

viewvotersandwatchers

VIEW_VOTERS_AND_WATCHERS

managewatcherlist

MANAGE_WATCHERS

commenteditall

EDIT_ALL_COMMENTS

commenteditown

EDIT_OWN_COMMENTS

commentdeleteall

DELETE_ALL_COMMENTS

commentdeleteown

DELETE_OWN_COMMENTS

comment

ADD_COMMENTS

attachdeleteall

DELETE_ALL_ATTACHMENTS

attachdeleteown

DELETE_OWN_ATTACHMENTS

attach

CREATE_ATTACHMENTS

worklogeditown

EDIT_OWN_WORKLOGS

worklogeditall

EDIT_ALL_WORKLOGS

worklogdeleteown

DELETE_OWN_WORKLOGS

worklogdeleteall

DELETE_ALL_WORKLOGS

work

WORK_ON_ISSUES

Example script

Code Block
languagejs
var user = userManager.getUserByName("admin");
if (jemhUtils.hasPermission("resolve", relatedIssue, user)) {
    print("checking permission scheme, user has resolve issue permission");
}
Code Block
languagejs
var user = userManager.getUserByName("admin");
if (jemhUtils.hasWorkflowPermission("comment", relatedIssue, user)) {
    print("checking permissions scheme AND workflow properties, user has comment permission");
}

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@22b016
showSpacefalse
sortmodified
typepage
reversetrue
labelsjemh jemh-server script-field-processor scripting permissions
cqllabel in ( "jemh" , "permissions" , "jemh-server" , "script-field-processor" , "scripting" ) and type = "page" and space = "JEMH"

...