version 1.208, 2007/12/13 01:08:47
|
version 1.209, 2007/12/14 00:20:53
|
Line 115 sub auth_abbrev {
|
Line 115 sub auth_abbrev {
|
return %abv_auth; |
return %abv_auth; |
} |
} |
|
|
# ==================================================== Figure out author access |
|
|
|
sub authorpriv { |
|
my ($auname,$audom)=@_; |
|
unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname)) |
|
|| (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; } |
|
return 1; |
|
} |
|
|
|
# ==================================================== |
# ==================================================== |
|
|
sub portfolio_quota { |
sub portfolio_quota { |
Line 970 ENDNOPORTPRIV
|
Line 961 ENDNOPORTPRIV
|
} |
} |
if (($role_code eq 'ca') || ($role_code eq 'aa')) { |
if (($role_code eq 'ca') || ($role_code eq 'aa')) { |
$area=~m{/($match_domain)/($match_username)}; |
$area=~m{/($match_domain)/($match_username)}; |
if (&authorpriv($2,$1)) { |
if (&Apache::lonuserutils::authorpriv($2,$1)) { |
$allowed=1; |
$allowed=1; |
} else { |
} else { |
$allowed=0; |
$allowed=0; |
Line 1063 ENDNOPORTPRIV
|
Line 1054 ENDNOPORTPRIV
|
# |
# |
# Co-Author |
# Co-Author |
# |
# |
if (&authorpriv($env{'user.name'},$env{'request.role.domain'}) && |
if (&Apache::lonuserutils::authorpriv($env{'user.name'}, |
|
$env{'request.role.domain'}) && |
($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain)) { |
($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain)) { |
# No sense in assigning co-author role to yourself |
# No sense in assigning co-author role to yourself |
$addrolesdisplay = 1; |
$addrolesdisplay = 1; |
Line 1114 ENDNOPORTPRIV
|
Line 1106 ENDNOPORTPRIV
|
&Apache::loncommon::end_data_table_row()."\n". |
&Apache::loncommon::end_data_table_row()."\n". |
&Apache::loncommon::end_data_table()); |
&Apache::loncommon::end_data_table()); |
} elsif ($env{'request.role'} =~ /^au\./) { |
} elsif ($env{'request.role'} =~ /^au\./) { |
if (!(&authorpriv($env{'user.name'},$env{'request.role.domain'}))) { |
if (!(&Apache::lonuserutils::authorpriv($env{'user.name'}, |
|
$env{'request.role.domain'}))) { |
$r->print('<span class="LC_error">'. |
$r->print('<span class="LC_error">'. |
&mt('You do not have privileges to assign co-author roles.'). |
&mt('You do not have privileges to assign co-author roles.'). |
'</span>'); |
'</span>'); |
Line 2618 sub handler {
|
Line 2611 sub handler {
|
({href=>"/adm/createuser", |
({href=>"/adm/createuser", |
text=>"User Management"}); |
text=>"User Management"}); |
} |
} |
my ($permission,$allowed) = &get_permission($context); |
my ($permission,$allowed) = |
|
&Apache::lonuserutils::get_permission($context); |
if (!$allowed) { |
if (!$allowed) { |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/createuser:cst:0:0:Cannot create/modify user data ". |
"/adm/createuser:cst:0:0:Cannot create/modify user data ". |
Line 2936 sub print_main_menu {
|
Line 2930 sub print_main_menu {
|
return $menu_html; |
return $menu_html; |
} |
} |
|
|
sub get_permission { |
|
my ($context) = @_; |
|
my %permission; |
|
if ($context eq 'course') { |
|
if ((&Apache::lonnet::allowed('cta',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('cep',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('cst',$env{'request.course.id'}))) { |
|
$permission{'cusr'} = 1; |
|
$permission{'view'} = |
|
&Apache::lonnet::allowed('vcl',$env{'request.course.id'}); |
|
|
|
} |
|
if (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) { |
|
$permission{'custom'} = 1; |
|
} |
|
if (&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) { |
|
$permission{'view'} = 1; |
|
} |
|
if (!$permission{'view'}) { |
|
my $scope = $env{'request.course.id'}.'/'.$env{'request.course.sec'}; |
|
$permission{'view'} = &Apache::lonnet::allowed('vcl',$scope); |
|
if ($permission{'view'}) { |
|
$permission{'view_section'} = $env{'request.course.sec'}; |
|
} |
|
} |
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
$permission{'grp_manage'} = 1; |
|
} |
|
} elsif ($context eq 'author') { |
|
$permission{'cusr'} = &authorpriv($env{'user.name'},$env{'request.role.domain'}); |
|
$permission{'view'} = $permission{'cusr'}; |
|
} else { |
|
if ((&Apache::lonnet::allowed('cad',$env{'request.role.domain'})) || |
|
(&Apache::lonnet::allowed('cli',$env{'request.role.domain'})) || |
|
(&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) || |
|
(&Apache::lonnet::allowed('csc',$env{'request.role.domain'})) || |
|
(&Apache::lonnet::allowed('cdg',$env{'request.role.domain'})) || |
|
(&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) { |
|
$permission{'cusr'} = 1; |
|
} |
|
if (&Apache::lonnet::allowed('ccr',$env{'request.role.domain'})) { |
|
$permission{'custom'} = 1; |
|
} |
|
$permission{'view'} = $permission{'cusr'}; |
|
} |
|
my $allowed = 0; |
|
foreach my $perm (values(%permission)) { |
|
if ($perm) { $allowed=1; last; } |
|
} |
|
return (\%permission,$allowed); |
|
} |
|
|
|
sub restore_prev_selections { |
sub restore_prev_selections { |
my %saveable_parameters = ('srchby' => 'scalar', |
my %saveable_parameters = ('srchby' => 'scalar', |
'srchin' => 'scalar', |
'srchin' => 'scalar', |