Hiding Attanchments

Bartosz Kaczmarczyk December 12, 2018

Hello,

I have a problem with attachments. I want to use hide UI elements in script fragments as a tool hide attachments from users specified on a custom field with exception to users group. Currently i have problems with combining both conditions.

Separately conditions works perfectly fine, but when I mix them, it not hide fields.

The groovy script looks like:

String uString = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Job Interviewer II CSD")?.getValue(issue);

String groupname = "jira-administrators"

ApplicationUser lUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

ApplicationUser iUser = ComponentAccessor.getUserManager().getUserByName(uString);

def isManager = ComponentAccessor.getGroupManager().isUserInGroup(lUser,groupname)

if(!iUser.equals(iUser)) return true

if(lUser.equals(iUser) && isManager) return true

 

Do You have any idea how to deal with this problem ?

1 answer

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2018

Dear @Bartosz Kaczmarczyk,

have you tried the field security plugin?

So long

Thomas

Bartosz Kaczmarczyk December 12, 2018

Hello @Thomas Deiler,

sadly i am not allowed to install any paid plugins, and free one don't provide hiding attachments

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2018

But you have groovy scripts plugin, or? 

Bartosz Kaczmarczyk December 13, 2018

Only scriptrunner.

Suggest an answer

Log in or Sign up to answer