Skip to content

Instantly share code, notes, and snippets.

@knennigtri
Last active March 26, 2019 17:15
Show Gist options
  • Save knennigtri/b0259a48136089fb2daa1475fed49ee6 to your computer and use it in GitHub Desktop.
Save knennigtri/b0259a48136089fb2daa1475fed49ee6 to your computer and use it in GitHub Desktop.
Autocreation of AEM users
#This script only creates users and a single group. This does not set permissions or put the users into the group.
#Once this script is run, go to /useradmin and add all created AEM users to the created AEM group
#Open the created group and add Groups: Authors, DAM-users, tag-administrators, project-administrators, template-authors, workflow-administrators, /libs/cq/core/content/nav/personalization (full permissions)
#Number of AEM Accounts to be created
STUDENTS=13
#Name of group being created
GROUP=mygroup
#Name of AEM users
USER=user
#Password for AEM users
PW=password
#AEM Server
SERVER=http://localhost:4502
curl -u admin:admin -FcreateGroup=$GROUP -FauthorizableId=$GROUP $SERVER/libs/granite/security/post/authorizables
#Resulting AEM usernames will be USERxx where xx is a number 01-STUDENTS
for ((c=1;c<=$STUDENTS; c++))
do
if [ $c -lt 10 ]
then
curl -u admin:admin -FcreateUser=$USER0$c -FauthorizableId=$USER0$c -Frep:password=$PW $SERVER/libs/granite/security/post/authorizables
else
curl -u admin:admin -FcreateUser=$USER$c -FauthorizableId=$USER$c -Frep:password=$PW $SERVER/libs/granite/security/post/authorizables
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment