JIRA Service user

Tom Lister August 17, 2014

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
Answer accepted
Pedro Cora
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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.

;)

1 vote
Tom Lister August 18, 2014

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);

Alexey_Rjeutski__Polontech_
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 Leaders.
August 18, 2014

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
TAGS
AUG Leaders

Atlassian Community Events