Check role

Hi. How correct check role?

I tried ctx.currentUser.hasRole('project-admin', ctx.issue.project) but in return false.

Comment actions Permalink
Official comment


You can check the actual role name on the Roles page. For example, the default Project Admin role looks like:
var hasRole = ctx.currentUser.hasRole('Project Admin', ctx.issue.project);
Would you please try this option?

Comment actions Permalink

Yes. With plain name it's work. But now depend on Language. And it's not good. I think better use key (project-admin)

Comment actions Permalink

Unfortunately, the key project-admin is unavailable for workflow API, so you need to use a name that corresponds to your language that is set in Global settings. 

But you should have no worries for those who have another language chosen for their profile as the role name will stay the same, so the workflow will work properly.


Please sign in to leave a comment.