[LON-CAPA-cvs] cvs: loncom / lond /lonnet/perl lonnet.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 29 Aug 2006 21:08:16 -0000


raeburn		Tue Aug 29 17:08:16 2006 EDT

  Modified files:              
    /loncom	lond 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Validation of institutional class identifier (coursecode + section OR crosslisting) - does course owner have rights to access classlist information in the specified class?  Also correction to documentation for &create_auto_enroll_password_handler() in lond.
  
  
Index: loncom/lond
diff -u loncom/lond:1.339 loncom/lond:1.340
--- loncom/lond:1.339	Fri Aug 25 13:48:44 2006
+++ loncom/lond	Tue Aug 29 17:08:08 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.339 2006/08/25 17:48:44 albertel Exp $
+# $Id: lond,v 1.340 2006/08/29 21:08:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.339 $'; #' stupid emacs
+my $VERSION='$Revision: 1.340 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -4179,16 +4179,43 @@
 &register_handler("autovalidatecourse", \&validate_course_section_handler, 0, 1, 0);
 
 #
-#   Create a password for a new auto-enrollment user.
-#   I think/guess, this password allows access to the institutions 
-#   AIS class list server/services.  Stuart can correct this comment
-#   when he finds out how wrong I am.
+#   Validate course owner's access to enrollment data for specific class section. 
+#   
+#
+# Formal Parameters:
+#    $cmd     - The command request that got us dispatched.
+#    $tail    - The tail of the command.   In this case this is a colon separated
+#               set of words that will be split into:
+#               $inst_class  - Institutional code for the specific class section   
+#               $courseowner - The escaped username:domain of the course owner 
+#               $cdom        - The domain of the course from the institution's
+#                              point of view.
+#    $client  - The socket open on the client.
+# Returns:
+#    1 - continue processing.
+#
+
+sub validate_class_access_handler {
+    my ($cmd, $tail, $client) = @_;
+    my $userinput = "$cmd:$tail";
+    my ($inst_class,$courseowner,$cdom) = split(/:/, $tail);
+    $courseowner = &unescape($courseowner);
+    my $outcome=&localenroll::check_section($inst_class,$courseowner,$cdom);
+    &Reply($client,"$outcome\n", $userinput);
+
+    return 1;
+}
+&register_handler("autovalidateclass_sec", \&validate_class_access_handler, 0, 1, 0);
+
+#
+#   Create a password for a new LON-CAPA user added by auto-enrollment.
+#   Only used for case where authentication method for new user is localauth
 #
 # Formal Parameters:
 #    $cmd     - The command request that got us dispatched.
 #    $tail    - The tail of the command.   In this case this is a colon separated
 #               set of words that will be split into:
-#               $authparam - An authentication parameter (username??).
+#               $authparam - An authentication parameter (localauth parameter).
 #               $cdom      - The domain of the course from the institution's
 #                            point of view.
 #    $client  - The socket open on the client.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.772 loncom/lonnet/perl/lonnet.pm:1.773
--- loncom/lonnet/perl/lonnet.pm:1.772	Mon Aug 28 21:01:19 2006
+++ loncom/lonnet/perl/lonnet.pm	Tue Aug 29 17:08:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.772 2006/08/29 01:01:19 raeburn Exp $
+# $Id: lonnet.pm,v 1.773 2006/08/29 21:08:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4231,6 +4231,14 @@
     }
 }
 
+sub autovalidateclass_sec {
+    my ($cdom,$cnum,$owner,$inst_class) = @_;
+    my $homeserver = &homeserver($cnum,$cdom);
+    my $response=&reply('autovalidateclass_sec:'.$inst_class.':'.
+                        &escape($owner).':'.$cdom,$homeserver));
+    return $response;
+}
+
 # ------------------------------------------------------- Course Group routines
 
 sub get_coursegroups {