';
- foreach my $level ('course','domain','system') {
- if ($customroles{$key}{$level}) {
- my $suffix;
- if (($level eq 'domain') || ($level eq 'system')) {
- $suffix = ' ('.&mt($level).')';
- }
- my @privs = split(/:/,$customroles{$key}{$level});
- foreach my $item (@privs) {
- next if ($item eq '');
- my ($priv,$cond) = split(/\&/,$item);
- $output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.' ';
- }
- }
- }
- $output .= '
'.
- &Apache::loncommon::end_data_table_row();
- }
- $output .= &Apache::loncommon::end_data_table();
- }
- return $output;
-}
-
sub courserequest_titles {
my %titles = &Apache::lonlocal::texthash (
official => 'Official',
@@ -604,6 +548,7 @@ sub courserequest_titles {
community => 'Communities',
textbook => 'Textbook',
placement => 'Placement Tests',
+ lti => 'LTI Provider',
norequest => 'Not allowed',
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
@@ -708,7 +653,8 @@ sub curr_requestauthor {
# =================================================================== Phase one
sub print_username_entry_form {
- my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum) = @_;
+ my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum,
+ $permission) = @_;
my $defdom=$env{'request.role.domain'};
my $formtoset = 'crtuser';
if (exists($env{'form.startrolename'})) {
@@ -734,13 +680,27 @@ sub print_username_entry_form {
}
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'custom') {
- $helpitem = 'Course_Editing_Custom_Roles';
+ if ($context eq 'course') {
+ $helpitem = 'Course_Editing_Custom_Roles';
+ } elsif ($context eq 'domain') {
+ $helpitem = 'Domain_Editing_Custom_Roles';
+ }
} elsif ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
} elsif ($env{'form.action'} eq 'accesslogs') {
$helpitem = 'Domain_User_Access_Logs';
+ } elsif ($context eq 'author') {
+ $helpitem = 'Author_Change_Privileges';
+ } elsif ($context eq 'domain') {
+ if ($permission->{'cusr'}) {
+ $helpitem = 'Domain_Change_Privileges';
+ } elsif ($permission->{'view'}) {
+ $helpitem = 'Domain_View_Privileges';
+ } else {
+ undef($helpitem);
+ }
}
- my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$defdom);
if ($env{'form.action'} eq 'custom') {
push(@{$brcrum},
{href=>"javascript:backPage(document.crtuser)",
@@ -768,6 +728,7 @@ sub print_username_entry_form {
'srst' => 'Search for a user and enroll as a student',
'srme' => 'Search for a user and enroll as a member',
'srad' => 'Search for a user and modify/add user information or roles',
+ 'srvu' => 'Search for a user and view user information and roles',
'srva' => 'Search for a user and view access log information',
'usr' => "Username",
'dom' => "Domain",
@@ -815,6 +776,7 @@ sub print_username_entry_form {
}
} else {
my $actiontext = $lt{'srad'};
+ my $fixeddom;
if ($env{'form.action'} eq 'singlestudent') {
if ($crstype eq 'Community') {
$actiontext = $lt{'srme'};
@@ -823,6 +785,11 @@ sub print_username_entry_form {
}
} elsif ($env{'form.action'} eq 'accesslogs') {
$actiontext = $lt{'srva'};
+ $fixeddom = 1;
+ } elsif (($env{'form.action'} eq 'singleuser') &&
+ ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$defdom))) {
+ $actiontext = $lt{'srvu'};
+ $fixeddom = 1;
}
$r->print("
$actiontext
");
if ($env{'form.origform'} ne 'crtusername') {
@@ -831,7 +798,7 @@ sub print_username_entry_form {
' ');
}
}
- $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype,1));
+ $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype,$fixeddom));
}
}
@@ -890,11 +857,16 @@ sub entry_form {
$inexact = 1;
}
}
- my $cancreate =
- &Apache::lonuserutils::can_create_user($dom,$context,$usertype);
+ my ($cancreate,$noinstd);
+ if ($env{'form.action'} eq 'accesslogs') {
+ $noinstd = 1;
+ } else {
+ $cancreate =
+ &Apache::lonuserutils::can_create_user($dom,$context,$usertype);
+ }
my ($userpicker,$cansearch) =
&Apache::loncommon::user_picker($dom,$srch,$forcenewuser,
- 'document.crtuser',$cancreate,$usertype,$context,$fixeddom);
+ 'document.crtuser',$cancreate,$usertype,$context,$fixeddom,$noinstd);
my $srchbutton = &mt('Search');
if ($env{'form.action'} eq 'singlestudent') {
$srchbutton = &mt('Search and Enroll');
@@ -916,9 +888,19 @@ ENDBLOCK
} else {
$output = '
'.$userpicker.'
';
}
- if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs')) {
+ if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs') &&
+ (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') &&
+ (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) {
my $defdom=$env{'request.role.domain'};
- my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
+ my ($trusted,$untrusted);
+ if ($context eq 'course') {
+ ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$defdom);
+ } elsif ($context eq 'author') {
+ ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('othcoau',$defdom);
+ } elsif ($context eq 'domain') {
+ ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('domroles',$defdom);
+ }
+ my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain',undef,undef,undef,$trusted,$untrusted);
my %lt=&Apache::lonlocal::texthash(
'enro' => 'Enroll one student',
'enrm' => 'Enroll one member',
@@ -1033,7 +1015,9 @@ ENDSCRIPT
'stusrch' => "User Search to enroll student",
'memsrch' => "User Search to enroll member",
'srcva' => "Search for a user and view access log information",
+ 'usrvu' => "User Search to view user roles",
'usel' => "Select a user to add/modify roles",
+ 'suvr' => "Select a user to view roles",
'stusel' => "Select a user to enroll as a student",
'memsel' => "Select a user to enroll as a member",
'vacsel' => "Select a user to view access log",
@@ -1046,12 +1030,16 @@ ENDSCRIPT
if ($context eq 'requestcrs') {
$r->print('
'
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
- .' '
- .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
- ,'','')
- .'
';
+ .' ';
+ if ($context eq 'domain') {
+ $response .= &mt('Please contact a [_1] for assistance.',
+ &Apache::lonnet::plaintext('dc'));
+ } else {
+ $response .= &mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'','');
+ }
+ $response .= ' ';
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum,
+ $permission);
return;
}
$newuser = 1;
@@ -1236,7 +1241,8 @@ sub print_user_modification_page {
'username');
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum,
+ $permission);
return;
}
}
@@ -1257,10 +1263,14 @@ sub print_user_modification_page {
my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
$groupslist,$newuser,$formname,\%loaditem);
- my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
+ } elsif ($context eq 'author') {
+ $helpitem = 'Author_Change_Privileges';
+ } elsif ($context eq 'domain') {
+ $helpitem = 'Domain_Change_Privileges';
}
push (@{$brcrum},
{href => "javascript:backPage($form)",
@@ -1323,7 +1333,7 @@ ENDFORMINFO
}
my $title = '';
if ($newuser) {
- my ($portfolioform,$domroleform,$adhocroleform);
+ my ($portfolioform,$domroleform);
if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||
(&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {
# Current user has quota or user tools modification privileges
@@ -1333,12 +1343,6 @@ ENDFORMINFO
($ccdomain eq $env{'request.role.domain'})) {
$domroleform = ' '.&domainrole_req($ccuname,$ccdomain);
}
- if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {
- $adhocroleform = &domadhocroles($ccuname,$ccdomain);
- if ($adhocroleform) {
- $adhocroleform = ' '.$adhocroleform;
- }
- }
&initialize_authen_forms($ccdomain,$formname);
my %lt=&Apache::lonlocal::texthash(
'lg' => 'Login Data',
@@ -1449,7 +1453,7 @@ ENDAUTH
} else {
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
}
- $r->print($portfolioform.$domroleform.$adhocroleform);
+ $r->print($portfolioform.$domroleform);
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname,
$permission,$crstype,$ccuname,
@@ -1467,40 +1471,51 @@ ENDAUTH
'"'.$ccuname.'"','"'.$ccdomain.'"');
}
} else {
- $title = &mt('Modify existing user: [_1] in domain [_2]',
+ if ($permission->{'cusr'}) {
+ $title = &mt('Modify existing user: [_1] in domain [_2]',
'"'.$ccuname.'"','"'.$ccdomain.'"');
+ } else {
+ $title = &mt('Existing user: [_1] in domain [_2]',
+ '"'.$ccuname.'"','"'.$ccdomain.'"');
+ }
}
$r->print('
'.$title.'
'."\n");
$r->print('
');
$r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context,
$inst_results{$ccuname.':'.$ccdomain}));
- if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
- $r->print('
'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'
'.
- &Apache::loncommon::start_data_table());
- if ($env{'request.role.domain'} eq $ccdomain) {
- $r->print(&build_tools_display($ccuname,$ccdomain,'requestcourses'));
+ if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
+ $r->print('
'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'
'."\n");
+ if (($env{'request.role.domain'} eq $ccdomain) ||
+ (&Apache::lonnet::will_trust('reqcrs',$ccdomain,$env{'request.role.domain'}))) {
+ $r->print(&Apache::loncommon::start_data_table());
+ if ($env{'request.role.domain'} eq $ccdomain) {
+ $r->print(&build_tools_display($ccuname,$ccdomain,'requestcourses'));
+ } else {
+ $r->print(&coursereq_externaluser($ccuname,$ccdomain,
+ $env{'request.role.domain'}));
+ }
+ $r->print(&Apache::loncommon::end_data_table());
} else {
- $r->print(&coursereq_externaluser($ccuname,$ccdomain,
- $env{'request.role.domain'}));
+ $r->print(&mt('Domain configuration for this domain prohibits course creation by users from domain: "[_1]"',
+ &Apache::lonnet::domain($ccdomain,'description')));
}
- $r->print(&Apache::loncommon::end_data_table());
}
$r->print('
');
- my @order = ('auth','quota','tools','requestauthor','adhocroles');
+ my @order = ('auth','quota','tools','requestauthor');
my %user_text;
my ($isadv,$isauthor) =
- &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
+ &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
if ((!$isauthor) &&
- (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))
- && ($env{'request.role.domain'} eq $ccdomain)) {
+ ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&
+ ($env{'request.role.domain'} eq $ccdomain)) {
$user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
}
- if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {
- $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain);
- }
- $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname);
+ $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname,$crstype,$permission);
if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
- (&Apache::lonnet::allowed('mut',$ccdomain))) {
+ (&Apache::lonnet::allowed('mut',$ccdomain)) ||
+ (&Apache::lonnet::allowed('udp',$ccdomain))) {
# Current user has quota modification privileges
$user_text{'quota'} = &user_quotas($ccuname,$ccdomain);
}
@@ -1558,9 +1573,18 @@ ENDNOTOOLSPRIV
if ($gotdiv) {
$r->print('
');
}
+ my $statuses;
+ if (($context eq 'domain') && (&Apache::lonnet::allowed('udp',$ccdomain)) &&
+ (!&Apache::lonnet::allowed('mau',$ccdomain))) {
+ $statuses = ['active'];
+ } elsif (($context eq 'course') && ((&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) ||
+ ($env{'request.course.sec'} &&
+ &Apache::lonnet::allowed('vcl',$env{'request.course.id'}.'/'.$env{'request.course.sec'})))) {
+ $statuses = ['active'];
+ }
if ($env{'form.action'} ne 'singlestudent') {
&display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context,
- $roledom,$crstype);
+ $roledom,$crstype,$showcredits,$statuses);
}
} ## End of new user/old user logic
if ($env{'form.action'} eq 'singlestudent') {
@@ -1571,7 +1595,7 @@ ENDNOTOOLSPRIV
$btntxt = &mt('Enroll Student');
}
$r->print(' '."\n");
- } else {
+ } elsif ($permission->{'cusr'}) {
$r->print('