Handle hostnames with upper-case letters
[webmin.git] / postgresql / list_users.cgi
1 #!/usr/local/bin/perl
2 # list_users.cgi
3 # Display all users in the database
4
5 require './postgresql-lib.pl';
6 $access{'users'} || &error($text{'user_ecannot'});
7 &ui_print_header(undef, $text{'user_title'}, "", "list_users");
8
9 $s = &execute_sql_safe($config{'basedb'}, "select * from pg_shadow");
10 print &ui_form_start("delete_users.cgi", "post");
11 @rowlinks = ( &select_all_link("d", 0),
12               &select_invert_link("d", 0),
13               "<a href='edit_user.cgi?new=1'>$text{'user_add'}</a>" );
14 print &ui_links_row(\@rowlinks);
15 print &ui_columns_start([ "", $text{'user_name'},
16                           $text{'user_pass'},
17                           $text{'user_db'},
18                           $text{'user_other'},
19                           $text{'user_until'} ], 100);
20 foreach $u (sort { $a->[0] cmp $b->[0] } @{$s->{'data'}}) {
21         local @cols;
22         push(@cols, "<a href='edit_user.cgi?user=$u->[0]'>".
23                     &html_escape($u->[0])."</a>");
24         push(@cols, $u->[5] ? $text{'yes'} : $text{'no'});
25         push(@cols, $u->[2] =~ /t|1/ ? $text{'yes'} : $text{'no'});
26         push(@cols, $u->[4] =~ /t|1/ ? $text{'yes'} : $text{'no'});
27         push(@cols, $u->[6] ? &html_escape($u->[6])
28                              : $text{'user_forever'});
29         print &ui_checked_columns_row(\@cols, undef, "d", $u->[0]);
30         }
31 print &ui_columns_end();
32 print &ui_links_row(\@rowlinks);
33 print &ui_form_end([ [ "delete", $text{'user_delete'} ] ]);
34
35 if (&get_postgresql_version() >= 7 && &foreign_installed("useradmin")) {
36         print &ui_hr();
37         print "$text{'user_sync'}<p>\n";
38         print &ui_form_start("save_sync.cgi");
39         print &ui_table_start(undef, undef, 2);
40
41         # When to sync
42         print &ui_table_row($text{'user_syncwhen'},
43               &ui_checkbox("sync_create", 1, $text{'user_sync_create'},
44                            $config{'sync_create'})."<br>\n".
45               &ui_checkbox("sync_modify", 1, $text{'user_sync_modify'},
46                            $config{'sync_modify'})."<br>\n".
47               &ui_checkbox("sync_delete", 1, $text{'user_sync_delete'},
48                            $config{'sync_delete'}));
49
50         print &ui_table_end();
51         print &ui_form_end([ [ "save", $text{'save'} ] ]);
52         }
53
54 &ui_print_footer("", $text{'index_return'});
55