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
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:https://confluence.atlassian.com/display/JIRAKB/Retrieve+last+login+dates+for+users+from+the+database
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 = 'vzverev@phosagro.ru' order by CAST(cwd_user_attributes.attribute_value as bigint) asc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use this constructor: MockApplicationUser(String username) (https://developer.atlassian.com/static/javadoc/jira/reference/com/atlassian/jira/user/DelegatingApplicationUser.html). To get an userName use ApplicationUser.getKey() (https://developer.atlassian.com/static/javadoc/jira/reference/com/atlassian/jira/user/ApplicationUser.html).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.