javajirajira-pluginopensymphony

Get the current user inside jira workflow validator


I want to create a workflow validator which will not allow the reporter of the issue to execute certain steps from the workflow. For that purpose somehow I have to get the User object or the user id of the user executing the action. How can I do that?


Solution

  • inject the JiraAuthenticationContext And then call jiraAuthenticationContext.getLoggedInUser();

    you can find the documentation about the JiraAuthenticationContext here: https://docs.atlassian.com/jira/5.0.1/com/atlassian/jira/security/JiraAuthenticationContext.html