It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

bulk delete for unsynced users

Lutz_Faber Community Leader Feb 06, 2019

Starting from Confluence 6.13, admins can delete users that are unsynced from Confluence. Unsynced users are users that are not synced any more when an external user directory is being synchronized. This could be because the user has been removed from the external directory or it is because the user directory filters no longer include that user etc.

While this feature is useful, the current implementation only allows the deletion of these users individually and there is no option to perform bulk delete. Having the bulk delete feature would greatly help.

Does anyone have a set of scripts, which do such a bulk removing

There exists a feature request for that feature and it requires more voting for.

Best regards,

Lutz

2 answers

Had to deal with that just right now on our instances - after giving the list (max out the pagesize to 100) a rough scan if I am sure they should be deleted and then opened the Java Script console to run the following Javascript

AJS.$('#user-search #browse-user-table a:not(.confluence-userlink)').each(
function (ie) {var id = $(e).attr('href').split('=')[1];    
AJS.$.post('/admin/users/removeunsynceduser-confirm.action',
userKey: id'atl_token': AJS.Meta.get('atl-token') }, 
function () { console.info('Deleted ' + id) })
})

This uses the HTML DOM on the page to select the userKeys and makes AJAX posts to remove the users. Instead of having to click 900 times for 300 users and wait for 600 page loads I just refresh the page 3 times and run the script 3 times and all the users are deleted.

A word of warning though: these users never authored anything in Confluence and deleting them is very simple. That might be different for your environment.

Still you can reduce the page size to fine tune or change the script to wait for completion (then you would need to track progress) or simply add a delay.

Lutz_Faber Community Leader Oct 15, 2019

Hello Christoffer,

if i understand Your posting correct, Your script will NOT

  • permanently replace their username with a randomised alias, wherever it appears.

or what do You mean with

"these users never authored anything Confluence"

Best regards from just around the corner in Schloßstraße,

Lutz

Well, see above answer - the community software is doing strange things ...

Thank you for your javascript. Worked perfectly. 

Hi Christoffer

I try use your script, but see error: batch.js?healthcheck-resources=true&hostenabled=true&locale=en-GB:392 POST http://ip_addr/admin/users/removeunsynceduser-confirm.action 404 (Not Found)

Why? =(

0 votes

Hello there Lutz! Is this the Suggestion that you mentioned:

CONFSERVER-57857 | Provide the functionality to perform bulk delete for unsynced users

The user deletion process can be quite taxing for your instance. As of today, there is no built-in feature or Atlassian Made script that takes care of start the deletion processes automatically. Each deletion process should be started individually and will only start after the previous one has ended.

However, there are some plugins that claim being capable of bulk user deletion, such as:

User Management for Confluence

Further, you could vote and watch this suggestion. Voting increases the visibility of this report and watching will keep you up to date with anything new there.

Let us know your thoughts Lutz!

Lutz_Faber Community Leader Feb 07, 2019

Hello Diego,

Yes that is the suggestion. If You have around 1500 Students per Year, who are unsynced, You don't want to remove them manually.

The Plugin You mentioned does not work on unsynced users.

Do You know a plugin, which do so.

I have voted already.

Best regards, Lutz

Hi Lutz,

the world is small. I meant that for me and my instance this operation is pretty light-weight, because the selects/deletes the database has to perform will not find anything to change (other than the user record itself). I did not see any performance hits that Diego mentioned, if your users did in fact create spaces, author pages, upload attachments etc. that might have a bigger impact (and your instance might also be much bigger).

For me the script running with a page size of 50 worked fine without causing any problems. The code that is run on the server is the same as if you click through every single user - the script is just triggering that code without all the clicking and waiting ...

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

327 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you