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

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

DB Solution acceptable, if it works with postgresql :D

2 answers

0 votes

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.

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)

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

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!

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

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

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.

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

Oh really? I didnt know that!

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.

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

Er, see the discussion above...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

26,151 views 2 7
Join discussion

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