Hello,
I have two roles in Jira system (developers, testers). I want testers can only create/edit/view/delete bug issue type (other issue type i.e. user story they can view only). Is it possible in Jira v7.8? How can I set it up easily?
Thank you
Hi Martin,
I solved this issue using Script runner's behavior, used below code in initializer and it showed Issuetypes based on logged in user, you can validate user against project roles or even groups
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueTypeField = getFieldById(ISSUE_TYPE)
def availableIssueTypes = []
//use this def and if code to check project roles
/*def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
if ("Testers" in remoteUsersRoles)
{
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task", "Experiment"] })
}
*/
//use this def and if code to check groups
def remoteUsersRoles = ComponentAccessor.getGroupManager().isUserInGroup(user, "jira-administrators")
if (remoteUsersRoles) {
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task", "Experiment"] })
}
else {
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task"] })
}
issueTypeField.setFieldOptions(availableIssueTypes)
Hope this helps.
Regards,
Priyanka
Not the OP, but this was super helpful to us at Airbnb today! Thank you for sharing, saved us the time of figuring it out ourselves :)
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 Priyanka,
this was working fine,
My task is to restrict specific users in groups restricted from creating certain issue types
EX: STORY
for a specific PROJECT.
any suggestions or extension of the script ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
Glad to know its working for you, when you define the behaviour you can select specific project, it allows project and issuetype mapping. Try it out and let me know.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
done with that , works great.
just need a script from you as im not a good judge of scrips.
need to update EPIC end date with the end date of the STORY in the EPIC at the time of resolving.
( this should happen only if the story is the last in the epic)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
I think I missed your comment, I am able to do something similar with Tasks and sub tasks, that the parent task should be auto closed when last sub task is closed, this can be done using the combination of workflow transition and condition, let me know if you still need this, will try to tweak my current code and post.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your code work properly for Epic, Story or any standard issue type, but not for subtasks. Do you have any example of code for Subtasks?
Thanks,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
anyone know how to restrict a user from creating some issue type of the project in jira cloud??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martin Cerny
Welcome to the Community :)
Please check following links, may be it help you!
-https://confluence.atlassian.com/display/JIRA/Configuring+Issue-level+Security
-https://confluence.atlassian.com/display/JIRA/Setting+Security+on+an+Issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can restrict edit action to groups with workflow status properties.
Check this article:
https://www.j-tricks.com/tutorials/permissions-based-on-workflow-status
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Martin Cerny
This used for disable issue type. for this you can use this code in the Jython script
===========================================================
import com.atlassian.jira.component.ComponentAccessor
from com.atlassian.jira.component import ComponentAccessor
if issue.getIssueTypeObject().getName() == "Issue type name":
description = 'This issuetypes can no longer be created. Please use a different Issue Type.'
result = False
============================================================
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for tips. I am now able to restrict create action for ceratin issue type for not admin users (I not sure if the below works for specific user group, but it is fine for me now).
But how to restrict edit action? The process above cannot be applied. Any hint?
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.
As mentioned above, you can use Issue Security Schemes to prevent certain groups of users from viewing issues. You need to set Issue Security level on each issue.
This however doesn't prevent any users from creating issues. For this you could add a validator on the 'create' transition in the workflow, to check the user is in the required project role.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
Check it here
You can also use the script in a postfunction on Create transition. Script will check the user if it belongs to particular group or role and set the Issue Type values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, we can not control on basis of issue type in Jira. permission scheme will apply for all the issue type.
I don't think so this will be possible.
As reference documents were given by @Mark Markov which is related to issue security level but not the restricting to create/edit/delete issue in jira.
Issue security levels are created within issue security schemes and let you control which user or group of users can view an issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.