Does JIRA API support user impersonation?

At the moment we use own tool that automatically saves working time of staff to Redmine, using User Impersonation

Does JIRA API allow to save spent time on behalf of other users?

2 answers

1 accepted

1 vote
Stephen Deutsch Community Champion Nov 11, 2016

The REST API does not directly support impersonation of users, but there is a plugin for that:

https://marketplace.atlassian.com/plugins/com.jirasudo.jira-sudo/server/overview

Please note that this would only work for JIRA Server.

0 vote

Which API?

For REST, then see Stephen's answer.

The Java API supports it, in the sense that you can write add-ons to do it.

How about when using scriptrunner and groovy within a custom rest endpoint?

 

import com.atlassian.jira.component.ComponentAccessor

def jiraAuthenticationContext = ComponentAccessor.getJiraAuthenticationContext()
def originalUser = jiraAuthenticationContext.getLoggedInUser()

def userManager = ComponentAccessor.getUserManager()
def adminUser = userManager.getUserByName("deployer")
assert adminUser // make sure an admin user called "deployer" exists in all instances

try {
    jiraAuthenticationContext.setLoggedInUser(adminUser)

    // make REST requests here
}
finally {
    jiraAuthenticationContext.setLoggedInUser(originalUser)
}

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...

86 views 0 5
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