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
Hi @Marco Barbaro ,
Once you have linked the issue security scheme to the project, you can indeed use the following scritrunner postfunction :
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
Then use this post function :
Only users in the group "BAL" will be able to view the issue :
Antoine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make sure the issue security scheme is linked to your project :
If this is not the case, go to the project configuration and click issues :
Then you should be able to see the security level on the issue.
Antoine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly, you have figured it out, glad to help. :)
Please consider accepting the answer if you are satisfied with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.