version 1.10, 2013/02/02 00:22:34
|
version 1.17, 2020/12/18 15:23:04
|
Line 92 sub check_ipbased_access {
|
Line 92 sub check_ipbased_access {
|
my ($page,$ip) = @_; |
my ($page,$ip) = @_; |
my $allowed; |
my $allowed; |
if (!defined($ip)) { |
if (!defined($ip)) { |
$ip = $ENV{'REMOTE_ADDR'}; |
$ip = &Apache::lonnet::get_requestor_ip(); |
} |
} |
if ($ip eq '127.0.0.1') { |
if ($ip eq '127.0.0.1') { |
$allowed = 1; |
$allowed = 1; |
Line 197 sub check_domain_ip {
|
Line 197 sub check_domain_ip {
|
my %remote_doms; |
my %remote_doms; |
my $allowed; |
my $allowed; |
if ($remote_ip ne '') { |
if ($remote_ip ne '') { |
if (&Apache::lonnet::hostname($remote_ip) ne '') { |
my @remote_hosts = &Apache::lonnet::get_hosts_from_ip($remote_ip); |
|
if (@remote_hosts) { |
my @poss_domains = &Apache::lonnet::current_machine_domains(); |
my @poss_domains = &Apache::lonnet::current_machine_domains(); |
if (@poss_domains > 0) { |
if (@poss_domains > 0) { |
my @remote_hosts = &Apache::lonnet::get_hosts_from_ip($remote_ip); |
|
foreach my $hostid (@remote_hosts) { |
foreach my $hostid (@remote_hosts) { |
my $hostdom = &Apache::lonnet::host_domain($hostid); |
my $hostdom = &Apache::lonnet::host_domain($hostid); |
if ($hostdom ne '') { |
if ($hostdom ne '') { |
Line 280 sub can_view {
|
Line 280 sub can_view {
|
} |
} |
} |
} |
unless ($allowed) { |
unless ($allowed) { |
|
my %alloweddoms; |
foreach my $dom (@poss_domains) { |
foreach my $dom (@poss_domains) { |
my %domconfig = &Apache::lonnet::get_dom('configuration',['serverstatuses'], |
my %domconfig = &Apache::lonnet::get_dom('configuration',['serverstatuses'], |
$dom); |
$dom); |
if ($Apache::lonnet::env{'request.role'} eq "dc./$dom/") { |
if ($Apache::lonnet::env{'request.role'} eq "dc./$dom/") { |
if ($page eq 'domconf') { |
if ($page eq 'domconf') { |
$allowed .= $dom.'&'; |
$alloweddoms{$dom} = 1; |
} else { |
} else { |
$allowed = 1; |
$allowed = 1; |
} |
} |
Line 295 sub can_view {
|
Line 296 sub can_view {
|
my @okusers = split(/,/,$domconfig{'serverstatuses'}{$page}{'namedusers'}); |
my @okusers = split(/,/,$domconfig{'serverstatuses'}{$page}{'namedusers'}); |
if (grep(/^\Q$Apache::lonnet::env{'user.name'}:$Apache::lonnet::env{'user.domain'}\E$/,@okusers)) { |
if (grep(/^\Q$Apache::lonnet::env{'user.name'}:$Apache::lonnet::env{'user.domain'}\E$/,@okusers)) { |
if ($page eq 'domconf') { |
if ($page eq 'domconf') { |
$allowed .= $dom.'&'; |
$alloweddoms{$dom} = 1; |
} else { |
} else { |
$allowed = 1; |
$allowed = 1; |
} |
} |
Line 307 sub can_view {
|
Line 308 sub can_view {
|
} |
} |
} |
} |
} |
} |
$allowed =~ s/\&$//; |
if (($page eq 'domconf') && (!$allowed)) { |
|
$allowed = join('&',sort(keys(%alloweddoms))); |
|
} |
} |
} |
} |
} |
return $allowed; |
return $allowed; |
Line 378 sub serverstatus_titles {
|
Line 381 sub serverstatus_titles {
|
'server-status' => 'Apache Status Page', |
'server-status' => 'Apache Status Page', |
'codeversions' => 'LON-CAPA Module Versions', |
'codeversions' => 'LON-CAPA Module Versions', |
'checksums' => 'LON-CAPA Module Checking', |
'checksums' => 'LON-CAPA Module Checking', |
|
'diskusage' => 'Course/Community Disk Usage', |
'clusterstatus' => 'Domain status', |
'clusterstatus' => 'Domain status', |
|
'certstatus' => 'LON-CAPA SSL Certificates Status', |
'metadata_keywords' => 'Display Metadata Keywords', |
'metadata_keywords' => 'Display Metadata Keywords', |
'metadata_harvest' => 'Harvest Metadata Searches', |
'metadata_harvest' => 'Harvest Metadata Searches', |
'takeoffline' => 'Offline - replace Log-in page', |
'takeoffline' => 'Offline - replace Log-in page', |
Line 387 sub serverstatus_titles {
|
Line 392 sub serverstatus_titles {
|
'toggledebug' => 'Toggle debug messages', |
'toggledebug' => 'Toggle debug messages', |
'ping' => 'Cause server to ping another server', |
'ping' => 'Cause server to ping another server', |
'domconf' => 'Text Display of Domain Configuration', |
'domconf' => 'Text Display of Domain Configuration', |
|
'uniquecodes' => 'Six-character Course Codes', |
|
'coursecatalog' => 'Course/Community Catalog with enrollment data', |
); |
); |
return \%titles; |
return \%titles; |
} |
} |