JIRA Service user

Hi

I've been asked to build a service to automatically create issues.

I've found that services run as an anonymous user and I get the error "Anonymous users do not have permission to create issues in this project" when executing issueService.validateCreate(user, issueInputParameters);

How can I run the service as a user with permission to create issues?

Tom

2 answers

1 accepted

0 vote
Pedro Cora Atlassian Team Aug 17, 2014

You will need to use a valid username and password. JIRA does not have the concept of Service User, so you need to supply your code with valid credentials.

;)

thanks

a combination of the following has removed the user error

import com.atlassian.crowd.embedded.api.User;
User user = ComponentAccessor.getUserManager().getUserObject("admin");
componentManager.getJiraAuthenticationContext().setLoggedInUser(user);

Please use such approach only in services. There is potential security vulnerability if you use that kind of methodology for logged users in listeners for example. If the request is hanged - user will receive the administrative priviledge. Also don't forget to clear up user after execution - just in case.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

349 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you