How do I remove all Jira accounts that never logged in?

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2012

How do I remove all Jira accounts that never logged in?

DB Solution acceptable, if it works with postgresql :D

2 answers

0 votes
Nagarguna Reddy September 16, 2012

Adminstration --> Users --> Check Login Details column

If the count of login details column is zero, user can be deleted by using the "Delete" option available in the "Operations" column

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 16, 2012

Er, see the discussion above...

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2012

Try something like this:

select * from cwd_user where ID not in (select user_id from cwd_user_attributes where attribute_name = 'login.lastLoginMillis')

Never tried it myself but this should work because JIRA records last logged in time.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2012

Argh! No!

You could end up with swathes of completely broken projects if you do this. Jira can fail spectacularly if users are Report or Assignee on issues and you go and pull the users account out, and you'll get some really ugly problems with watchers, voters and other things too.

Note that it does NOT matter if they've never logged in - that does NOT stop them being used as assignee, reporter, watcher, user picker fields, groups or roles.

By all means use the SQL to find them, but do NOT delete them in the database. Use the API - via the UI or plugins, or (probably your best option) the Jira Command Line Interface (I'm pretty sure that does user deletes)

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2012

I agree. Find them, don't delete them yet!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 14, 2012

Oops, that looks like I was telling off Jobin, I didn't mean that at all! Just didn't want to let you run off and use SQL to update a Jira database.

Sorry Jobin!

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2012

hehe..No worries. I have seen that angry face before, when talking about database changes ;)

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2012

Use SQL to get the accounts and export the result as CSV. After this run Jira CLI with action removeUserFromCSV

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2012

Sorin, I guess Nic's point is that these accounts might be used somewhere even if they are not logged in themselves. Like someone might have assigned an issue to one of them.

If you delete the account, it will break such issues.

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2012

Not quite, as the CLI will remove accounts only if they do not have issues attached to them (owned or created by)

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2012

Oh really? I didnt know that!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 16, 2012

The CLI goes in via the API and respects all the permissions and caveats in there - the delete user call does the same as someone clicking "delete" - it runs off and checks that the user isn't assignee or reporter on anything before it proceeds.

Suggest an answer

Log in or Sign up to answer