[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Mon Jan 30 14:29:58 EST 2017


raeburn		Mon Jan 30 19:29:58 2017 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - For 2.11
    - Backport 1.1334, 1.1335, 1.1336.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1172.2.89 loncom/lonnet/perl/lonnet.pm:1.1172.2.90
--- loncom/lonnet/perl/lonnet.pm:1.1172.2.89	Sun Jan 22 17:41:07 2017
+++ loncom/lonnet/perl/lonnet.pm	Mon Jan 30 19:29:57 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1172.2.89 2017/01/22 17:41:07 raeburn Exp $
+# $Id: lonnet.pm,v 1.1172.2.90 2017/01/30 19:29:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3917,7 +3917,7 @@
         }
     }
 #
-# Reverse lookup of domain roles (dc, ad, li, sc, dh, au)
+# Reverse lookup of domain roles (dc, ad, li, sc, dh, da, au)
 #
     my %domrolebuffer = ();
     foreach my $entry (keys(%domainrolehash)) {
@@ -4064,7 +4064,7 @@
          {$trole.':'.$username.':'.$domain.':'.$env{'user.name'}.':'.$env{'user.domain'}.':'}
                     =$tend.':'.$tstart;
     }
-    if ($trole =~ /^(dc|ad|li|au|dg|sc|dh)/ ) {
+    if ($trole =~ /^(dc|ad|li|au|dg|sc|dh|da)/ ) {
        my (undef,$rudom,$runame,$rsec)=split(/\//,$area);
        $domainrolehash
          {$trole.':'.$username.':'.$domain.':'.$runame.':'.$rudom.':'.$rsec}
@@ -4348,18 +4348,29 @@
         }
     }
     if (($cdom ne '') && ($cnum ne ''))  {
-        if ($env{"user.role.dh./$cdom/"}) {
+        if (($env{"user.role.dh./$cdom/"}) || ($env{"user.role.da./$cdom/"})) {
             my $then=$env{'user.login.time'};
             my $update=$env{'user.update.time'};
-            my $liverole = 1;
-            my ($tstart,$tend)=split(/\./,$env{'user.role.dh./'.$cdom});
-            my $limit = $update;
-            if ($env{'request.role'} eq 'dh./'.$cdom.'/') {
-                $limit = $then;
-            }
-            if ($tstart && $tstart>$limit) { $liverole = 0; }
-            if ($tend   && $tend  <$limit) { $liverole = 0; }
-            if ($liverole) {
+            if (!$update) {
+                $update = $then;
+            }
+            my @liveroles;
+            foreach my $role ('dh','da') {
+                if ($env{"user.role.$role./$cdom/"}) {
+                    my ($tstart,$tend)=split(/\./,$env{"user.role.$role./$cdom/"});
+                    my $limit = $update;
+                    if ($env{'request.role'} eq "$role./$cdom/") {
+                        $limit = $then;
+                    }
+                    my $activerole = 1;
+                    if ($tstart && $tstart>$limit) { $activerole = 0; }
+                    if ($tend   && $tend  <$limit) { $activerole = 0; }
+                    if ($activerole) {
+                        push(@liveroles,$role);
+                    }
+                }
+            }
+            if (@liveroles) {
                 if (&homeserver($cnum,$cdom) ne 'no_host') {
                     my ($accessref,$accessinfo,%access_in_dom);
                     ($roles_by_num,$description,$accessref,$accessinfo) = &get_all_adhocroles($cdom);
@@ -4414,6 +4425,18 @@
                                     next;
                                 } elsif ($curraccess eq 'all') {
                                     push(@possroles,$role);
+                                } elsif ($curraccess eq 'dh') {
+                                    if (grep(/^dh$/, at liveroles)) {
+                                        push(@possroles,$role);
+                                    } else {
+                                        next;
+                                    }
+                                } elsif ($curraccess eq 'da') {
+                                    if (grep(/^da$/, at liveroles)) {
+                                        push(@possroles,$role);
+                                    } else {
+                                        next;
+                                    }
                                 } elsif ($curraccess eq 'status') {
                                     if (@okstatus) {
                                         if (!@statuses) {
@@ -8997,7 +9020,8 @@
             &courserolelog($role,$uname,$udom,$url,$origstart,$origend,$delflag,
                            $selfenroll,$context);
         } elsif (($role eq 'li') || ($role eq 'dg') || ($role eq 'sc') ||
-                 ($role eq 'au') || ($role eq 'dc') || ($role eq 'dh')) {
+                 ($role eq 'au') || ($role eq 'dc') || ($role eq 'dh') ||
+                 ($role eq 'da')) {
             &domainrolelog($role,$uname,$udom,$url,$origstart,$origend,$delflag,
                            $context);
         } elsif (($role eq 'ca') || ($role eq 'aa')) {




More information about the LON-CAPA-cvs mailing list