[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Mon Mar 13 14:48:49 EDT 2017


raeburn		Mon Mar 13 18:48:49 2017 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - lonnet::rolesinit() adds 'user.rar' to %env when user logs in.
    $env{'user.rar'} is 1 if user has rar priv (can receive ad hoc roles),
    i.e., Domain Helpdesk or Domain Helpdesk Assistant, 0 otherwise.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1275 loncom/interface/loncommon.pm:1.1276
--- loncom/interface/loncommon.pm:1.1275	Sat Feb 25 19:50:16 2017
+++ loncom/interface/loncommon.pm	Mon Mar 13 18:48:44 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1275 2017/02/25 19:50:16 raeburn Exp $
+# $Id: loncommon.pm,v 1.1276 2017/03/13 18:48:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5075,7 +5075,7 @@
                                                                 $tdom,$spec,$trest,$area);
                         }
                     }
-                    my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles);
+                    my ($author,$adv,$rar) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles);
                     if ($userroles{'user.priv.'.$checkrole} =~ /evb\&([^\:]*)/) {
                         if ($1) {
                             $no_userblock = 1;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1340 loncom/lonnet/perl/lonnet.pm:1.1341
--- loncom/lonnet/perl/lonnet.pm:1.1340	Mon Mar 13 18:30:12 2017
+++ loncom/lonnet/perl/lonnet.pm	Mon Mar 13 18:48:48 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1340 2017/03/13 18:30:12 raeburn Exp $
+# $Id: lonnet.pm,v 1.1341 2017/03/13 18:48:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5807,9 +5807,10 @@
         }
     }
 
-    @userroles{'user.author', 'user.adv'} = &set_userprivs(\%userroles,
-        \%allroles, \%allgroups);
+    @userroles{'user.author','user.adv','user.rar'} = &set_userprivs(\%userroles,
+                                                          \%allroles, \%allgroups);
     $env{'user.adv'} = $userroles{'user.adv'};
+    $env{'user.rar'} = $userroles{'user.rar'};
 
     return (\%userroles,\%firstaccenv,\%timerintenv);
 }
@@ -5933,6 +5934,7 @@
     my ($userroles,$allroles,$allgroups,$groups_roles) = @_; 
     my $author=0;
     my $adv=0;
+    my $rar=0;
     my %grouproles = ();
     if (keys(%{$allgroups}) > 0) {
         my @groupkeys; 
@@ -5980,6 +5982,7 @@
                     $thesepriv{$privilege}.=$restrictions;
                 }
                 if ($thesepriv{'adv'} eq 'F') { $adv=1; }
+                if ($thesepriv{'rar'} eq 'F') { $rar=1; }
             }
         }
         my $thesestr='';
@@ -5988,7 +5991,7 @@
 	}
         $userroles->{'user.priv.'.$role} = $thesestr;
     }
-    return ($author,$adv);
+    return ($author,$adv,$rar);
 }
 
 sub role_status {
@@ -6033,7 +6036,8 @@
                                 push(@rolecodes,$$role);
                                 &standard_roleprivs(\%allroles,$$role,$tdomain,$spec,$trest,$$where);
                             }
-                            my ($author,$adv)= &set_userprivs(\%userroles,\%allroles,\%allgroups,\%groups_roles);
+                            my ($author,$adv,$rar)= &set_userprivs(\%userroles,\%allroles,\%allgroups,
+                                                                   \%groups_roles);
                             &appenv(\%userroles,\@rolecodes);
                             &log($env{'user.domain'},$env{'user.name'},$env{'user.home'},"Role ".$role);
                         }
@@ -6154,7 +6158,7 @@
     } else {
         &standard_roleprivs(\%rolehash,$role,$dcdom,$spec,$pickedcourse,$area);
     }
-    my ($author,$adv)= &set_userprivs(\%userroles,\%rolehash);
+    my ($author,$adv,$rar)= &set_userprivs(\%userroles,\%rolehash);
     &appenv(\%userroles,[$role,'cm']);
     &log($env{'user.domain'},$env{'user.name'},$env{'user.home'},"Role ".$role);
     unless ($caller eq 'constructaccess' && $env{'request.course.id'}) {




More information about the LON-CAPA-cvs mailing list