--- loncom/interface/lonuserutils.pm 2007/12/12 19:47:56 1.14 +++ loncom/interface/lonuserutils.pm 2007/12/12 23:59:41 1.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.14 2007/12/12 19:47:56 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.15 2007/12/12 23:59:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1920,7 +1920,7 @@ END $rolefilter = &Apache::lonnet::plaintext($env{'form.showrole'}); } my $results_description = &results_header_row($rolefilter,$statusmode, - $context); + $context,$permission); $r->print(''.$results_description.'
'); my ($output,$actionselect); if ($mode eq 'html' || $mode eq 'view') { @@ -2530,7 +2530,7 @@ END } sub results_header_row { - my ($rolefilter,$statusmode,$context) = @_; + my ($rolefilter,$statusmode,$context,$permission) = @_; my ($description,$showfilter); if ($rolefilter ne 'Any') { $showfilter = $rolefilter; @@ -2550,6 +2550,13 @@ sub results_header_row { $description .= &mt('All users in course with [_1] roles',$rolefilter); } } + if (exists($permission->{'view_section'})) { + if ($env{'form.showrole'} eq 'st') { + $description .= ' '.&mt('(section [_1] only)',$permission->{'view_section'}); + } elsif ($env{'form.showrole'} eq 'any') { + $description .= ' '.&mt('(section [_1] only)',$permission->{'view_section'}); + } + } } elsif ($context eq 'author') { $description = &mt('Author space for [_1]', @@ -3693,5 +3700,28 @@ ENDSECCODE return $setsection_js; } +sub can_create_user { + my ($dom,$context,$usertype) = @_; + my %domconf = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom); + my $cancreate = 1; + if (ref($domconf{'usercreation'}) eq 'HASH') { + if (ref($domconf{'usercreation'}{'cancreate'}) eq 'HASH') { + if ($context eq 'course' || $context eq 'author') { + my $creation = $domconf{'usercreation'}{'cancreate'}{$context}; + if ($creation eq 'none') { + $cancreate = 0; + } elsif ($creation ne 'any') { + if (defined($usertype)) { + if ($creation ne $usertype) { + $cancreate = 0; + } + } + } + } + } + } + return $cancreate; +} + 1;