hasPermission

hasPermission

 

Syntax

hasPermission(permissionId, user[, issueKey])

Package

 

Alias

 

Pkg Usage

 

Description

Checks if a user has the specified permission.

Parameters

Parameter name

Type

Required

Description

Parameter name

Type

Required

Description

permissionId

Number

Yes

Permission ID.

user

String

Yes

Username or userkey to check the permission for.

issueKey

String

No

Issue key. Only required for non-global permissions.

Return Type

Boolean

Returns "true" if the user has the specified permission or "false" otherwise.

Examples

Example 1

for(string user in usersInGroups({"QA-Testers"})){ if(hasPermission(17, user, key)){ assignee = user; return; } }

Result: The issue will be assigned to one of the testers who have the permission to be assigned issues on the current project.

Example 2

include "permissions.incl"; // assuming the file is in the default programs folder for(string user in usersInGroups({"QA-Testers"})){ if(hasPermission(ASSIGNABLE_USER, user, key)){ assignee = user; return; } }

This function also verifies the issue security level. If the specified user cannot see the issue because his security level does not allow it, the function will return "false" for the project permissions even if the user does have the specified privilege. This happens because the issue security comes first and will prohibit the user from taking actions that are otherwise allowed by the permission scheme.
The look-up is first made after the userkey, then after the username.

See also

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.