#!/usr/local/bin/perl # edit_user.cgi # Display a form for editing or creating a user require './postgresql-lib.pl'; &ReadParse(); $access{'users'} || &error($text{'user_ecannot'}); if ($in{'new'}) { &ui_print_header(undef, $text{'user_create'}, ""); } else { &ui_print_header(undef, $text{'user_edit'}, ""); $s = &execute_sql_safe($config{'basedb'}, "select * from pg_shadow ". "where usename = '$in{'user'}'"); @user = @{$s->{'data'}->[0]}; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'user_header'}
\n"; print "\n"; if ($in{'new'} || &get_postgresql_version() >= 7.4) { print "\n"; } else { print "\n"; } print "\n"; if ($in{'new'}) { # For new users, can select empty or specific password print "\n"; } else { # For existing users, can select empty, leave unchanged or # specific password print "\n"; } print "\n"; printf "\n", $user[2] =~ /t|1/ ? '' : 'checked'; print "\n"; printf "\n", $user[4] =~ /t|1/ ? '' : 'checked'; print "\n"; print "
$text{'user_name'}$user[0]$text{'user_passwd'}",&ui_radio("pass_def", 1, [ [ 1, $text{'user_none'} ], [ 0, $text{'user_setto'} ] ]),"\n", &ui_password("pass", undef, 20),"
",&ui_radio("pass_def", 2, [ [ 2, $text{'user_nochange'} ], [ 0, $text{'user_setto'} ] ]),"\n", &ui_password("pass", undef, 20),"
$text{'user_db'} $text{'yes'}\n", $user[2] =~ /t|1/ ? 'checked' : ''; printf " $text{'no'}$text{'user_other'} $text{'yes'}\n", $user[4] =~ /t|1/ ? 'checked' : ''; printf " $text{'no'}
$text{'user_until'} \n"; if (!$user[6]) { printf " %s\n", $user[6] ? '' : 'checked', $text{'user_forever'}; printf "\n", $user[6] ? 'checked' : ''; } print "
\n"; print "\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; } print "
\n"; &ui_print_footer("list_users.cgi", $text{'user_return'});