Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Issue assign validation

Dinesh V February 16, 2012

Hi,

I have a small validation requirement in jira. In our jira I am planning to bring a validation for below scenario

If the logged in user belongs to "ABC" user group and if the user is trying to assign a issue to him/herself it is not allowed. Same way if the user belongs to other groups, then the same operation is allowed.

Is this possible without writing a explicit plugin for that? If I want to write a plugin what is the plugin module type I have to use?

Please help me on this.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jozef Kotlár
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.
February 16, 2012

You should disable built-in action to assign issue in given project and use the workflow action instead with appropriate condition checking user group membership. For prototyping there are handy scripted conditions from Script Runner plugin.

0 votes
Dieter
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.
February 16, 2012
I can't imagine an out of the box solution here. It looks like you want to restrict the group permission type, something like "group without current user". Afaik there is no ready plugin type yet to define your own permission types. But you could look at permission-types.xml and take the implementation class for permission type "group" as a base for your implementation. Just use the inherited code and remove the current user from the list,
Dieter
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.
February 16, 2012
I'm afraid you can't package your solution in a plugin since it requires modification of permission-types.xml. The logic could be implemented in a component module plugin but as Atlassian's dangerous permission types it requires a change in permission-types. You also have to modify a jsp file which displays the permissions. Forgot the name right now but i can add it later if you are interested in this solution
Dinesh V February 16, 2012

Thanks for the reply. It would be great if I can add the solution you mentioned in the previous comment.

Dieter
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.
February 19, 2012

To create a modified "group without current user" permission type you should extend package com.atlassian.jira.security.type.GroupDropdown and overwrite the methods

public boolean hasPermission(GenericValue entity, String groupName, com.atlassian.crowd.embedded.api.User user, boolean issueCreation);

public Set<com.opensymphony.user.User> getUsers(PermissionContext ctx, String groupName);

Do it the following way for hasPermission (note this is not valid code, just to give you an idea where you must code something)

boolean hasPermission (...) {
  current_user=getCurrentUser()
  if (current_user.memberOf(groupName)) {
    return false;
  }
  return super.hasPermission(...)
}

Set getUsers(..) {
  current_user=getCurrentUser()
  result = super.getUsers(...);
  if (current_user.memberOf(groupName)) {
     result = new ArrayList(result)
     result.remove(current_user)
  }
  return result;
}

TAGS
AUG Leaders

Atlassian Community Events