version 1.1031, 2009/10/19 02:15:33
|
version 1.1036, 2009/10/25 14:49:07
|
Line 3802 sub privileged {
|
Line 3802 sub privileged {
|
my ($username,$domain)=@_; |
my ($username,$domain)=@_; |
my $rolesdump=&reply("dump:$domain:$username:roles", |
my $rolesdump=&reply("dump:$domain:$username:roles", |
&homeserver($username,$domain)); |
&homeserver($username,$domain)); |
if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return 0; } |
if (($rolesdump eq 'con_lost') || ($rolesdump eq '') || |
|
($rolesdump =~ /^error:/)) { |
|
return 0; |
|
} |
my $now=time; |
my $now=time; |
if ($rolesdump ne '') { |
if ($rolesdump ne '') { |
foreach my $entry (split(/&/,$rolesdump)) { |
foreach my $entry (split(/&/,$rolesdump)) { |
Line 3830 sub privileged {
|
Line 3833 sub privileged {
|
|
|
sub rolesinit { |
sub rolesinit { |
my ($domain,$username,$authhost)=@_; |
my ($domain,$username,$authhost)=@_; |
my %userroles; |
my $now=time; |
|
my %userroles = ('user.login.time' => $now); |
my $rolesdump=reply("dump:$domain:$username:roles",$authhost); |
my $rolesdump=reply("dump:$domain:$username:roles",$authhost); |
if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return \%userroles; } |
if (($rolesdump eq 'con_lost') || ($rolesdump eq '') || |
|
($rolesdump =~ /^error:/)) { |
|
return \%userroles; |
|
} |
my %allroles=(); |
my %allroles=(); |
my %allgroups=(); |
my %allgroups=(); |
my $now=time; |
|
%userroles = ('user.login.time' => $now); |
|
my $group_privs; |
my $group_privs; |
|
|
if ($rolesdump ne '') { |
if ($rolesdump ne '') { |
Line 4010 sub role_status {
|
Line 4015 sub role_status {
|
$$tstatus='is'; |
$$tstatus='is'; |
if ($$tstart && $$tstart>$then) { |
if ($$tstart && $$tstart>$then) { |
$$tstatus='future'; |
$$tstatus='future'; |
if ($$tstart && $$tstart>$refresh) { |
if ($$tstart<$now) { |
if ($$tstart<$now) { |
if ($$tstart && $$tstart>$refresh) { |
if (($$where ne '') && ($$role ne '')) { |
if (($$where ne '') && ($$role ne '')) { |
my (%allroles,%allgroups,$group_privs); |
my (%allroles,%allgroups,$group_privs); |
my %userroles = ( |
my %userroles = ( |
Line 4041 sub role_status {
|
Line 4046 sub role_status {
|
my ($author,$adv)= &set_userprivs(\%userroles,\%allroles,\%allgroups); |
my ($author,$adv)= &set_userprivs(\%userroles,\%allroles,\%allgroups); |
&appenv(\%userroles,[$$role,'cm']); |
&appenv(\%userroles,[$$role,'cm']); |
&log($env{'user.domain'},$env{'user.name'},$env{'user.home'},"Role ".$role); |
&log($env{'user.domain'},$env{'user.name'},$env{'user.home'},"Role ".$role); |
$$tstatus = 'is'; |
|
} |
} |
} |
} |
|
$$tstatus = 'is'; |
} |
} |
} |
} |
if ($$tend) { |
if ($$tend) { |
Line 4836 sub is_advanced_user {
|
Line 4841 sub is_advanced_user {
|
return $is_adv; |
return $is_adv; |
} |
} |
|
|
|
sub check_can_request { |
|
my ($dom,$can_request,$request_domains) = @_; |
|
my $canreq = 0; |
|
my ($types,$typename) = &Apache::loncommon::course_types(); |
|
my @options = ('approval','validate','autolimit'); |
|
my $optregex = join('|',@options); |
|
if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { |
|
foreach my $type (@{$types}) { |
|
if (&usertools_access($env{'user.name'}, |
|
$env{'user.domain'}, |
|
$type,undef,'requestcourses')) { |
|
$canreq ++; |
|
if (ref($request_domains) eq 'HASH') { |
|
push(@{$request_domains->{$type}},$env{'user.domain'}); |
|
} |
|
if ($dom eq $env{'user.domain'}) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
|
my @curr = split(',',$env{'environment.reqcrsotherdom.'.$type}); |
|
if (@curr > 0) { |
|
foreach my $item (@curr) { |
|
if (ref($request_domains) eq 'HASH') { |
|
my ($otherdom) = ($item =~ /^($match_domain):($optregex)(=?\d*)$/); |
|
if ($otherdom ne '') { |
|
if (ref($request_domains->{$type}) eq 'ARRAY') { |
|
unless (grep(/^\Q$otherdom\E$/,@{$request_domains->{$type}})) { |
|
push(@{$request_domains->{$type}},$otherdom); |
|
} |
|
} else { |
|
push(@{$request_domains->{$type}},$otherdom); |
|
} |
|
} |
|
} |
|
} |
|
unless($dom eq $env{'user.domain'}) { |
|
$canreq ++; |
|
if (grep(/^\Q$dom\E:($optregex)(=?\d*)$/,@curr)) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return $canreq; |
|
} |
|
|
# ---------------------------------------------- Custom access rule evaluation |
# ---------------------------------------------- Custom access rule evaluation |
|
|
sub customaccess { |
sub customaccess { |
Line 8218 sub symbverify {
|
Line 8272 sub symbverify {
|
|
|
if (tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
if (tie(%bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
&GDBM_READER(),0640)) { |
&GDBM_READER(),0640)) { |
|
if (($thisurl =~ m{^/adm/wrapper/ext/}) || ($thisurl =~ m{^ext/})) { |
|
$thisurl =~ s/\?.+$//; |
|
} |
my $ids=$bighash{'ids_'.&clutter($thisurl)}; |
my $ids=$bighash{'ids_'.&clutter($thisurl)}; |
unless ($ids) { |
unless ($ids) { |
$ids=$bighash{'ids_/'.$thisurl}; |
$ids=$bighash{'ids_/'.$thisurl}; |
Line 8226 sub symbverify {
|
Line 8283 sub symbverify {
|
# ------------------------------------------------------------------- Has ID(s) |
# ------------------------------------------------------------------- Has ID(s) |
foreach my $id (split(/\,/,$ids)) { |
foreach my $id (split(/\,/,$ids)) { |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
|
if ($thisfn =~ m{^/adm/wrapper/ext/}) { |
|
$symb =~ s/\?.+$//; |
|
} |
if ( |
if ( |
&symbclean(&declutter($bighash{'map_id_'.$mapid}).'___'.$resid.'___'.$thisfn) |
&symbclean(&declutter($bighash{'map_id_'.$mapid}).'___'.$resid.'___'.$thisfn) |
eq $symb) { |
eq $symb) { |
Line 9102 sub declutter {
|
Line 9162 sub declutter {
|
$thisfn=~s|^adm/wrapper/||; |
$thisfn=~s|^adm/wrapper/||; |
$thisfn=~s|^adm/coursedocs/showdoc/||; |
$thisfn=~s|^adm/coursedocs/showdoc/||; |
$thisfn=~s/^res\///; |
$thisfn=~s/^res\///; |
$thisfn=~s/\?.+$//; |
unless (($thisfn =~ /^ext/) || ($thisfn =~ /\.(page|sequence)___\d+___ext/)) { |
|
$thisfn=~s/\?.+$//; |
|
} |
return $thisfn; |
return $thisfn; |
} |
} |
|
|