Issue type : Bug and Defect , should access to create form only to reader roles .
Any one can help on this groovy scripting : If this is the solution ,Providing scripts will help me on this part .
I have refereed script runner documentation as well . As im fresher to this topic its hard for me to implement on emergency . And also please provide on any help line mail for script runner scripts to reach adaptavist on getting help from scripts ?
Or
Any default jira settings to implement this ? or Plugin other that groovy scripts ?
Thanks for help !
Hi @mahavishnu ,
As workaround You can create separate workflow for types (Bug and Defect). And then add 'validator' of the permission to create transition in new workflow.
B.R.
Yes, this is a good option as well, and role based validation is also supported by the built-in scripts (simple scripted validator) of the script runner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
i have tried with this script
import com.atlassian.jira.bc.projectroles.ProjectRoleService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager;
import com.atlassian.jira.security.roles.ProjectRole;
import com.atlassian.jira.security.roles.ProjectRoleActors;
import com.atlassian.jira.security.roles.ProjectRoleManager;
import com.atlassian.jira.security.roles.RoleActor;
def project = issue.getProjectObject();
log.debug( project.getLeadUserKey());
String role="Reader"
ProjectManager projectManager = ComponentAccessor.getProjectManager();
ProjectRoleService projectRoleService = (ProjectRoleService) ComponentAccessor.getComponentOfType(ProjectRoleService.class);
ProjectRoleManager projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class);
final Collection<ProjectRole> projectRoles = projectRoleManager.getProjectRoles();
def roles=projectRoleManager.getProjectRoles(currentUser, project);
log.debug(""+roles)
for (ProjectRole pr : roles) {
if ((pr.getName().toUpperCase().equals(role.toUpperCase())) && issue.issueType.name == "Bug") {
return false;
}
}
return true
Still other roles can able to create .
Thanks in advance . Help required
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @mahavishnu ,
I suppose code return true in any case. Also are You sure that should return false, maybe need inverse?
Try next:
def result = false // sure that should return false, maybe need inverse?
if (issue.issueType.name == "Bug"){
if (roles.find{ it.getName().toUpperCase().equals(role.toUpperCase()) } ){
result = true
}
}
return result
B.R.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.