From 27487fe8705fc248bafe1999788c9fae85e3003c Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 6 Aug 2024 21:40:23 +0000 Subject: [PATCH] scripts/check-admin: script to show which (if any) services require tending to registration attempts --- scripts/check-admin | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/check-admin diff --git a/scripts/check-admin b/scripts/check-admin new file mode 100755 index 000000000..e2bc61924 --- /dev/null +++ b/scripts/check-admin @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils -p gnugrep -p gnused -p openssh + +# checks regular admin tasks +# - gitea: did any users request to register? + +rc=0 + +accounts=$(ssh servo-hn sudo -u git gitea --config /var/lib/gitea/custom/conf/app.ini admin user list) +unactivated=$(echo "$accounts" | sed 's/ */ /g' | cut -d' ' -f 3-4 | grep ' false$') + +if [ -n "$unactivated" ]; then + rc=1 + echo "the following gitea users are unactivated:" + echo " $unactivated" + echo "activate them on the web: " + # CLI activation doesn't appear to be possible. no option under `gitea admin user ...` +fi + +exit "$rc"