--- loncom/auth/lonroles.pm 2008/07/04 19:26:35 1.197
+++ loncom/auth/lonroles.pm 2008/07/08 20:16:16 1.200
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.197 2008/07/04 19:26:35 raeburn Exp $
+# $Id: lonroles.pm,v 1.200 2008/07/08 20:16:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -866,7 +866,7 @@ sub print_rolerows {
sub findcourse_advice {
my ($r) = @_;
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
- if (&check_autoenroll($env{'user.domain'})) {
+ if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {
$r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
- '.&mt('The course has yet to be created.').'
@@ -1073,22 +1073,22 @@ sub adhoc_course_role {
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
if (&check_forcc($cdom,$cnum,$then)) {
my $setprivs;
- if (!defined($env{'user.role.'.$env{'form.selectrole'}})) {
+ if (!defined($env{'user.role.'.$env{'form.switchrole'}})) {
$setprivs = 1;
} else {
- my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.selectrole'}});
+ my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}});
if (($start && ($start>$then || $start == -1)) ||
($end && $end<$then)) {
$setprivs = 1;
}
}
if ($setprivs) {
- if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E(/?\w*)$-) {
+ if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
my $role = $1;
my $custom_role = $2;
my $usec = $3;
if ($role eq 'cr') {
- if ($custom_role =~ m-^$match_domain/$match_courseid/\w+$-) {
+ if ($custom_role =~ m-^/$match_domain/$match_username/\w+$-) {
$role .= $custom_role;
} else {
return;
@@ -1288,24 +1288,6 @@ sub courseloadpage {
return $startpage;
}
-sub check_autoenroll {
- my ($dom) = @_;
- my $run_enroll = 0;
- my $settings;
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
- if (ref($domconfig{'autoenroll'}) eq 'HASH') {
- $settings = $domconfig{'autoenroll'};
- if ($settings->{'run'} eq '1') {
- $run_enroll = 1;
- }
- } else {
- $run_enroll = &localenroll::run($dom);
- }
- return $run_enroll;
-}
-
-
1;
__END__