Older versions of Jira how do you set logged in user?

I'm trying to make my plugin that is compatible with versions 4.4 to 5.0. I'm trying to get it available down to 4.2. I noticed that the following method is not available:

getJiraAuthenticationContext().setLoggedInUser(user);

Any ideas how you do this? I need to log a user in before I can automate the creation of an issue with that user being the assignee.

1 answer

0 vote

You will need to create a different version of the plugin. JIRA 4.2 uses OSUser and you will have to use setUser method.

http://docs.atlassian.com/software/jira/docs/api/4.2/com/atlassian/jira/security/JiraAuthenticationContext.html#setUser%28com.opensymphony.user.User%29

In JIRA5, this method is not available.

So, the top is how i did it in version 4.5+ Below it is how it be done in earlier versions.

		ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user);//log user in
		user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();//grab reference to the logged in user


user = compManager.getUserUtil().getUser((String) issueData.get(ASSIGNEE_FIELD));//grab user
		compManager.getJiraAuthenticationContext().setUser(user);//log user in


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

184 views 0 4
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