From 01f55d2fd3ea0e9620bb631dd91e475444393099 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Tue, 9 Jan 2018 10:41:42 +0100 Subject: Permit to create staff/superuser users This patch add two user options staff and superuser. This will permit to create users with thoses flag in LAVA. In the process remove the hardcoded admin user from Dockerfile and move it in tokens.yaml --- lava-master/scripts/setup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lava-master/scripts') diff --git a/lava-master/scripts/setup.sh b/lava-master/scripts/setup.sh index b60c93b..5b62c45 100755 --- a/lava-master/scripts/setup.sh +++ b/lava-master/scripts/setup.sh @@ -5,14 +5,23 @@ if [ -e /root/lava-users ];then do # User is the filename USER=$ut + USER_OPTION="" + STAFF=0 + SUPERUSER=0 . /root/lava-users/$ut if [ -z "$PASSWORD" -o "$PASSWORD" = "$TOKEN" ];then echo "Generating password..." #Could be very long, should be avoided PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) fi - echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD)" - lava-server manage users add --passwd $PASSWORD $USER || exit 1 + if [ $STAFF -eq 1 ];then + USER_OPTION="$USER_OPTION --staff" + fi + if [ $SUPERUSER -eq 1 ];then + USER_OPTION="$USER_OPTION --superuser" + fi + echo "Adding username $USER DEBUG(with $TOKEN / $PASSWORD / $USER_OPTION)" + lava-server manage users add --passwd $PASSWORD $USER_OPTION $USER || exit 1 if [ ! -z "$TOKEN" ];then lava-server manage tokens add --user $USER --secret $TOKEN || exit 1 fi -- cgit 1.2.3-korg