Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict field edit to certain users

Sarath October 2, 2019

I'm trying to restrict custom field "Story Points" editing to few and should be read-only to all other users. 

For this, under behaviors, created a behavior >> mapped to required project >> under field selected "Story Points" >> and added exception to be written for few users.

By doing so I was able to make it read-only for all users except the users I mentioned in the condition. But the inline editing is still accessible to all the users. How to fix that? 

Can we use script conditions for each transition? If so, can you help in improving the script? 

def storypoints = getFieldById("Story Points")

if(currentUser.name("username")){
getFieldById("Story Points").setReadOnly(false)
}else{
getFieldById("Story Points").setReadOnly(true)
}

1 answer

0 votes
Sebastian Krzewiński
Community Champion
October 2, 2019

Hi @Sarath 

 

Check this:

Screenshot 2019-10-02 at 23.08.55.png

 

In my example I used summary field but you can change it to Story Points.

I marked field as read only and set negative condition wich allows users from group jira-administrators to edit summary field.

 

I hope that this will help you :)

 

Regards,

Seba

Sarath October 2, 2019

Hi @Sebastian Krzewiński , thanks for the response.

In this context what was your screen configuration? Does the field summary included in the edit screen? I think screen config. is overwriting the behavior setting.

 

This is my setting. What's happening is, it is read-only for all the users except the one I mentioned in the condition, only in the edit screen. Still inline editing is enabled for all the users.

behavior.PNG

Sebastian Krzewiński
Community Champion
October 3, 2019

Hi @Sarath 

 

My configuration block summary field on edit screen.

Behaviours works only on create and edit screens so you can't achieve described action (block inline edit on view screen).

Like Sarath likes this
Marc Minten (EVS)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2019

I had same issue.

I think it is linked to your ScriptRunner version ?

When trying to edit a field that is linked to a Behavior, the Edit form should come up, you shouldn't be able to do inline edits on such fields (see Scriptrunner Behavior doc).

Unfortunately it seems there were some versions of Scriptrunner with a bug : inline editing was allowed even for Behavior linked fields....

Sarath October 4, 2019

Hi @Marc Minten (EVS) the current version we're using is 5.59. Do you know if it is the version problem or just the script runner limitation on not able to to get impact on inline editing?

Marc Minten (EVS)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2019

We are running 5.5.9 and everything is running fine. We upgraded (Adaptavist support info) to overcome the in-line edit issue.

I think you best contact Adaptavist support...

Like Sarath likes this
Sarath October 7, 2019

sure will do. thank you @Marc Minten (EVS) 

Suggest an answer

Log in or Sign up to answer