Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f7c4ec5

Browse files
committed
From: D'Arcy J.M. Cain <darcy@druid.net> The following patch does two things. - Clarifies what the effect of allowing users to add new users (Thet become super-users.) - Makes the default database for the new user if they are not allowed to and the user agrees to create it.
1 parent 36c1895 commit f7c4ec5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/bin/createuser/createuser.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.10 1998/08/22 05:19:17 momjian Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.11 1999/01/31 05:04:25 scrappy Exp $
1212
#
1313
# Note - this should NOT be setuid.
1414
#
@@ -74,7 +74,7 @@ PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT"
7474
PSQL="psql $PARGS"
7575

7676
#
77-
# see if user $USER is allowed to create new users
77+
# see if user $USER is a superuser
7878
#
7979

8080
QUERY="select usesuper from pg_user where usename = '$USER' "
@@ -203,7 +203,7 @@ then
203203

204204
while [ "$yn" != y -a "$yn" != n ]
205205
do
206-
echo PG_OPT_DASH_N_PARAM "Is user \"$NEWUSER\" allowed to add users? (y/n) PG_OPT_BACKSLASH_C_PARAM"
206+
echo PG_OPT_DASH_N_PARAM "Is user \"$NEWUSER\" a superuser? (y/n) PG_OPT_BACKSLASH_C_PARAM"
207207
read yn
208208
done
209209

@@ -234,6 +234,14 @@ else
234234
echo "$CMDNAME: $NEWUSER was successfully added"
235235
if [ "$CANCREATE" = f ]
236236
then
237-
echo "don't forget to create a database for $NEWUSER"
238-
fi
237+
echo PG_OPT_DASH_N_PARAM "Shall I create a database for \"$NEWUSER\" (y/n) PG_OPT_BACKSLASH_C_PARAM"
238+
read yn
239+
240+
if [ "$yn" = y ]
241+
then
242+
createdb $NEWUSER
243+
else
244+
echo "don't forget to create a database for $NEWUSER"
245+
fi
246+
fi
239247
fi

0 commit comments

Comments
 (0)