Hi,
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:
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def isinGroup = ComponentAccessor.getUserUtil().getGroupNamesForUser(user.name).contains("Can_View_Field")
if(isinGroup)
{
return "ValueSetBefore/SavedValue"
}
else
{
return "REDACTED"
}
Or do i need to fill the field each time the Field is shown/called?