--- loncom/interface/slotrequest.pm 2006/03/07 16:15:48 1.49 +++ loncom/interface/slotrequest.pm 2006/03/07 21:37:29 1.50 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for requesting to have slots added to a students record # -# $Id: slotrequest.pm,v 1.49 2006/03/07 16:15:48 albertel Exp $ +# $Id: slotrequest.pm,v 1.50 2006/03/07 21:37:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -550,25 +550,37 @@ sub allowed_slot { } &Apache::lonxml::debug("$slot_name type good"); + my $userallowed=0; # its for a different set of users - if (defined($slot->{'allowedsection'})) { - - return 0; + if (defined($slot->{'allowedsections'})) { + if (!defined($env{'request.role.sec'}) + && grep(/^No section assigned$/, + split(',',$slot->{'allowedsections'}))) { + $userallowed=1; + } + if (defined($env{'request.role.sec'}) + && grep(/^\Q$env{'request.role.sec'}\E$/, + split(',',$slot->{'allowedsections'}))) { + $userallowed=1; + } } - &Apache::lonxml::debug("$slot_name type good"); + &Apache::lonxml::debug("$slot_name sections is $userallowed"); # its for a different set of users - if (defined($slot->{'allowedusers'})) { - - return 0; + if (defined($slot->{'allowedusers'}) + && grep(/^\Q$env{'user.name'}:$env{'user.domain'}\E$/, + split(',',$slot->{'allowedusers'}))) { + $userallowed=1; } - &Apache::lonxml::debug("$slot_name type good"); + &Apache::lonxml::debug("$slot_name user is $userallowed"); + return 0 if (!$userallowed); # not allowed for this resource if (defined($slot->{'symb'}) && $slot->{'symb'} ne $symb) { return 0; } + my $conflict = &check_for_conflict($symb,$slot_name,$slot,$slots, $consumed_uniqueperiods); if ($conflict) {