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

This widget could not be displayed.
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.

;)

This widget could not be displayed.

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 Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

508 views 3 18
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