Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Problem

Once in a while it happens that we want You can use Power Actions™ and the Issue Security Scheme to lock an issue , where by lock I mean and ensure that only the issue assignee of that issue can play with it. There's an open ticket about this with Atlassian, and Power Actions™ helps resolve it.

This example shows you how to do that by using Power Actions™ and the Issue Security Scheme.

Solution

The idea is to edit it.

Tip

Power Actions™ offers the possibility of an assignee locking an issue without needing to grant them Set Issue Security Level or Edit issue permission (only logging work or commenting on the issue).

Solution

To lock an issue, you must first create two actions: Lock and Unlock that only the assignee of the issue will see and a security level (Locked) that will only allow the assignee to see the issue. The actions are only visible to the issue assignee.

  • The Lock action will set sets the security level to Locked.

  • The Unlock action will set sets the security level back to none.

Now you're probably wondering "Why do i need Power Actions™ to do this? Why can't the user set the security level himself?". Well, there are a number of reasons for this; what if we don't want the assignee to have the "Set Issue Security Level" permission? Or what if we don't want them to be able to edit the issue at all, but only log work or comment on it? Even if they do have the "Set Issue Security Level", not having "Edit issue" permission will prevent them from locking the issue.

Create the security level

Create the security level

Now let's get working. First off, we must create the security level, which looks like this:

Image RemovedImage Added

Create the actions

Once we've done that, it's time to create the actions. We will create two actions Create the Lock and Unlock blitz actions.

Image RemovedImage Added

For the conditions, we will disable the Lock button Click Edit conditions. Enter the below scripts for each blitz action.
The Lock button is disabled if the security level is already Locked, and disable the . The Unlock button is disabled if the security level is empty. Of course, we will only show the buttons blank.

The buttons are only visible to the current assignee.

Lock button condition script
Code Block
number ENABLED = 1;
number DISABLED = 2;
number HIDDEN = 3;

if( assignee != currentUser()) {
 return HIDDEN;
}

if( securityLevel == "Locked" ){
 	return DISABLED;
}
return ENABLED;
Unlock button condition script
Code Block
number ENABLED = 1;
number DISABLED = 2;
number HIDDEN = 3;

if( assignee != currentUser()) {
 return HIDDEN;
}

if(isNull(securityLevel)) {
 	return DISABLED;
}
return ENABLED;

Now that we have the conditions, it's time to do the actual create the blitz action scripts.

For the Lock button we will , set the issue security to Locked and for . For the Unlock button we will , set it to none.

Lock button script
Code Block
securityLevel = "Locked";
Unlock button script
Code Block
 securityLevel = "";

Testing

That's it! Now let's test it.

Image RemovedImage Removed

NoteInstead of current assignee, we could Now you can test.

Image AddedImage Added
Info

You can set the value of a user picker as the allowed user

, and

instead of current assignee. Also, you can change the value of the custom field to the current user when locking an issue

, thus resolving a common problem exposed here: https://jira

.

atlassian.com/browse/JRA-6146

Table of Contents

Table of Contents