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")
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should add
import com.atlassian.jira.component.ComponentAccessor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Tyler Brown-Jones
Depends on your case.
To get current user you can use
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.