i have a interesting case where i try to hide a Field based on Group membership.
It is very important that the field is only shown to People of a certain group over a number of different Projects but it must be hidden to everyone else no matter project member ship or not. Only the Global group membership counts.
So far i tried Scriptrunner Behaviors and they work fine to hide the field if the current user is not in the defined Group BUT if i search for the Issue and use the Field in my columns i easily get access to the field and view its values.
So i tried the Script runner custom Fields and there i can set the value based on group member ship. So the value is only shown if i'm a member of the configured group.
So now i need to fuse both fields functions. The field should be filled by conventional methods but only show the value if the Group membership is correct and checked via the Script in the scripted field.
Is it possible to set the value in the Custom Scriptrunner field and keep it there and just toggle if its view able or not?
Here is my WIP:
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def isinGroup = ComponentAccessor.getUserUtil().getGroupNamesForUser(user.name).contains("Can_View_Field")
Or do i need to fill the field each time the Field is shown/called?
I might have wrong but I think for doing this you should use Scriptrunner behaviour instead of scripted field.
You should be able to select you fields you need to hide and provide the condition in order to make them visible if user is in the right group.
The following link is not exactly the same case but I think you can build up arround to get this working : behaviour case
One other solution (but it is waaaaaay worse) can be to add an AJS into the description of each field to hide them conditionally but I do not recommand this.
Have fun !
thanks for the hint!
The problem with Behaviors here is they only count in specific screens or view.
As soon as somebody searches for the Issues they can get the stored values anyway.
The Globally is an Important part here.
As we generate the Value from a outside source in this case, i could just put the logic of filling the field inside the:
return "Logic to fill the field from external source each time the field gets viewed"
But i think this will be highly unpractical and inperfomant.
Hi Everyone, In this tutorial, we will show you how you can monitor an SLA, and send notifications before or after the SLA has been breached. SLA Threshold Trigger The SLA t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events