add 2 little scripts

This commit is contained in:
pierreozoux 2016-09-15 15:27:41 +01:00
parent fbcdb4ea05
commit c59cb38bee
2 changed files with 19 additions and 0 deletions

11
utils/add_cloud_user Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash -eux
source /etc/environment
user=$1
email=$2
quota=$3
curl -X POST --user ${cloud_admin}:${cloud_pass} https://${cloud_hostname}/ocs/v1.php/cloud/users -d userid="$1" -d password="`tr -dc A-Za-z0-9_ < /dev/urandom | head -c 10 | xargs`"
curl -X PUT --user ${cloud_admin}:${cloud_pass} https://${cloud_hostname}/ocs/v1.php/cloud/users/${user} -d key="email" -d value="${email}"
curl -X PUT --user ${cloud_admin}:${cloud_pass} https://${cloud_hostname}/ocs/v1.php/cloud/users/${user} -d key="quota" -d value="${quota}"

8
utils/add_to_group Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash -eux
source /etc/environment
user=$1
group=$2
curl -X POST --user ${cloud_admin}:${cloud_pass} https://${cloud_hostname}/ocs/v1.php/cloud/users/${1}/groups -d groupid="${2}"