/usr/share/awl/dba/grant-on-all-tables.sh is in libawl-php 0.53-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/sh
DATABASE="$1"
USER="$2"
PERMISSION="${3:-SELECT}"
if [ "$USER" = "" ] ; then
echo "Usage: $0 <database> <username> [permissions]"
exit
fi
TABLES="`psql \"$DATABASE\" -qt -c \"select relname from pg_class where relowner > 50 AND relkind in( 'r', 'S');\"`"
for T in ${TABLES} ; do
psql "$DATABASE" -c "grant ${PERMISSION} on ${T} to ${USER};"
done
|