\n";
+# Database name
+print &ui_table_row($text{'grant_db'}, "$in{'db'}");
-print " | $text{'grant_db'} | \n";
-print "$in{'db'} | | \n";
+# Schema name
+print &ui_table_row($text{'grant_ns'}, "$in{'ns'}");
-print " | $text{'grant_ns'} | \n";
-print "$in{'ns'} | | \n";
-
-print " | ",$text{"grant_$in{'type'}"}," | \n";
-print "$in{'table'} | | \n";
+# Object name
+print &ui_table_row($text{"grant_$in{'type'}"}, "$in{'table'}");
+# Get users and groups for permissions table
$u = &execute_sql_safe($config{'basedb'}, "select usename from pg_shadow");
@users = map { $_->[0] } @{$u->{'data'}};
$r = &execute_sql_safe($config{'basedb'}, "select groname from pg_group");
@groups = map { $_->[0] } @{$r->{'data'}};
-print " $text{'grant_users'} \n";
-print "\n";
-print " | $text{'grant_user'} | ",
- "$text{'grant_what'} | \n";
+# Table of users / groups and permissions
$i = 0;
+@table = ( );
foreach $g (@grant, [ undef, undef ]) {
- print " | \n";
+ # User / group selector
+ local @row;
+ push(@row, &ui_select("user_$i",
+ !defined($g->[0]) ? "" :
+ $g->[0] eq '' ? "public" : $g->[0],
+ [ [ '', ' ' ],
+ [ 'public', $text{'grant_public'} ],
+ (map { [ "group $_", &text('grant_group', $_) ] }
+ @groups),
+ (@users) ]));
+ # Permissions
($acl = $g->[1]) =~ s/\/.*//g;
+ $cbs = "";
foreach $p ( [ 'SELECT', 'r' ], [ 'UPDATE', 'w' ],
[ 'INSERT', 'a' ], [ 'DELETE', 'd' ],
[ 'RULE', 'R' ], [ 'REFERENCES', 'x' ],
[ 'TRIGGER', 't' ] ) {
- printf " %s\n",
- $p->[0], $acl =~ /$p->[1]/ ? 'checked' : '', $p->[0];
+ $cbs .= &ui_checkbox("what_$i", $p->[0], $p->[0],
+ $acl =~ /$p->[1]/)."\n";
}
- print " | \n";
+ push(@row, $cbs);
+ push(@table, \@row);
$i++;
}
-print " | \n";
-print " |