How to disable users in bulk from confluence

HI All,

 

I have around 500 users who need to be deactivated from the confluence. Is there any query to run in DB to disable or is there any possible solution via Rest API.

 

can someone provide suggestion on this.

 

Thanks,

Vasantakumaar

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Radek Dostál
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.
Aug 08, 2022 • edited

Officially, https://jira.atlassian.com/browse/CONFSERVER-54928

 

Unofficially you might want to take a look in network tab of your browser, deactivate a sample user, and work with the HTTP request you see - this way you might be able to automate it with some small local automation script.

Replicating the http forms, and removing unnecessary clutter gets me to

curl 'https://confluencebaseurl.com/admin/users/deactivateuser-confirm.action' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Cookie: JSESSIONID=55B07A765493F5F108D211F0CDB36CF8' \
  -H 'X-Atlassian-Token: no-check' \
  -d 'username=testuser&confirm=Disable'

 

Where:

confluencebaseurl - obviously

JSESSIONID - you need to get this cookie from your current session once you log in, when you log in, you get a JSESSIONID cookie which servers as your authentication, but you could replace this with PAT or basic auth

X-Atlassian-Token - I added this because the data originally contained atl_token, but since this would be automated from outside, we would not have a valid token, so this will skip the token check

testuser - the username

 

And locally, this seems to be working.

Alternatively you could use groovy (if you have a plugin allowing to), or write a java plugin, but if you just need to do this one time I don't see a big harm in just cracking the http form. Mind you - not official, so do test this first if it does what you expect it to.

TAGS
AUG Leaders

Atlassian Community Events