Checking project permissions
Available from versions: 2.7.63 3.3.13
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.
Example script
var user = userManager.getUserByName("admin");
if (jemhUtils.hasPermission("resolve", relatedIssue, user)) {
print("checking permission scheme, user has resolve issue permission");
}
var user = userManager.getUserByName("admin");
if (jemhUtils.hasWorkflowPermission("comment", relatedIssue, user)) {
print("checking permissions scheme AND workflow properties, user has comment permission");
}