Fix the territory commands' success message and menu order
They called ok(), which this script does not have -- the helper is success() -- so set-territory ended on "ok: command not found" after having worked. The three new entries also sat between 13 and 14 in the menu, having been appended where the list-users case was rather than at the end. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e60dd3ad96
commit
e94c364406
14
pf.sh
14
pf.sh
@ -400,7 +400,7 @@ PYEOF
|
|||||||
)
|
)
|
||||||
SELECT count(*) FROM upd" | grep -q '^1$' \
|
SELECT count(*) FROM upd" | grep -q '^1$' \
|
||||||
|| die "No such account: $username"
|
|| die "No such account: $username"
|
||||||
ok "Territory updated for $username"
|
success "Territory updated for $username"
|
||||||
run_psql -c "SELECT username, is_admin, territory FROM pf.app_user WHERE lower(username) = lower('$(sql_lit "$username")')"
|
run_psql -c "SELECT username, is_admin, territory FROM pf.app_user WHERE lower(username) = lower('$(sql_lit "$username")')"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ cmd_set_admin() {
|
|||||||
)
|
)
|
||||||
SELECT count(*) FROM upd" | grep -q '^1$' \
|
SELECT count(*) FROM upd" | grep -q '^1$' \
|
||||||
|| die "No such account: $username"
|
|| die "No such account: $username"
|
||||||
ok "$username is_admin = $flag"
|
success "$username is_admin = $flag"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Territory values present in the data that belong to no account. Work under one
|
# Territory values present in the data that belong to no account. Work under one
|
||||||
@ -581,11 +581,11 @@ interactive_menu() {
|
|||||||
echo " 11) add-user create a login account"
|
echo " 11) add-user create a login account"
|
||||||
echo " 12) passwd change an account password"
|
echo " 12) passwd change an account password"
|
||||||
echo " 13) list-users show accounts"
|
echo " 13) list-users show accounts"
|
||||||
echo " 16) set-territory grant an account its territory values"
|
|
||||||
echo " 17) set-admin make an account an administrator"
|
|
||||||
echo " 18) orphan-territory territory values no account owns"
|
|
||||||
echo " 14) disable-user deactivate an account and sign it out"
|
echo " 14) disable-user deactivate an account and sign it out"
|
||||||
echo " 15) enable-user reactivate an account"
|
echo " 15) enable-user reactivate an account"
|
||||||
|
echo " 16) set-territory grant an account the territory values it may see"
|
||||||
|
echo " 17) set-admin make an account an administrator"
|
||||||
|
echo " 18) orphan-territory territory values no account owns"
|
||||||
echo " q) quit"
|
echo " q) quit"
|
||||||
echo
|
echo
|
||||||
read -rp " Choice: " choice
|
read -rp " Choice: " choice
|
||||||
@ -603,11 +603,11 @@ interactive_menu() {
|
|||||||
11|add-user) cmd_add_user ;;
|
11|add-user) cmd_add_user ;;
|
||||||
12|passwd) cmd_passwd ;;
|
12|passwd) cmd_passwd ;;
|
||||||
13|list-users) cmd_list_users ;;
|
13|list-users) cmd_list_users ;;
|
||||||
|
14|disable-user) cmd_disable_user ;;
|
||||||
|
15|enable-user) cmd_enable_user ;;
|
||||||
16|set-territory) cmd_set_territory ;;
|
16|set-territory) cmd_set_territory ;;
|
||||||
17|set-admin) cmd_set_admin ;;
|
17|set-admin) cmd_set_admin ;;
|
||||||
18|orphan-territory) cmd_orphan_territory ;;
|
18|orphan-territory) cmd_orphan_territory ;;
|
||||||
14|disable-user) cmd_disable_user ;;
|
|
||||||
15|enable-user) cmd_enable_user ;;
|
|
||||||
q|Q|quit|exit) echo "Bye."; exit 0 ;;
|
q|Q|quit|exit) echo "Bye."; exit 0 ;;
|
||||||
*) warn "Unknown option: $choice" ;;
|
*) warn "Unknown option: $choice" ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user