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

raeburn raeburn at source.lon-capa.org
Sun Mar 26 18:19:25 EDT 2017


raeburn		Sun Mar 26 22:19:25 2017 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - User access logs for privileged users can only be displayed by other 
    priviliged users in the domain.
  - Client IP address for webDAV logins included in user access logs display.  
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.436 loncom/interface/loncreateuser.pm:1.437
--- loncom/interface/loncreateuser.pm:1.436	Sun Mar 26 22:11:54 2017
+++ loncom/interface/loncreateuser.pm	Sun Mar 26 22:19:24 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.436 2017/03/26 22:11:54 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.437 2017/03/26 22:19:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6767,6 +6767,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);
@@ -6853,7 +6871,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 '');
@@ -6905,8 +6923,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