[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncreateuser.pm

raeburn raeburn at source.lon-capa.org
Sun Mar 26 19:33:46 EDT 2017


raeburn		Sun Mar 26 23:33:46 2017 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncreateuser.pm 
  Log:
  - For 2.11
    - Backport 1.436, 1.437
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.406.2.12 loncom/interface/loncreateuser.pm:1.406.2.13
--- loncom/interface/loncreateuser.pm:1.406.2.12	Mon Jan 30 18:37:34 2017
+++ loncom/interface/loncreateuser.pm	Sun Mar 26 23:33:46 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.406.2.12 2017/01/30 18:37:34 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.406.2.13 2017/03/26 23:33:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -749,6 +749,7 @@
         }
     } else {
         my $actiontext = $lt{'srad'};
+        my $fixeddom;
         if ($env{'form.action'} eq 'singlestudent') {
             if ($crstype eq 'Community') {
                 $actiontext = $lt{'srme'};
@@ -757,6 +758,7 @@
             }
         } 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'};
@@ -768,7 +770,7 @@
                          '<br clear="all" />');
             }
         }
-        $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype,1));
+        $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype,$fixeddom));
     }
 }
 
@@ -6753,6 +6755,24 @@
         return;
     }
 
+    if (&Apache::lonnet::privileged($uname,$udom,
+                                    [$env{'request.role.domain'}],['dc','su'])) {
+        unless (&Apache::lonnet::privileged($env{'user.name'},$env{'user.domain'},
+                                            [$env{'request.role.domain'}],['dc','su'])) {
+            $r->print('<p class="LC_warning">'
+                 .&mt('You need to be a privileged user to display user access logs for [_1]',
+                      &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),
+                                                         $uname,$udom))
+                 .'</p>');
+            if ($env{'form.popup'}) {
+                $r->print('<p><a href="javascript:window.close()">'.&mt('Close window').'</a></p>');
+            } else {
+                $r->print(&earlyout_accesslog_form($formname,$prevphasestr,$udom));
+            }
+            return;
+        }
+    }
+
 # set defaults
     my $now = time();
     my $defstart = $now - (7*24*3600);
@@ -6839,7 +6859,7 @@
                 $showntableheader = 1;
             }
             my ($shown,$extra);
-            my ($event,$data) = split(/\s+/,&unescape($event));
+            my ($event,$data) = split(/\s+/,&unescape($event),2);
             if ($event eq 'Role') {
                 my ($rolecode,$extent) = split(/\./,$data,2);
                 next if ($extent eq '');
@@ -6891,8 +6911,17 @@
                 $shown = &mt('Role selection: [_1]',$rolename);
             } else {
                 $shown = &mt($event);
-                if ($data ne '') {
-                   $extra = &mt('Client IP address: [_1]',$data);
+                if ($data =~ /^webdav/) {
+                    my ($path,$clientip) = split(/\s+/,$data,2);
+                    $path =~ s/^webdav//;
+                    if ($clientip ne '') {
+                        $extra = &mt('Client IP address: [_1]',$clientip);
+                    }
+                    if ($path ne '') {
+                        $shown .= ' '.&mt('(WebDAV access to [_1])',$path);
+                    }
+                } elsif ($data ne '') {
+                    $extra = &mt('Client IP address: [_1]',$data);
                 }
             }
             $r->print(




More information about the LON-CAPA-cvs mailing list