Hi
Just wondering the correct way to get an ApplicationUser to be used within a service e.g
UserManager.getUserByName("User")
Hope someone can help
Thanks
Tyler
If you want to get a user by name then you can use:
def user = ComponentAccessor.getUserManager().getUserByName("user name")
Hello @Tyler Brown-Jones
Depends on your case.
To get current user you can use
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
I'm trying to get a user within the Jira user manager as it is running as a service within Jira, Not running as a LoggedInUser.
I previously used this way within my Script Listener and understand how it works. I also tried using it within my service and it didn't like it.
Many thanks for the response though!
import com.atlassian.jira.user.util.UserManager
Is this the correct import for this?
Thanks Alexey, i will also respond to the other request i made explaining my reworked service code and what was wrong with it for future reference.
Appreciate the support you have provided me the past couple of days!
You should add
import com.atlassian.jira.component.ComponentAccessor
It looks like you're new here. Sign in or register to get started.