Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable permissions on moving a JIRA ticket (transitions API) across my team's board?

Austin Serif
October 16, 2023

One month ago I wrote a Github Actions Workflow that 1. Finds any JIRA issue numbers in a merged pull request, and 2. Uses the JIRA rest API to move those tickets into a target repo/environment (in this case it is Staging and Production). 

Here is the API call portion of my script:

```

- name: Send HTTP Request
run: |
str="${{ github.event.pull_request.body }} ${{ github.event.pull_request.title}} ${{ steps.get_head_commit_message.outputs.head-commit-message }}"
echo $str

jira_ids=$(echo "$str" | grep -o "[A-Z]*-[0-9]*")
echo $jira_ids

# Convert string of JIRA ids to array
jira_ids_arr=($jira_ids)

staging_deployed="2"
production_deployed="31"


if [[ ${{ github.ref }} == "staging" ]]
then
env=$staging_deployed
elif [[ ${{ github.ref }} == "main" ]]
then
env=$production_deployed
else
env="1"
fi

# Print each JIRA id
for id in "${jira_ids_arr[@]}"; do

curl \
-u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }} \
-X POST \
--data '{"transition":{"id":'$env'}}' \
-H "Content-Type: application/json" \
${{ secrets.JIRA_BASE_URL }}/rest/api/2/issue/$id/transitions
done

```

It worked for a week or two, and then seemingly out of nowhere I was presented with the following error: 

```
{"errorMessages":["Can't move (SCRUM-27). You might not have permission, or the issue is missing required information. If you keep having this problem, contact your Jira Administrator."],"errors":{}}

```

I've tried:
1. Checking that the target transition ids are correct 

2. Updating the API key several times 

3. Confirming that my email (Org Admin) and all other keys/secrets are correct and properly stored/declared in github's secrets manager

 

During the time between when it worked and it started failing, the only change to my JIRA organization (which uses the Free tier) was that I added two new users.

 

Any help would be greatly appreciated, as it took me a while to get the script working in the first place.

1 answer

0 votes
Nader Nassif
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 Champions.
October 30, 2018

Hi Kraig,

You should be able to limit a user to only one schema. To do this create a new user and then add only this user to a special group. 

In this screenshot I am showing a small demonstration of how I achieve this result in latest Insight (5.7.2) 

Screenshot 2018-10-30 at 11.25.11.png

So only user John Smith will be able to access this schema since he's the only user in managers, dev, and users Roles and only his group (jira-software-users) is added to the user groups role. I have added my admin user (jira) to the schema managers to be able to login and edit the schema if I want to.

Now When I login with this user I can only see the allowed Schema FLY

Screenshot 2018-10-30 at 11.27.13.png

With my admin user I can see more schemas

Screenshot 2018-10-30 at 11.25.37.png

Please plot the Roles on this base and it should deliver the result you are looking for.

 

Cheers!

Nader

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events