[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn raeburn at source.lon-capa.org
Thu Dec 27 13:31:10 EST 2012


raeburn		Thu Dec 27 18:31:10 2012 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Coordinator switching course role to custom role.
    - Set privs for adhoc role.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.277 loncom/auth/lonroles.pm:1.278
--- loncom/auth/lonroles.pm:1.277	Mon Dec  3 22:59:03 2012
+++ loncom/auth/lonroles.pm	Thu Dec 27 18:31:09 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.277 2012/12/03 22:59:03 raeburn Exp $
+# $Id: lonroles.pm,v 1.278 2012/12/27 18:31:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1656,6 +1656,11 @@
                 $setprivs = 1;
             }
         }
+        unless ($setprivs) {
+            if (!exists($env{'user.priv.'.$env{'form.switchrole'}.'./'})) {
+                $setprivs = 1;
+            }
+        }
         if ($setprivs) {
             if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
                 my $role = $1;
@@ -1683,7 +1688,11 @@
                     $spec .= '/'.$usec;
                     $area .= '/'.$usec;
                 }
-                &Apache::lonnet::standard_roleprivs(\%newrole,$role,$cdom,$spec,$cnum,$area);
+                if ($role =~ /^cr/) {
+                    &Apache::lonnet::custom_roleprivs(\%newrole,$role,$cdom,$cnum,$spec,$area);
+                } else {
+                    &Apache::lonnet::standard_roleprivs(\%newrole,$role,$cdom,$spec,$cnum,$area);
+                }
                 &Apache::lonnet::set_userprivs(\%userroles,\%newrole,\%newgroups);
                 my $adhocstart = $refresh-1;
                 $userroles{'user.role.'.$spec} = $adhocstart.'.';




More information about the LON-CAPA-cvs mailing list