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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

172 views 0 4
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