Hey guys,

I'm trying to get a service running that automatically sets Jira users to inactive state after not logging in for a while. According to some examples, I can use the class "MockApplicationUser" (extends DelegatingApplicationUser) to achieve this. But, no matter what I try, I can't create an instance of this class. I'm not even able to import that type ("can not be resolved", also no auto suggestion). It's base class ("DelegatingApplicationUser") is no problem, I can import and create an object of it.
It seems as it where not part of the sdk at all, but it's described as a public class in the apidocs.

I tried to
* updated the atlassian-plugin-sdk from 5.0.13 to 6.2.2
* cleaned the maven installation and re-downloaded all the stuff
* refreshed the eclipse project (mvn eclipse:eclipse + refresh in eclipse)

Am I missing a dependency in my pom.xml? I've included jira-api, jira-core (and some others), shouldn't that be enough?

Any help is appreciated! I'll provide more information of course, if necessary.

Regards, Jan

1 answer

Try this code to make a loop ove all users:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.UserPropertyManager
import com.atlassian.jira.user.util.UserManager
UserManager userManager = ComponentAccessor.getUserManager();
UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager();
for(ApplicationUser appUser: userManager.getAllApplicationUsers() ){


I cold not find any api to get last interance date, the only solution - use SQL:

I would recommend to try ScriptRunner plugin to test scripts (free for JIRA6). This plugin allowes to run scripts from console with out creating a plugin. When you will have a working script you can conver it to a plugin.

Here is my SQL to get last logined users:declare @startDate datetime = '1970-1-1'; Select cwd_user.display_name as 'user name' -- , cwd_user_attributes.* , CAST( dateaDD(SECOND, CAST(cwd_user_attributes.attribute_value as bigint)/1000, @startDate ) as DATE) as 'last login date' from cwd_user join cwd_user_attributes on cwd_user.ID = cwd_user_attributes.user_id where cwd_user_attributes.attribute_name = 'login.lastLoginMillis' -- and cwd_user.email_address = '' order by CAST(cwd_user_attributes.attribute_value as bigint) asc

Hi, thanks for your reply. But querying the users is not the point, I need a way to set those users inactive using Java. This class "MockApplicationUser" I mentioned above would be suitable, but I can't use it somehow.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


161 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