[LON-CAPA-cvs] cvs: modules /gerd/loncapa_lernmodule/loncapa studip.pm

www www at source.lon-capa.org
Thu Aug 30 11:53:24 EDT 2012


www		Thu Aug 30 15:53:24 2012 EDT

  Modified files:              
    /modules/gerd/loncapa_lernmodule/loncapa	studip.pm 
  Log:
  Verify that we are indeed a module in the StudIP course
  
  
Index: modules/gerd/loncapa_lernmodule/loncapa/studip.pm
diff -u modules/gerd/loncapa_lernmodule/loncapa/studip.pm:1.6 modules/gerd/loncapa_lernmodule/loncapa/studip.pm:1.7
--- modules/gerd/loncapa_lernmodule/loncapa/studip.pm:1.6	Thu Aug 30 15:22:29 2012
+++ modules/gerd/loncapa_lernmodule/loncapa/studip.pm	Thu Aug 30 15:53:24 2012
@@ -7,7 +7,7 @@
 #
 # Landing point for incoming StudIP requests 
 #
-# $Id: studip.pm,v 1.6 2012/08/30 15:22:29 www Exp $
+# $Id: studip.pm,v 1.7 2012/08/30 15:53:24 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -182,7 +182,22 @@
 		#return &error_msg($r, HTTP_UNAUTHORIZED);
 	}
 
+        # verify that this LON-CAPA course is indeed a module in the StudIP course
 
+        ($error, $returned) = &make_studip_call('find_seminars_using_contentmodule',$env{'form.systemid'},$$params{'course_id'});
+
+        if($error){
+                &Apache::loncommon::content_type($r,'text/html');
+                $r->send_http_header;
+                $r->print($error);
+                return OK;
+        }
+ 
+        my $modules=','.join(',',@{$returned->value}).',';
+        unless ($modules=~/\,\Q$env{'form.courseid'}\E\,/) {
+                &Apache::lonauth::failed($r, 'Couldn\'t verify course module.', undef);
+                return OK;
+        }
 
 	my $user = &LONCAPA::clean_username($rawuser);
 
@@ -204,7 +219,6 @@
         my $crs=$$params{'course_id'};
         my ($cdom, $cid) = split(/_/, $crs);
 
-        &Apache::lonnet::logthis("Getting course $crs $cdom $cid");
 # Make a new user in the course if course is in own domain
 	if (($uhome eq 'no_host') && ($cdom eq $domain)) {
            my ($first,$last)=&get_userinfo($user);
@@ -421,6 +435,9 @@
 	my $error = '';
 
 	if($response->is_success()){
+
+#&Apache::lonnet::logthis("Got response ".$response->content);
+
 		my $rpcxml_response = $parser->parse($response->content);
 
 		if(!$rpcxml_response->is_fault){




More information about the LON-CAPA-cvs mailing list