Creating ogadmin user in provision script
oginstaller/pipeline/head This commit looks good
Details
oginstaller/pipeline/head This commit looks good
Details
parent
873c424854
commit
18dbaa2384
|
@ -22,13 +22,24 @@ docker compose -f docker-compose-deploy.yml exec php php bin/console doctrine:fi
|
|||
|
||||
|
||||
# Provision user admin
|
||||
curl -k -X 'POST' \
|
||||
'https://localhost:8443/auth/login' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{
|
||||
\"username\": \"$adminuser\",
|
||||
\"password\": \"$adminpass\"
|
||||
}"
|
||||
bearer=$(curl -k -X 'POST' 'https://localhost:8443/auth/login' -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"username\": \"ogadmin\", \"password\": \"12345678\" }" | jq .token | sed 's/"//g' )
|
||||
|
||||
|
||||
if [ $adminuser == "ogadmin" ]; then
|
||||
echo "Cambiando password a ogadmin no puede ser el usuario administrador"
|
||||
ogadmin_uuid=$(curl -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g')
|
||||
curl -k -L -X 'PUT' --location "https://localhost:8443/users/$ogadmin_uuid/reset-password" --header 'Content-Type: application/json' --header "Authorization : Bearer $bearer" --data "{ \"currentPassword\": \"12345678\" , \"newPassword\": \"$adminpass\" , \"repeatNewPassword\": \"$adminpass\" }"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
curl -k -L --location 'https://localhost:8443/users' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--header "Authorization: Bearer $bearer" \
|
||||
--data "{ \"username\": \"$adminuser\", \"password\": \"$adminpass\", \"roles\": [\"ROLE_SUPER_ADMIN\"] }"
|
||||
|
||||
touch /opt/opengnsys/ogCore/installer/.deployed
|
||||
exit 0
|
||||
~
|
||||
~
|
||||
~
|
||||
~
|
||||
|
|
Loading…
Reference in New Issue