[LON-CAPA-cvs] cvs: loncom(GCI_3) /lonnet/perl lonnet.pm

raeburn raeburn@source.lon-capa.org
Fri, 26 Feb 2010 23:11:34 -0000


raeburn		Fri Feb 26 23:11:34 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Customization for GCI_3
    - Backport 1.1050 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1048.2.2 loncom/lonnet/perl/lonnet.pm:1.1048.2.3
--- loncom/lonnet/perl/lonnet.pm:1.1048.2.2	Sat Jan 16 15:08:57 2010
+++ loncom/lonnet/perl/lonnet.pm	Fri Feb 26 23:11:33 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1048.2.2 2010/01/16 15:08:57 raeburn Exp $
+# $Id: lonnet.pm,v 1.1048.2.3 2010/02/26 23:11:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4848,6 +4848,27 @@
     }
 }
 
+sub is_course_owner {
+    my ($cdom,$cnum,$udom,$uname) = @_;
+    if (($udom eq '') || ($uname eq '')) {
+        $udom = $env{'user.domain'};
+        $uname = $env{'user.name'};
+    }
+    unless (($udom eq '') || ($uname eq '')) {
+        if (exists($env{'course.'.$cdom.'_'.$cnum.'.internal.courseowner'})) {
+            if ($env{'course.'.$cdom.'_'.$cnum.'.internal.courseowner'} eq $uname.':'.$udom) {
+                return 1;
+            } else {
+                my %courseinfo = &Apache::lonnet::coursedescription($cdom.'/'.$cnum);
+                if ($courseinfo{'internal.courseowner'} eq $uname.':'.$udom) {
+                    return 1;
+                }
+            }
+        }
+    }
+    return;
+}
+
 sub is_advanced_user {
     my ($udom,$uname) = @_;
     my %roleshash = &get_my_roles($uname,$udom,'userroles',undef,undef,undef,1);