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

www lon-capa-cvs@mail.lon-capa.org
Fri, 18 Jul 2003 13:45:14 -0000


www		Fri Jul 18 09:45:14 2003 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Toward bug #795
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.59 loncom/interface/loncreateuser.pm:1.60
--- loncom/interface/loncreateuser.pm:1.59	Thu Jul 17 15:40:39 2003
+++ loncom/interface/loncreateuser.pm	Fri Jul 18 09:45:14 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.59 2003/07/17 19:40:39 www Exp $
+# $Id: loncreateuser.pm,v 1.60 2003/07/18 13:45:14 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,7 +46,7 @@
 # 05/10,10/16 Gerd Kortemeyer 
 # 02/11/02 Matthew Hall
 #
-# $Id: loncreateuser.pm,v 1.59 2003/07/17 19:40:39 www Exp $
+# $Id: loncreateuser.pm,v 1.60 2003/07/18 13:45:14 www Exp $
 ###
 
 package Apache::loncreateuser;
@@ -264,7 +264,7 @@
 $dochead
 <h1>Change User Privileges</h1>
 $forminfo
-<h2>User "$ccuname" in domain $ccdomain </h2>
+<h2>User "$ccuname" in domain "$ccdomain"</h2>
 ENDCHANGEUSER
         # Get the users information
         my %userenv = &Apache::lonnet::get('environment',
@@ -875,6 +875,7 @@
                      'Create Users, Change User Privileges').'<h2>');
     my ($rdummy,$roledef)=
 			 &Apache::lonnet::get('roles',["rolesdef_$rolename"]);
+# ------------------------------------------------------- Does this role exist?
     if (($rdummy ne 'con_lost') && ($roledef ne '')) {
 	$r->print('Existing Role "');
     } else {
@@ -882,6 +883,28 @@
 	$roledef='';
     }
     $r->print($rolename.'"</h2>');
+# ------------------------------------------------------- What can be assigned?
+    my %full=();
+    my %courselevel=();
+    foreach (split(/\:/,$Apache::lonnet::pr{'cr:c'})) {
+	my ($priv,$restrict)=split(/\&/,$_);
+        unless ($restrict) { $restrict='F'; }
+        $courselevel{$priv}=$restrict;
+	$full{$priv}=1;
+    }
+    my %domainlevel=();
+    foreach (split(/\:/,$Apache::lonnet::pr{'cr:d'})) {
+	my ($priv,$restrict)=split(/\&/,$_);
+        unless ($restrict) { $restrict='F'; }
+        $domainlevel{$priv}=$restrict;
+	$full{$priv}=1;
+    }
+    $r->print('<table border="2"><tr><th>Privilege</th><th>Course Level</th><th>Domain Level</th></tr>');
+    foreach (sort keys %full) {
+	$r->print('<tr><td>'.&Apache::lonnet::plaintext($_).'</td><td>'.
+		  $courselevel{$_}.'</td><td>'.$domainlevel{$_}.'</td></tr>');
+    }
+    $r->print('</table>');
     $r->print('Not yet implemented.');
 }