I want to deactivate lots of crowd users automatically. Is there any way to do this without doing manually on GUI?
Crowd CLI isn't available anymore though.
Hi Hisamitsu,
You can use Crowd's REST API: https://developer.atlassian.com/display/CROWDDEV/Crowd+REST+Resources
For instance, the following Groovy script will do the job:
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' ) import groovyx.net.http.RESTClient def applicationName = "myapp" def applicationPassword = "password" def client = new RESTClient( "http://localhost:8095/crowd/rest/usermanagement/1/".toString() ) client.auth.basic applicationName, applicationPassword def users = ['john', 'jane', 'bob'] users.each{ u-> def body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><user name=\"$u\"><active>false</active></user>" def response = client.put(path: "user", requestContentType: 'application/xml', query:['username': u], body: body) assert response.status == 204 }
Best regards,
Bruno
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.