hasPermission
Description
Checks if a user has the specified permission.
Parameters
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 routine also verifies the issue security level. If the specified user cannot see the issue because his security level does not allow it, the routine 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
Peacock