sunetdrive/templates/application/add_admin_user.erb

21 lines
478 B
Plaintext
Raw Permalink Normal View History

2023-02-13 09:44:56 +00:00
#!/bin/bash
user=${1}
email=${2}
container=${3}
usage() {
echo "Usage: ${0} <username> <email address> [container]"
exit 1
}
if [[ "x${user}" == "x" || "x${email}" == "x" ]]; then
usage
fi
pass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c40;echo -n;)
OC_PASS="${pass}" /usr/local/bin/occ ${container} user:add --password-from-env --group admin "${user}"
unset OC_PASS
/usr/local/bin/occ ${container} user:setting ${user} settings email "${email}"