[CentOS-devel] [PATCH/cbs-tools] create_sig script: Loop through all koji permissions

Brian Stinson

brian at bstinson.com
Wed Jun 17 21:07:37 UTC 2015


A user may have multiple permissions in addition to admin. This patch
looks through all permissions in case admin is not the only permission
assigned to a user.
---
 scripts/create_sig.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/create_sig.sh b/scripts/create_sig.sh
index 349c01b..281500d 100755
--- a/scripts/create_sig.sh
+++ b/scripts/create_sig.sh
@@ -81,7 +81,14 @@ fi
 # Check if user is allowed to send command to koji and has 'admin' permission
 KOJI=`which koji`
 PERM=`$KOJI list-permissions --mine`
-if [ "$PERM" != "admin"  ]
+ADMIN=false
+
+for P in $PERM
+do
+    [[ $P == 'admin' ]] && ADMIN=true; break
+done
+
+if [ "$ADMIN" != true ]
 then
 	echo "[ERROR] Koji misconfigure/missing admin privilege for creating SIG tags"
 	exit 1
-- 
1.8.3.1




More information about the CentOS-devel mailing list