Skip to content

Instantly share code, notes, and snippets.

@chamerling
Created January 17, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamerling/9fe793149be09a3dcc547717da91121b to your computer and use it in GitHub Desktop.
Save chamerling/9fe793149be09a3dcc547717da91121b to your computer and use it in GitHub Desktop.
Massive user creation for OpenPaaS
// Login into OP as admin, open the browser console and copy/paste this script after having updated the domainId value
// define it from your instance
const domainId = '5bacec0db1a8481f6b30e806';
function getBody(i, domainId) {
return `{"accounts":[{"type":"email","emails":["user-${i}@open-paas.org"]}],"domains":[{"domain_id":"${domainId}"}],"password":"secret"}`;
}
for(var i = 0; i < 1000; i++) {
// do not care about promise result
fetch(`http://localhost:8080/api/domains/${domainId}/members`, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json'
}),
body: getBody(i)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment