correction grmllll
This commit is contained in:
+40
-47
@@ -621,45 +621,37 @@ userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=$
|
|||||||
# on créé le compte mattermost
|
# on créé le compte mattermost
|
||||||
#echo "docker exec -i mattermostServ bin/mmctl user create --email ${EMAIL_SOUHAITE} --username ${IDENT_KAZ} --password ${PASSWORD}" | tee -a "${CMD_LOGIN}"
|
#echo "docker exec -i mattermostServ bin/mmctl user create --email ${EMAIL_SOUHAITE} --username ${IDENT_KAZ} --password ${PASSWORD}" | tee -a "${CMD_LOGIN}"
|
||||||
#on remplace par l'api rest
|
#on remplace par l'api rest
|
||||||
# cat <<EOF | tee -a "${CMD_LOGIN}"
|
|
||||||
curl -s -X POST "https://${URL_AGORA}/api/v4/users" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"email":"${EMAIL_SOUHAITE}","username":"${IDENT_KAZ}","password":"${PASSWORD}"}'
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
#quel user_id ?
|
|
||||||
USER_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/users/email/${EMAIL_SOUHAITE}" | jq -r '.id')
|
|
||||||
#KAZ a quelle team id ?
|
#KAZ a quelle team id ?
|
||||||
KAZ_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz" | jq -r '.id')
|
KAZ_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz" | jq -r '.id')
|
||||||
|
|
||||||
# et enfin on ajoute toujours le user à l'équipe KAZ et aux 2 channels publiques
|
|
||||||
#echo "docker exec -i mattermostServ bin/mmctl team users add kaz ${EMAIL_SOUHAITE}" | tee -a "${CMD_LOGIN}"
|
|
||||||
# cat <<EOF | tee -a "${CMD_LOGIN}"
|
|
||||||
curl -s -X POST "https://${URL_AGORA}/api/v4/teams/${KAZ_ID}/members" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"team_id":"${KAZ_ID}","user_id":"${USER_ID}"}'
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
CHAN1_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz/channels/name/une-question--un-soucis" | jq -r '.id')
|
CHAN1_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz/channels/name/une-question--un-soucis" | jq -r '.id')
|
||||||
CHAN2_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz/channels/name/cafe-du-commerce--ouvert-2424h" | jq -r '.id')
|
CHAN2_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/kaz/channels/name/cafe-du-commerce--ouvert-2424h" | jq -r '.id')
|
||||||
|
|
||||||
|
cat >> "${CMD_LOGIN}" <<EOF
|
||||||
|
resp=\$(curl -s -X POST "https://${URL_AGORA}/api/v4/users" \
|
||||||
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"email":"${EMAIL_SOUHAITE}","username":"${IDENT_KAZ}","password":"${PASSWORD}"}')
|
||||||
|
|
||||||
|
USER_ID=\$(echo "\$resp" | jq -r '.id')
|
||||||
|
|
||||||
|
# et enfin on ajoute toujours le user à l'équipe KAZ et aux 2 channels publiques
|
||||||
|
|
||||||
|
curl -s -X PUT "https://${URL_AGORA}/api/v4/teams/${KAZ_ID}/members/\${USER_ID}" \
|
||||||
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
|
-H "Content-Type: application/json"
|
||||||
|
|
||||||
|
curl -s -X PUT "https://${URL_AGORA}/api/v4/channels/${CHAN1_ID}/members/\${USER_ID}" \
|
||||||
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
|
-H "Content-Type: application/json"
|
||||||
|
curl -s -X PUT "https://${URL_AGORA}/api/v4/channels/${CHAN2_ID}/members/\${USER_ID}" \
|
||||||
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
|
-H "Content-Type: application/json"
|
||||||
|
EOF
|
||||||
|
|
||||||
# echo "docker exec -i mattermostServ bin/mmctl channel users add kaz:une-question--un-soucis ${EMAIL_SOUHAITE}" | tee -a "${CMD_LOGIN}"
|
# echo "docker exec -i mattermostServ bin/mmctl channel users add kaz:une-question--un-soucis ${EMAIL_SOUHAITE}" | tee -a "${CMD_LOGIN}"
|
||||||
# echo "docker exec -i mattermostServ bin/mmctl channel users add kaz:cafe-du-commerce--ouvert-2424h ${EMAIL_SOUHAITE}" | tee -a "${CMD_LOGIN}"
|
# echo "docker exec -i mattermostServ bin/mmctl channel users add kaz:cafe-du-commerce--ouvert-2424h ${EMAIL_SOUHAITE}" | tee -a "${CMD_LOGIN}"
|
||||||
|
|
||||||
# cat <<EOF | tee -a "${CMD_LOGIN}"
|
|
||||||
curl -s -X PUT "https://${URL_AGORA}/api/v4/channels/${CHAN1_ID}/members/${USER_ID}" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
|
||||||
-H "Content-Type: application/json"
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
# cat <<EOF | tee -a "${CMD_LOGIN}"
|
|
||||||
curl -s -X PUT "https://${URL_AGORA}/api/v4/channels/${CHAN2_ID}/members/${USER_ID}" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
|
||||||
-H "Content-Type: application/json"
|
|
||||||
# EOF
|
|
||||||
|
|
||||||
NB_SERVICES_BASE=$((NB_SERVICES_BASE+1))
|
NB_SERVICES_BASE=$((NB_SERVICES_BASE+1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -673,37 +665,34 @@ curl -s -X PUT "https://${URL_AGORA}/api/v4/channels/${CHAN2_ID}/members/${USER_
|
|||||||
if [ "${nb}" == "0" ];then # non, on la créé en mettant le user en admin de l'équipe
|
if [ "${nb}" == "0" ];then # non, on la créé en mettant le user en admin de l'équipe
|
||||||
|
|
||||||
#echo "docker exec -i mattermostServ bin/mmctl team create --name ${EQUIPE_AGORA} --display-name ${EQUIPE_AGORA} --email ${EMAIL_SOUHAITE}" --private | tee -a "${CMD_INIT}"
|
#echo "docker exec -i mattermostServ bin/mmctl team create --name ${EQUIPE_AGORA} --display-name ${EQUIPE_AGORA} --email ${EMAIL_SOUHAITE}" --private | tee -a "${CMD_INIT}"
|
||||||
cat <<EOF | tee -a "${CMD_INIT}"
|
|
||||||
curl -s -X POST "https://${URL_AGORA}/api/v4/teams" \
|
#################################
|
||||||
|
cat >> "${CMD_LOGIN}" <<EOF
|
||||||
|
resp=\$(curl -s -X POST "https://${URL_AGORA}/api/v4/teams" \
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"name": "'"${EQUIPE_AGORA}"'",
|
"name":"${EQUIPE_AGORA}",
|
||||||
"display_name": "'"${EQUIPE_AGORA}"'",
|
"display_name":"${EQUIPE_AGORA}",
|
||||||
"type":"I",
|
"type":"I",
|
||||||
"email": "'"${EMAIL_SOUHAITE}"'"
|
"email":"${EMAIL_SOUHAITE}"
|
||||||
}'
|
}')
|
||||||
EOF
|
|
||||||
|
|
||||||
fi
|
TEAM_ID=\$(echo "\$resp" | jq -r '.id')
|
||||||
|
|
||||||
# puis ajouter le user à l'équipe
|
# puis ajouter le user à l'équipe
|
||||||
#echo "docker exec -i mattermostServ bin/mmctl team users add ${EQUIPE_AGORA} ${EMAIL_SOUHAITE}" | tee -a "${CMD_INIT}"
|
#echo "docker exec -i mattermostServ bin/mmctl team users add ${EQUIPE_AGORA} ${EMAIL_SOUHAITE}" | tee -a "${CMD_INIT}"
|
||||||
|
|
||||||
#l'équipe a quelle team id ?
|
curl -s -X POST "https://${URL_AGORA}/api/v4/teams/\${TEAM_ID}/members" \
|
||||||
TEAM_ID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "https://${URL_AGORA}/api/v4/teams/name/${EQUIPE_AGORA}" | jq -r '.id')
|
|
||||||
cat <<EOF | tee -a "${CMD_INIT}"
|
|
||||||
curl -s -X POST "https://${URL_AGORA}/api/v4/teams/${TEAM_ID}/members" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"team_id": "'"${TEAM_ID}"'",
|
"team_id": "'"\${TEAM_ID}"'",
|
||||||
"user_id": "'"${USER_ID}"'"
|
"user_id": "'"\${USER_ID}"'"
|
||||||
}'
|
}'
|
||||||
EOF
|
|
||||||
#et on le rend admin de son équipe
|
#et on le rend admin de son équipe
|
||||||
cat <<EOF | tee -a "${CMD_INIT}"
|
curl -s -X PUT "https://${URL_AGORA}/api/v4/teams/\${TEAM_ID}/members/\${USER_ID}/roles" \
|
||||||
curl -s -X PUT "https://${URL_AGORA}/api/v4/teams/${TEAM_ID}/members/${USER_ID}/roles" \
|
|
||||||
-H "Authorization: Bearer ${mattermost_token}" \
|
-H "Authorization: Bearer ${mattermost_token}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"roles":"team_admin"}'
|
-d '{"roles":"team_admin"}'
|
||||||
@@ -712,6 +701,10 @@ EOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${CREATE_ORGA_SERVICES}" ]; then
|
if [ -n "${CREATE_ORGA_SERVICES}" ]; then
|
||||||
SEND_MSG_CREATE=true
|
SEND_MSG_CREATE=true
|
||||||
echo "${CREATE_ORGA_CMD}" --create ${CREATE_ORGA_SERVICES} "${ORGA}" | tee -a "${CMD_ORGA}"
|
echo "${CREATE_ORGA_CMD}" --create ${CREATE_ORGA_SERVICES} "${ORGA}" | tee -a "${CMD_ORGA}"
|
||||||
|
|||||||
Reference in New Issue
Block a user