Community moderators have prevented the ability to post new answers.
Amazing macro, just know this macro existed.
Thanks for sharing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of Confluence you using ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you try to replace the 30th line of the above macro with the below line
#if (!$loginManager.getLoginInfo($user.name).lastSuccessfulLoginDate)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does the macro work after doing the above changes , most probably it will work because for jira 3.5 getLoginInfo() requires string as a argument .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is there any difference in the output after editing the macro ? or its the same ?
even replace $user with $user.name in the else clause
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great work, Mizan!
Now it displays all the last login info.
The results are very strange for us: from 1995 users 1120 never logged in. Can this macro fail? I mean for example an upgrade happened in the meantime and does it register the data before upgrade or server restart?
Thanks again! Nice macro!
Rumi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The macro is correct as it has helped others , its written by Andrew Frayling . I dont think the upgrade has affected your output .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad people are finding the macro useful, credit to Remo Siegwart though for his answer to this question.
I doubt an upgrade or restart would affect the data, but it might be affected if the user repository changes. It uses standard API calls and I can see how the data may potentially be reset if you did something like remove a user repository and configure Confluence to use a different one as the old data may not exist, or the API call may not look for it. I've never tested it against that set of circumstances though.
Andrew.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
have you upgraded your Confluence ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, we already upgraded on friday to version 4.2.
The macro worked on friday, however it was very long time to load. Today it gets timepot everytime we refresh: after 4-5 minutes of loading.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thats a strange behavior , you should try the macro provided in this blog instead of the one which we modified for ver 3.5 .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I replaced the code, but it's still veryslow and timeout. And I fear that whenever I run this macro, the whole Confluence is very slow. Can it be? Many of my customers complained today that Confluence is very slow.
Can it be this slowly loading because of the 2000 users?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This might be because of the number of users and a nested if-else inside the macro , you can try the query provided by Septa
SELECT u.user_name, u.first_name, u.last_name, u.created_date FROM cwd_user u JOIN logininfo l ON u.user_name=l.username WHERE l.successdate > '2011-12-31';
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No they are needed , going with the sql will be a better option since you have 2000 users (and performance issues when you use this macro) , did you try the sql after upgrading to 4.2 ?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mizan, hi Septa,
the macro works great, only backlash that it's a bit slow due to the 2000 users.
I would like to ask you what about the Last login macro/feature on 4.2 Confluence version? We upgrade the Confluence this weekend (I just learned the info), so from sunday we will use 4.2.
Our developer colleague said that the macro won't work on the upgraded version. But you suggested a feature first which was for 4+ version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes you can !
Here is the query for users that login after specific date. Please noted that the date is using epoch. You can convert it here
SELECT u.user_name, u.first_name, u.last_name, d.directory_name, u.created_date FROM cwd_user u JOIN cwd_user_attribute l ON u.id=l.user_id JOIN cwd_directory d ON u.directory_id=d.id WHERE l.attribute_value > '1338422400' AND l.attribute_name='lastAuthenticated';
Here is the query for user that never login into Confluence
SELECT u.user_name, u.first_name, u.last_name, d.directory_name, u.created_date FROM cwd_user u JOIN cwd_directory d ON u.directory_id=d.id WHERE NOT EXISTS (SELECT a.user_id FROM cwd_user_attribute a WHERE u.id = a.user_id);
Hope it helps.
Cheers,
Septa Cahyadiputra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does this helps? Let me know if you need anything
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just want to inform you that I add directory_name value to avoid confusion as there is a possiblity that the user that never try to log-in are registered under a different directory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe this is why I got all the users as result?
We use common user management in Jira and Confluence. We create the user account in Jira which synchronize in every hour to Confluence.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems to be the case. I have confirmed again to ensure that the given query is valid. The latest query that provided the directory name would give you a much better idea on the origin of the users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rumi,
Judging from your question I assume you would like to know how many failed login attemp recorded. You could do this by two method, from database
SELECT u.user_name, a.attribute_value as FailedLogin FROM cwd_user_attribute a join cwd_user u ON a.user_id=u.id WHERE attribute_name='invalidPasswordAttempts';
This will return the username and how many failed login attempt registered on the database.
It also possible to get it using REST end point as describe here, you might want to double check the parameter but I think it should be the same with Confluence.
Hope it helps.
Cheers,
Septa Cahyadiputra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Septa,
no, in our case we would like to remove those users that never had logged into Confluence. So we need the list those users whose login count=zero.
Can you suggest?
Many thanks,
Rumi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even though you already got your answer as I believe using the macro is much easier, just want to add couple of SQL that might help. Here is to get the list of users that never authenticate agains Confluence:
SELECT u.user_name, u.first_name, u.last_name, u.created_date FROM cwd_user u WHERE NOT EXISTS (SELECT a.username FROM logininfo a WHERE u.user_name = a.username);
Here is the SQL query to get the list of user that never successfully login after a specific date The
SELECT u.user_name, u.first_name, u.last_name, u.created_date FROM cwd_user u JOIN logininfo l ON u.user_name=l.username WHERE l.successdate > '2011-12-31';
above query will get you the list of users that last successful login is 31st of December 2011.
Hope it helps.
Cheers,
Septa Cahyadiputra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, that means you are not on Confluence 4.x yet. May I know which version of Confluence you are on?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.