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 votes
Accepted answer
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
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

304 views 0 1
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