2007-04-12 20:24:50 +00:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
# edit_host.cgi
|
|
|
|
# Display users and groups on some host
|
|
|
|
|
|
|
|
require './cluster-useradmin-lib.pl';
|
|
|
|
&ReadParse();
|
|
|
|
&ui_print_header(undef, $text{'host_title'}, "");
|
|
|
|
|
|
|
|
@hosts = &list_useradmin_hosts();
|
|
|
|
($host) = grep { $_->{'id'} == $in{'id'} } @hosts;
|
|
|
|
$server = &foreign_call("servers", "get_server", $in{'id'});
|
|
|
|
@packages = @{$host->{'packages'}};
|
|
|
|
|
|
|
|
# Show host details
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_table_start($text{'host_header'}, undef, 4);
|
2007-04-12 20:24:50 +00:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
my $hmsg;
|
2007-04-12 20:24:50 +00:00
|
|
|
if ($server->{'id'}) {
|
2020-11-01 17:12:51 -08:00
|
|
|
$hmsg = &ui_link("/servers/link.cgi/$server->{'id'}/",
|
2017-03-01 00:54:51 -08:00
|
|
|
$server->{'desc'} ?
|
2020-11-01 17:12:51 -08:00
|
|
|
"$server->{'desc'} ($server->{'host'}:$server->{'port'})" :
|
|
|
|
"$server->{'host'}:$server->{'port'}");
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-11-01 17:12:51 -08:00
|
|
|
$hmsg = &ui_link("/", $text{'this_server'});
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_table_row($text{'host_name'}, $hmsg, 3);
|
2007-04-12 20:24:50 +00:00
|
|
|
|
|
|
|
if ($server->{'id'}) {
|
2020-11-01 17:12:51 -08:00
|
|
|
my ($t) = grep { $_->[0] eq $server->{'type'} } @servers::server_types;
|
|
|
|
print &ui_table_row($text{'host_type'}, $t ? $t->[1] : "");
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
|
|
|
|
2021-03-06 12:24:20 -08:00
|
|
|
print &ui_table_row($text{'host_userscount'},
|
2020-11-01 17:12:51 -08:00
|
|
|
scalar(@{$host->{'users'}}));
|
2007-04-12 20:24:50 +00:00
|
|
|
|
2021-03-06 12:24:20 -08:00
|
|
|
print &ui_table_row($text{'host_groupscount'},
|
2020-11-01 17:12:51 -08:00
|
|
|
scalar(@{$host->{'groups'}}));
|
2007-04-12 20:24:50 +00:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_table_end();
|
2007-04-12 20:24:50 +00:00
|
|
|
|
|
|
|
# Show delete and refresh buttons
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_buttons_start();
|
2018-03-11 11:59:56 -07:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_buttons_row("delete_host.cgi", $text{'host_delete'}, undef,
|
|
|
|
[ [ "id", $in{'id'} ] ]);
|
2007-04-12 20:24:50 +00:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_buttons_row("refresh.cgi", $text{'host_refresh'}, undef,
|
|
|
|
[ [ "id", $in{'id'} ] ]);
|
2018-03-11 11:59:56 -07:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
print &ui_buttons_end();
|
2007-04-12 20:24:50 +00:00
|
|
|
|
|
|
|
# Show users and groups
|
2008-05-10 03:09:08 +00:00
|
|
|
print &ui_hr();
|
2020-11-01 17:12:51 -08:00
|
|
|
my @ugrid;
|
|
|
|
foreach my $u (@{$host->{'users'}}) {
|
|
|
|
push(@ugrid, &ui_link("edit_user.cgi?user=".&urlize($u->{'user'}).
|
|
|
|
"&host=".&urlize($server->{'id'}), $u->{'user'}));
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
2022-02-19 15:39:39 -08:00
|
|
|
print &ui_grid_table(\@ugrid, 4, 100, undef, undef, $text{'host_users'});
|
2007-04-12 20:24:50 +00:00
|
|
|
|
2020-11-01 17:12:51 -08:00
|
|
|
my @ggrid;
|
2007-04-12 20:24:50 +00:00
|
|
|
foreach $g (@{$host->{'groups'}}) {
|
2020-11-01 17:12:51 -08:00
|
|
|
push(@ggrid, &ui_link("edit_group.cgi?group=".&urlize($g->{'group'}).
|
|
|
|
"&host=".&urlize($server->{'id'}), $g->{'group'}));
|
2007-04-12 20:24:50 +00:00
|
|
|
}
|
2022-02-19 15:39:39 -08:00
|
|
|
print &ui_grid_table(\@ggrid, 4, 100, undef, undef, $text{'host_groups'});
|
2007-04-12 20:24:50 +00:00
|
|
|
|
|
|
|
&ui_print_footer("", $text{'index_return'});
|
|
|
|
|