version 1.186, 2008/03/12 02:47:34
|
version 1.190, 2008/05/14 22:26:48
|
Line 106 sub handler {
|
Line 106 sub handler {
|
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($env{'form.selectrole'}) { |
if ($env{'form.selectrole'}) { |
|
|
|
my $locknum=&Apache::lonnet::get_locks(); |
|
if ($locknum) { return 409; } |
|
|
if ($env{'form.newrole'}) { |
if ($env{'form.newrole'}) { |
$env{'form.'.$env{'form.newrole'}}=1; |
$env{'form.'.$env{'form.newrole'}}=1; |
} |
} |
Line 133 sub handler {
|
Line 137 sub handler {
|
# Is this an ad-hoc CC-role? |
# Is this an ad-hoc CC-role? |
if (my ($domain,$coursenum) = |
if (my ($domain,$coursenum) = |
($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { |
($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { |
|
# See if that is even allowed |
|
my %crsenv=&Apache::lonnet::get('environment',['internal.courseowner'],$domain,$coursenum); |
|
# First find course owner |
|
my ($owneruser,$ownerdomain)=split(/\:/,$crsenv{'internal.courseowner'}); |
|
# Check if course owner blocked cc-access |
|
if (($owneruser) && ($ownerdomain)) { |
|
my %blocked=&Apache::lonnet::get('environment',['domcoord.cc'],$ownerdomain,$owneruser); |
|
if ($blocked{'domcoord.cc'} eq 'blocked') { |
|
$env{'user.error.msg'}=':::1:Course owner '.$owneruser.' in domain '.$ownerdomain.' blocked domain coordinator access'; |
|
last; |
|
} |
|
} |
if ($dcroles{$domain}) { |
if ($dcroles{$domain}) { |
&check_privs($domain,$coursenum,$then,$now,'cc'); |
&check_privs($domain,$coursenum,$then,$now,'cc'); |
} |
} |
Line 141 sub handler {
|
Line 157 sub handler {
|
# Is this a recent ad-hoc CA-role? |
# Is this a recent ad-hoc CA-role? |
if (my ($domain,$user) = |
if (my ($domain,$user) = |
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
|
# See if still allowed |
|
my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user); |
|
if ($blocked{'domcoord.author'} eq 'blocked') { |
|
delete($env{$envkey}); |
|
$env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access'; |
|
last; |
|
} |
if (($dcroles{$domain}) && (&is_author_homeserver($user,$domain))) { |
if (($dcroles{$domain}) && (&is_author_homeserver($user,$domain))) { |
&check_privs($domain,$user,$then,$now,'ca'); |
&check_privs($domain,$user,$then,$now,'ca'); |
} else { |
} else { |
Line 151 sub handler {
|
Line 174 sub handler {
|
# Is this a new ad-hoc CA-role? |
# Is this a new ad-hoc CA-role? |
if (my ($domain) = |
if (my ($domain) = |
($envkey =~ m-^form\.adhocca\./($match_domain)$-)) { |
($envkey =~ m-^form\.adhocca\./($match_domain)$-)) { |
|
my $user=$env{'form.adhoccauname.'.$domain}; |
|
if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} }; |
|
# See if that is even allowed |
|
my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user); |
|
if ($blocked{'domcoord.author'} eq 'blocked') { |
|
$env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access'; |
|
last; |
|
} |
if ($dcroles{$domain}) { |
if ($dcroles{$domain}) { |
my $user=$env{'form.adhoccauname.'.$domain}; |
|
if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} }; |
|
if (($user) && ($user=~/$match_username/) && (&is_author_homeserver($user,$domain))) { |
if (($user) && ($user=~/$match_username/) && (&is_author_homeserver($user,$domain))) { |
&check_privs($domain,$user,$then,$now,'ca'); |
&check_privs($domain,$user,$then,$now,'ca'); |
$env{'form.ca./'.$domain.'/'.$user}=1; |
$env{'form.ca./'.$domain.'/'.$user}=1; |
Line 447 ENDHEADER
|
Line 476 ENDHEADER
|
# -------------------------------------------------------- Generate Page Output |
# -------------------------------------------------------- Generate Page Output |
# --------------------------------------------------------------- Error Header? |
# --------------------------------------------------------------- Error Header? |
if ($error) { |
if ($error) { |
$r->print("<h1>LON-CAPA Access Control</h1>"); |
$r->print("<h1>".&mt('LON-CAPA Access Control')."</h1>"); |
$r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>"); |
$r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>"); |
if ($priv ne '') { |
if ($priv ne '') { |
$r->print("Access : ".&Apache::lonnet::plaintext($priv)."\n"); |
$r->print(&mt('Access : ').&Apache::lonnet::plaintext($priv)."\n"); |
} |
} |
if ($fn ne '') { |
if ($fn ne '') { |
$r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); |
$r->print(&mt('Resource: ').&Apache::lonenc::check_encrypt($fn)."\n"); |
} |
} |
if ($msg ne '') { |
if ($msg ne '') { |
$r->print("Action : $msg\n"); |
$r->print(&mt('Action : ').$msg."\n"); |
} |
} |
$r->print("</pre><hr />"); |
$r->print("</pre><hr />"); |
my $url=$fn; |
my $url=$fn; |