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

raeburn raeburn at source.lon-capa.org
Sat Jan 28 16:35:54 EST 2017


raeburn		Sat Jan 28 21:35:54 2017 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm loncreateuser.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Access options for ad hoc roles for helpdesk personnel set at domain level 
    (with override within a course), expanded to differentiate availability to 
    Domain Helpdesk or Domain Helpdesk Assistant.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.290 loncom/interface/domainprefs.pm:1.291
--- loncom/interface/domainprefs.pm:1.290	Sat Jan 28 03:48:44 2017
+++ loncom/interface/domainprefs.pm	Sat Jan 28 21:35:49 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.290 2017/01/28 03:48:44 raeburn Exp $
+# $Id: domainprefs.pm,v 1.291 2017/01/28 21:35:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3250,7 +3250,7 @@
         my $context = 'domprefs';
         my $crstype = 'Course';
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
-        my @accesstypes = ('all','none');
+        my @accesstypes = ('all','anydh','anyda','none');
         my ($numstatustypes, at jsarray);
         if (ref($types) eq 'ARRAY') {
             if (@{$types} > 0) {
@@ -3468,7 +3468,7 @@
                 shown = Array('notinc');
                 hidden = Array('notexc','bystatus');
             }
-            if (curraccess == 'all') {
+            if ((curraccess == 'all') || (curraccess == 'anydh') || (curraccess == 'anyda'))  {
                 hidden = Array('notinc','notexc','bystatus');
             }
         }
@@ -3525,7 +3525,9 @@
     my %lt = &Apache::lonlocal::texthash(
                     'rou'    => 'Role usage',
                     'whi'    => 'Which helpdesk personnel may use this role?',
-                    'all'    => 'All',
+                    'all'    => "All with domain helpdesk or helpdesk assistant role',
+                    'anydh'  => "All with domain helpdesk role',
+                    'anyda'  => "All with domain helpdesk assistant role',
                     'none'   => 'None',
                     'status' => 'Determined based on institutional status',
                     'inc'    => 'Include all, but exclude specific personnel',
@@ -12457,14 +12459,16 @@
     my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_');
     my (@allpos,%newsettings,%changedprivs,$newrole);
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
-    my @accesstypes = ('all','none','status','inc','exc');
+    my @accesstypes = ('all','anydh','anyda','none','status','inc','exc');
     my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh','da']);
     my %lt = &Apache::lonlocal::texthash(
                     s      => 'system',
                     d      => 'domain',
                     order  => 'Display order',
                     access => 'Role usage',
-                    all    => 'All',
+                    all    => 'All with domain helpdesk or helpdesk assistant role',
+                    anydh  => 'All with domain helpdesk role',
+                    anyda  => 'All with domain helpdesk assistant role',
                     none   => 'None',
                     status => 'Determined based on institutional status',
                     inc    => 'Include all, but exclude specific personnel',
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.432 loncom/interface/loncreateuser.pm:1.433
--- loncom/interface/loncreateuser.pm:1.432	Sat Jan 28 03:48:44 2017
+++ loncom/interface/loncreateuser.pm	Sat Jan 28 21:35:49 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.432 2017/01/28 03:48:44 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.433 2017/01/28 21:35:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7207,7 +7207,7 @@
     my $confname = $cdom.'-domainconfig';
     my $crstype = &Apache::loncommon::course_type();
 
-    my @accesstypes = ('all','none');
+    my @accesstypes = ('all','anydh','anyda','none');
     my ($numstatustypes, at jsarray);
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($cdom);
     if (ref($types) eq 'ARRAY') {
@@ -7416,7 +7416,9 @@
                     'rou'    => 'Role usage',
                     'whi'    => 'Which helpdesk personnel may use this role?',
                     'udd'    => 'Use domain default',
-                    'all'    => 'All',
+                    'all'    => 'All with domain helpdesk or helpdesk assistant role',
+                    'anydh'  => 'All with domain helpdesk role',
+                    'anyda'  => 'All with domain helpdesk assistant role',
                     'none'   => 'None',
                     'status' => 'Determined based on institutional status',
                     'inc'    => 'Include all, but exclude specific personnel',
@@ -7659,6 +7661,10 @@
                 }
             } elsif ($access eq 'none') {
                 $domusage{$role} = &mt('No one in the domain');
+            } elsif ($access eq 'anydh') {
+                $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('dh'));
+            } elsif ($access eq 'anyda') {
+                $domusage{$role} = &mt('Any user in domain with active [_1] role',&Apache::lonnet::plaintext('da'));
             } elsif ($access eq 'all') {
                 $domusage{$role} = &mt('Any user in domain with active [_1] or [_2] role',
                                        &Apache::lonnet::plaintext('dh'),&Apache::lonnet::plaintext('da'));
@@ -7846,7 +7852,7 @@
         $r->print('<p class="LC_error">'.&mt('You do not have permission to change helpdesk access.').'</p>');
         return;
     }
-    my @accesstypes = ('all','none','status','inc','exc');
+    my @accesstypes = ('all','anydh','anyda','none','status','inc','exc');
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
     my $confname = $cdom.'-domainconfig';
@@ -8097,6 +8103,12 @@
                         if ($env{'form.'.$role.'_incrs'}) {
                             if ($newsettings{$role}{'access'} eq 'all') {
                                 $r->print(&mt('All helpdesk staff can access '.lc($crstype).' with this role.'));
+                            } elsif ($newsettings{$role}{'access'} eq 'anydh') {
+                                $r->print(&mt('Helpdesk staff can use this role if they have an active [_1] role',
+                                              &Apache::lonnet::plaintext('dh')));
+                            } elsif ($newsettings{$role}{'access'} eq 'anyda') {
+                                $r->print(&mt('Helpdesk staff can use this role if they have an active [_1] role',
+                                              &Apache::lonnet::plaintext('da')));
                             } elsif ($newsettings{$role}{'access'} eq 'none') {
                                 $r->print(&mt('No helpdesk staff can access '.lc($crstype).' with this role.'));
                             } elsif ($newsettings{$role}{'access'} eq 'status') {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1334 loncom/lonnet/perl/lonnet.pm:1.1335
--- loncom/lonnet/perl/lonnet.pm:1.1334	Sat Jan 28 03:49:00 2017
+++ loncom/lonnet/perl/lonnet.pm	Sat Jan 28 21:35:54 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1334 2017/01/28 03:49:00 raeburn Exp $
+# $Id: lonnet.pm,v 1.1335 2017/01/28 21:35:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4550,20 +4550,26 @@
         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;
+            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 ($tstart,$tend)=split(/\./,$env{"user.role.$role./$cdom/"});
                     my $limit = $update;
                     if ($env{'request.role'} eq "$role./$cdom/") {
                         $limit = $then;
                     }
-                    if ($tstart && $tstart>$limit) { $liverole = 0; }
-                    if ($tend   && $tend  <$limit) { $liverole = 0; }
-                    last if ($liverole);
+                    my $activerole = 1;
+                    if ($tstart && $tstart>$limit) { $activerole = 0; }
+                    if ($tend   && $tend  <$limit) { $activerole = 0; }
+                    if ($activerole) {
+                        push(@liveroles,$role);
+                    }
                 }
             }
-            if ($liverole) {
+            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);
@@ -4618,6 +4624,18 @@
                                     next;
                                 } elsif ($curraccess eq 'all') {
                                     push(@possroles,$role);
+                                } elsif ($curraccess eq 'anydh') {
+                                    if (grep(/^dh$/, at liveroles)) {
+                                        push(@possroles,$role);
+                                    } else {
+                                        next;
+                                    }
+                                } elsif ($curraccess eq 'anyda') {
+                                    if (grep(/^da$/, at liveroles)) {
+                                        push(@possroles,$role);
+                                    } else {
+                                        next;
+                                    }
                                 } elsif ($curraccess eq 'status') {
                                     if (@okstatus) {
                                         if (!@statuses) {


More information about the LON-CAPA-cvs mailing list