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

raeburn raeburn at source.lon-capa.org
Sat Aug 31 16:02:12 EDT 2024


raeburn		Sat Aug 31 20:02:12 2024 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm 
  Log:
  - Bug 5273
    - Display who is a co-author manager in "List Users" display for an Authoring
      Space when accessed by a co-author manager.
    - Which user infromation fields may be modified for a co-author by a co-author
      manager is a domain configuration.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.221 loncom/interface/lonuserutils.pm:1.222
--- loncom/interface/lonuserutils.pm:1.221	Fri Jan  5 04:01:40 2024
+++ loncom/interface/lonuserutils.pm	Sat Aug 31 20:02:12 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.221 2024/01/05 04:01:40 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.222 2024/08/31 20:02:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2844,6 +2844,7 @@
             ($userdata{'username'},$userdata{'domain'},$userdata{'role'}) =
                 split(/:/,$item);
             ($userdata{'start'},$userdata{'end'})=split(/:/,$rolehash->{$item});
+            next if (($userdata{'username'} eq '') && ($userdata{'domain'} eq ''));
             &build_user_record($context,\%userdata,$userinfo,$indexhash,
                                $item,$userlist);
         } elsif ($context eq 'course') {
@@ -3522,7 +3523,16 @@
         # If this is for a single course get last course "log-in".
         %crslogins=&Apache::lonnet::dump('nohist_crslastlogin',$cdom,$cnum);
     } elsif ($context eq 'author') {
-        map { $camanagers{$_.':ca'} = 1; } split(/,/,$env{'environment.authormanagers'});
+        my $authormanagers;
+        if ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)$}) {
+            my %envhash = &Apache::lonnet::userenvironment($1,$2,'authormanagers');
+            $authormanagers = $envhash{'authormanagers'};
+        } else {
+            $authormanagers = $env{'environment.authormanagers'};
+        }
+        if ($authormanagers ne '') {
+            map { $camanagers{$_.':ca'} = 1; } split(/,/,$authormanagers);
+        }
     }
     # Get groups, role, permanent e-mail so we can sort on them if
     # necessary.
@@ -4450,10 +4460,16 @@
             $description .= ' ('.$constraint.')';
         } 
     } elsif ($context eq 'author') {
+        my ($auname,$audom);
+        if ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)$}) {
+            ($audom,$auname) = ($1,$2);
+        } else {
+            ($audom,$auname) = ($env{'user.domain'},$env{'user.name'});
+        }
         $description = 
             &mt('Author space for [_1]'
                 ,'<span class="LC_cusr_emph">'
-                .&Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'})
+                .&Apache::loncommon::plainname($auname,$audom)
                 .'</span>')
             .':  ';
         if ($statusmode eq 'Expired') {
@@ -6674,6 +6690,10 @@
     my %domconfig =
        &Apache::lonnet::get_dom('configuration',['usermodification'],
                                 $dom);
+    if (($context eq 'author') &&
+        ($env{'request.role'} =~ m{^(ca|aa)\./$match_domain/$match_username$})) {
+        $context = 'coauthor';
+    }
     my %canmodify;
     if (ref($fields) eq 'ARRAY') {
         foreach my $field (@{$fields}) {




More information about the LON-CAPA-cvs mailing list