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

raeburn raeburn@source.lon-capa.org
Sat, 05 Sep 2009 01:13:02 -0000


raeburn		Sat Sep  5 01:13:02 2009 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm lonuserutils.pm 
  Log:
  - 'ad' role is a "course" role which can only be assigned by  Domain Coordinator in the course's domain.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.311 loncom/interface/loncreateuser.pm:1.312
--- loncom/interface/loncreateuser.pm:1.311	Fri Aug 28 00:02:37 2009
+++ loncom/interface/loncreateuser.pm	Sat Sep  5 01:13:02 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.311 2009/08/28 00:02:37 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.312 2009/09/05 01:13:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1559,8 +1559,10 @@
     &mt('Extent').'</th>'.
     '<th>'.&mt('Start').'</th><th>'.&mt('End').'</th>'.
     &Apache::loncommon::end_data_table_header_row();
+    my @allroles = &Apache::lonuserutils::roles_by_context('domain');
     foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) {
-        foreach my $role ('dc','li','dg','au','sc') {
+        foreach my $role (@allroles) {
+            next if ($role eq 'ad');
             if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) {
                my $plrole=&Apache::lonnet::plaintext($role);
                my %lt=&Apache::lonlocal::texthash(
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.98 loncom/interface/lonuserutils.pm:1.99
--- loncom/interface/lonuserutils.pm:1.98	Fri Aug 28 22:47:07 2009
+++ loncom/interface/lonuserutils.pm	Sat Sep  5 01:13:02 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.98 2009/08/28 22:47:07 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.99 2009/09/05 01:13:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4846,14 +4846,18 @@
     my ($context,$custom) = @_;
     my @allroles;
     if ($context eq 'course') {
-        @allroles = ('st','ad','ta','ep','in','cc');
+        @allroles = ('st');
+        if ($env{'request.role'} =~ m{^dc\./}) {
+            push(@allroles,'ad');
+        }
+        push(@allroles,('ta','ep','in','cc'));
         if ($custom) {
             push(@allroles,'cr');
         }
     } elsif ($context eq 'author') {
         @allroles = ('ca','aa');
     } elsif ($context eq 'domain') {
-        @allroles = ('li','dg','sc','au','dc');
+        @allroles = ('li','ad','dg','sc','au','dc');
     }
     return @allroles;
 }