Howto limit field editing to a few Workflow steps, project roles and groups

Mark Wenzel September 18, 2019

Hi all,

I tried to limit field edtiting for a particular field except for two or more workflow steps with different projectroles or groups. I tried this with ScriptRunner Plugin. But it seems that complex conditions are not possible with this plugin - or maybe i missed something. To show the goal, here is an example in pseudocode:

field = getFieldByName("CodeTags")
if (currentUser.isInProjectRole("Developer")
and issue.isInWorkflowStep("in Development")
or currentUser.isInGroup("ConfigurationManager")
and issue.isInWorkflowStep("create Build")) {
field.setEditingDisabled(false)
} else {
field.setEditingDisabled(true)
}

Hint: It is not an option to disable editing in the most of our workflow steps and use only transitions for editing.

Has anyone an idea or a hint to an other plugin which helps to reach the goal?

Thank you.

Mark

2 answers

1 accepted

1 vote
Answer accepted
Mark Wenzel September 20, 2019

I found the solution for my Problem: The role and group permissions are checked via workflow step properties:

jira.permission.edit.projectrole.1=10013

on one workflow step (you have to use the internal id and not the role name!) and

jira.permission.edit.group.1=ConfigurationManager

on the other one. So editing is restricted to the group or the defined role in both workflow steps. Since these group and project role are assigned to other workflow steps as well and editing should only happen on these two steps: The behaviour from ScriptRunner for JIRA will solve the problem:

In the behaviour I only reduce the editing permissions to the workflow steps. No need to define the project role or group in the behaviour

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2019

You can use Behaviours that is part of Scriptrunner to do this, that is what I use to limit who can edit certain fields based on project role and status/transition. See Field-level Permissions for more information. 

Here is an example of one of my restricted fields:

Behaviours.png

Mark Wenzel September 18, 2019

Thats the way I tried to use the plugin. But that only works if you have exact one workflow step and one project role or group. But if you have more than one step you cannot define an or clause for the other combination of role and step :-(

Mark Wenzel September 20, 2019

wrong position for answer :-(

Suggest an answer

Log in or Sign up to answer