version 1.42, 2002/08/23 19:43:11
|
version 1.44, 2002/11/18 20:06:53
|
Line 80 BEGIN {
|
Line 80 BEGIN {
|
$authformloc = &Apache::loncommon::authform_local(%param); |
$authformloc = &Apache::loncommon::authform_local(%param); |
} |
} |
|
|
|
|
|
|
|
# ==================================================== Figure out author access |
|
|
|
sub authorpriv { |
|
my ($auname,$audom)=@_; |
|
if (($auname ne $ENV{'user.name'}) || |
|
(($audom ne $ENV{'user.domain'}) && |
|
($audom ne $ENV{'request.role.domain'}))) { return ''; } |
|
unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; } |
|
return 1; |
|
} |
|
|
# =================================================================== Phase one |
# =================================================================== Phase one |
|
|
sub print_username_entry_form { |
sub print_username_entry_form { |
Line 98 $bodytag
|
Line 111 $bodytag
|
<form action="/adm/createuser" method="post"> |
<form action="/adm/createuser" method="post"> |
<input type="hidden" name="phase" value="get_user_info"> |
<input type="hidden" name="phase" value="get_user_info"> |
<p> |
<p> |
Username: <input type="text" size="15" name="ccuname"><br> |
<table> |
Domain: $domform |
<tr><td>Username:</td><td><input type="text" size="15" name="ccuname"> |
|
</td></tr><tr><td> |
|
Domain:</td><td>$domform</td></tr> |
|
</table> |
</p> |
</p> |
<input type="submit" value="Continue"> |
<input type="submit" value="Continue"> |
</form> |
</form> |
Line 294 END
|
Line 310 END
|
} |
} |
} |
} |
} |
} |
# I have no idea what the hell the above code does |
if ($role_code eq 'ca') { |
# So the following is a check: |
$area=~/\/(\w+)\/(\w+)/; |
if ($allowed) { |
if (&authorpriv($2,$1)) { |
# If we are looking at a co-author role, make sure it is |
$allowed=1; |
# for the current users construction space before we let |
} else { |
# them revoke it. |
$allowed=0; |
if (($role_code eq 'ca') && |
|
($ENV{'request.role'} !~ /^dc/)) { |
|
if ($area !~ |
|
/^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) { |
|
$allowed = 0; |
|
} |
|
} |
} |
} |
} |
my $row = ''; |
my $row = ''; |
Line 427 ENDOTHERAUTHS
|
Line 437 ENDOTHERAUTHS
|
# |
# |
# Co-Author |
# Co-Author |
# |
# |
if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) { |
if (&authorpriv($ENV{'user.name'},$ENV{'request.role.domain'}) && |
|
($ENV{'user.name'} ne $ccuname || $ENV{'user.domain'} ne $ccdomain)) { |
|
# No sense in assigning co-author role to yourself |
my $cuname=$ENV{'user.name'}; |
my $cuname=$ENV{'user.name'}; |
my $cudom=$ENV{'request.role.domain'}; |
my $cudom=$ENV{'request.role.domain'}; |
$r->print(<<ENDCOAUTH); |
$r->print(<<ENDCOAUTH); |