From 6fdbc0c9ca077320cd7d7d29fd7fd6b91c92b464 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Tue, 5 Sep 2023 18:16:44 +1000 Subject: [PATCH] add permissions --- koji-setup/koji-add-user.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koji-setup/koji-add-user.sh b/koji-setup/koji-add-user.sh index 3c8f145..c2f790e 100644 --- a/koji-setup/koji-add-user.sh +++ b/koji-setup/koji-add-user.sh @@ -4,11 +4,13 @@ set -e DEBUG= SILENT="-s" QUIET="-q" -for param in $1 $2 ; do +for param in $1 $2 $3 ; do if [ $param ] ; then case $param in debug ) DEBUG="debug" ;; + perms=* ) + NEW_PERMS=${param#*=} ;; * ) NEW_USER=$param ;; esac @@ -40,6 +42,9 @@ fi # Add the new user into the database sudo -u kojiadmin koji add-user "$NEW_USER" +if [ $NEW_PERMS ] ; then + sudo -u kojiadmin koji grant-permission --new $NEW_PERMS $NEW_USER +fi # Generate a certificate for the user pushd "$KOJI_PKI_DIR" $SCRIPT_DIR/koji-gencert.sh "$NEW_USER" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$NEW_USER"