Custom Issue Type Permission/Security

Elif Alverson November 11, 2015

Hello,

I have a custom issue type and trying to change the permissions to determine who can create JIRA Issues under that Issue type.  Is it possible?

How can I determine the security/permission levels on the workflows? All I see is Permissions/ Roles under the projects. Where can I change the security/permission level of a workflows?

Thank you!

3 answers

1 vote
Jeremy Gaudet
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

For the "Create" transition, you have to do it as a validator, as you can't add conditions to "Create".  This is a minor issue in that, depending on how they reached create, they could have filled in the whole form and not have a way to change the type when it gets rejected.  I still use it though, to keep everything except "Bug" and "Improvement" reserved for people in the Developer's Role:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.security.roles.ProjectRoleActors
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.project.version.Version
import com.opensymphony.workflow.InvalidInputException
import com.opensymphony.workflow.WorkflowContext
import org.apache.log4j.Category

def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction");
ProjectRoleManager projectRoleManager = ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class) as ProjectRoleManager


ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser();
ProjectRole devsRole = projectRoleManager.getProjectRole("Developers");
ProjectRoleActors devs = projectRoleManager.getProjectRoleActors(devsRole, issue.getProjectObject());
Boolean isDev = devs.contains(currentUser);
String issueType = issue.getIssueTypeObject().getName();


if (!isDev) {
	if (issueType != "Bug" && issueType != "Improvement") {
        invalidInputException = new InvalidInputException("You are not a member of this project's \"Developers\" role; the only issue types available to non-developers are \"Bug\" and \"Improvement\".");
    }
}

I pulled some irrelevant code, but hopefully it still works as-is.

1 vote
Jeff Louwerse
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

this thread has a couple of solutions.

https://answers.atlassian.com/questions/161095/restricting-issue-creation-of-certain-types-based-on-user-project-role-group

 

you can probably also set the properties of the transitions .. some documentation here. You probably need a workflow specific to that one issue type.

https://confluence.atlassian.com/jira/workflow-properties-189949.html

0 votes
Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2015

Hi Elif,

You can do both by adding conditions on your workflow transitions.

Suggest an answer

Log in or Sign up to answer