How to make a issue status not visible to users

Marco Barbaro April 23, 2019

2019-04-23 09_10_07-Update Workflow Function Parameters - Internet Explorer.png

 

Hi,

    a colleague asked me to create a workflow in which there is an initial status which should be visible only to her, not to the other users defined in the project workflow.

So I searched for a solution and I finally read some KBs speaking about post functions script working with security permissions.

We have script runner as plugin, so I defined a post function after the initial "issue create" as suggested in one post (you can see the code in the attachment), in order to make the initial state only visible to users belonging to a Group ("analisti" is the name of the Group), but this is not working as expected.

Infact a user which should not be able to see the issues created, is instead able to see them.

Where am I wrong?

Have you any suggestions to share with me?

Thanks in advance.

Best regards

Marco

1 answer

1 accepted

0 votes
Answer accepted
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2019

Hi @Marco Barbaro ,

Once you have linked the issue security scheme to the project, you can indeed use the following scritrunner postfunction : 

image.png

image.png

with this condition code : 

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.reporter?.name, 'analisti')

and select the appropriate issue security level. In the following transition you will have to set the security level to "all users" so they can see the issue again.

Antoine

Marco Barbaro April 23, 2019

Hi Antoine,

   perhaps I have mistaken something because I already did what you suggested but it is not working.

I have modified post function of "Create Issue" as suggested with your code, setting a issue security scheme where the users granted are the ones belonging to "analisti".

User "zanni" is not in "analisti" group but if I create an issue with another user belonging to "analisti", "zanni" is able to see the issue and comment it.

"zanni" is the project lead, so I modified project settings in order to make the "default assignee" unassigned, but this didn't modify the behaviour I'm describing.

 

What do you think about it?

We'd like to introduce "zanni" to the issue only after a status change, from the initial one I'm talking about to the next in the workflow...

 

Thanks again

Marco

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2019

In fact this has been confusing for myself as well. If I understood correctly when the issue is in the first status only users in "analisti" should be able to see the issue right ? In that case define the security level as follows (replace BAL with analisti)

image.pngThen use this post function : 

image.pngOnly users in the group "BAL" will be able to view the issue : 

image.png

Antoine.

Like Marco Barbaro likes this
Marco Barbaro April 23, 2019

Hi Antoine,

   you have understood my problem, thanks, but still got no working solution.

I'll attach a few screenshot.

I defined a issue security scheme as suggested, then modified "Create Issue" post function as your in screen, but "zanni" is still able to see new issues.

Please note that "analisti" group does not contain "zanni".

Where am I wrong?2019-04-23 11_30_06-Edit Issue Security Levels - Gruppo PAM JIRA.png2019-04-23 11_31_09-Update Workflow Function Parameters.png

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2019

Could you also attach screenshots of the security level configuration (Utenti Disi one), and confirm that the security level is correctly set on the issue after creation, just as on my previous screenshots ?

Thanks.

Marco Barbaro April 23, 2019

2019-04-23 14_40_32-Add User_Group_Project Role to Issue Security Level - Gruppo PAM JIRA.png

Marco Barbaro April 23, 2019

Hi,

cannot find in the issues the "security field".

Perhaps this is the missing point, isn't it?

Where do I enable it?

Thanks again

Marco

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2019

Make sure the issue security scheme is linked to your project : 

image.pngIf this is not the case, go to the project configuration and click issues : 

image.png

Then you should be able to see the security level on the issue.

Antoine

Like Marco Barbaro likes this
Marco Barbaro April 23, 2019

Hi Antoine,

   yes! This seems to do the trick I was missing.

So, I defined two security levels: one only for "analisti" group and a second for "anyone".

I added a post function pointing to the second security level to the transition which goes outside from the initial state.

This way the user "zanni" didn't see the issue after its creation :)

I'll do some other tests, but I think it works now.

Thanks again Antoine!!

Marco

Like Antoine Berry likes this
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2019

Exactly, you have figured it out, glad to help. :)

Please consider accepting the answer if you are satisfied with it.

Like Marco Barbaro likes this

Suggest an answer

Log in or Sign up to answer