[LON-CAPA-cvs] cvs: loncom /auth loncacc.pm lonroles.pm roles.tab rolesplain.tab /interface loncreateuser.pm /lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Sun, 19 Jun 2005 00:41:35 -0000


www		Sat Jun 18 20:41:35 2005 EDT

  Modified files:              
    /loncom/auth	loncacc.pm lonroles.pm roles.tab rolesplain.tab 
    /loncom/interface	loncreateuser.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug #4135: underprivileged "assistant co-author"
  Part of Bug #1900: CUSR shows up for authors again
  
  
Index: loncom/auth/loncacc.pm
diff -u loncom/auth/loncacc.pm:1.38 loncom/auth/loncacc.pm:1.39
--- loncom/auth/loncacc.pm:1.38	Thu Apr  7 02:56:21 2005
+++ loncom/auth/loncacc.pm	Sat Jun 18 20:41:32 2005
@@ -2,7 +2,7 @@
 # Cookie Based Access Handler for Construction Area
 # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer)
 #
-# $Id: loncacc.pm,v 1.38 2005/04/07 06:56:21 albertel Exp $
+# $Id: loncacc.pm,v 1.39 2005/06/19 00:41:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,6 +60,12 @@
 		return ($ownername,$domain);
 	    }
 	}
+	my $aapriv='user.priv.aa./'.$domain.'/'.$ownername.'./';
+	foreach (keys %env) {
+	    if ($_ eq $aapriv) {
+		return ($ownername,$domain);
+	    }
+	}
     }
     return '';
 }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.124 loncom/auth/lonroles.pm:1.125
--- loncom/auth/lonroles.pm:1.124	Thu Jun 16 18:25:34 2005
+++ loncom/auth/lonroles.pm	Sat Jun 18 20:41:32 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.124 2005/06/16 22:25:34 albertel Exp $
+# $Id: lonroles.pm,v 1.125 2005/06/19 00:41:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -227,7 +227,7 @@
                     my $tadv=0;
 		    my $msg=&mt('Entering course ...');
 
-		    if (($cnum) && ($role ne 'ca')) {
+		    if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) {
 			my ($furl,$ferr)=
 			    &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
 			if (($env{'form.orgurl'}) && 
@@ -277,7 +277,7 @@
 		    }
                     #
                     # Send the user to the construction space they selected
-                    if ($role =~ /^(au|ca)$/) {
+                    if ($role =~ /^(au|ca|aa)$/) {
                         my $redirect_url = '/priv/';
                         if ($role eq 'au') {
                             $redirect_url.=$env{'user.name'};
@@ -471,7 +471,7 @@
                 my ($tdom,$trest,$tsection)=
                     split(/\//,Apache::lonnet::declutter($where));
                 # First, Co-Authorship roles
-                if ($role eq 'ca') {
+                if (($role eq 'ca') || ($role eq 'aa')) {
                     my $home = &Apache::lonnet::homeserver($trest,$tdom);
 		    my $allowed=0;
 		    my @ids=&Apache::lonnet::current_machine_ids();
Index: loncom/auth/roles.tab
diff -u loncom/auth/roles.tab:1.34 loncom/auth/roles.tab:1.35
--- loncom/auth/roles.tab:1.34	Fri Jun 17 17:04:41 2005
+++ loncom/auth/roles.tab	Sat Jun 18 20:41:32 2005
@@ -21,9 +21,11 @@
 li:s gan:sma:adv
 li:d mme
 au:s gan:sma:bre:adv
-au:d are:cre:ere:cca&IK
+au:d are:cre:ere:cca&IK:caa&IK
 ca:s gan:sma:bre:adv
 ca:d are:cre:ere
+aa:s sma
+aa:d are:cre:ere
 dg:d bre&R
 sc:d usc
 
Index: loncom/auth/rolesplain.tab
diff -u loncom/auth/rolesplain.tab:1.14 loncom/auth/rolesplain.tab:1.15
--- loncom/auth/rolesplain.tab:1.14	Fri Nov 12 11:34:15 2004
+++ loncom/auth/rolesplain.tab	Sat Jun 18 20:41:32 2005
@@ -24,6 +24,7 @@
 au:Author
 dg:Domain Guest
 ca:Co-Author
+aa:Assistant Co-Author
 sc:Scantron Operator
 csu:Grant/revoke role of Superuser
 cdc:Grant/revoke role of Domain Coordinator
@@ -38,6 +39,7 @@
 cau:Grant/revoke role of Author
 cdg:Grant/revoke role of Domain Guest
 cca:Grant/revoke role of Co-Author
+caa:Grant/revoke role of Assistant Co-Author
 csc:Grant/revoke role of Scantron Operator
 dro:Delete a role
 mky:Manage access keys
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.104 loncom/interface/loncreateuser.pm:1.105
--- loncom/interface/loncreateuser.pm:1.104	Fri Jun 17 17:04:40 2005
+++ loncom/interface/loncreateuser.pm	Sat Jun 18 20:41:32 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.104 2005/06/17 21:04:40 albertel Exp $
+# $Id: loncreateuser.pm,v 1.105 2005/06/19 00:41:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,7 +108,8 @@
 
 sub authorpriv {
     my ($auname,$audom)=@_;
-    unless (&Apache::lonnet::allowed('cca',$audom.'/'.$auname)) { return ''; }
+    unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname))
+         || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; }
     return 1;
 }
 
@@ -571,7 +572,7 @@
 		       $class='Domain';
 		   }
                }
-               if ($role_code eq 'ca') {
+               if (($role_code eq 'ca') || ($role_code eq 'aa')) {
                    $area=~/\/(\w+)\/(\w+)/;
 		   if (&authorpriv($2,$1)) {
 		       $allowed=1;
@@ -775,6 +776,7 @@
                     'sta'  => "Start",
                     'end'  => "End",
                     'cau'  => "Co-Author",
+                    'caa'  => "Assistant Co-Author",
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"
 				       );
@@ -793,6 +795,17 @@
 <a href=
 "javascript:pjump('date_end','End Date Co-Author',document.cu.end_$cudom\_$cuname\_ca.value,'end_$cudom\_$cuname\_ca','cu.pres','dateset')">$lt{'sed'}</a></td>
 </tr>
+<tr>
+<td><input type=checkbox name="act_$cudom\_$cuname\_aa" /></td>
+<td>$lt{'caa'}</td>
+<td>$cudom\_$cuname</td>
+<td><input type=hidden name="start_$cudom\_$cuname\_aa" value='' />
+<a href=
+"javascript:pjump('date_start','Start Date Assistant Co-Author',document.cu.start_$cudom\_$cuname\_aa.value,'start_$cudom\_$cuname\_aa','cu.pres','dateset')">$lt{'ssd'}</a></td>
+<td><input type=hidden name="end_$cudom\_$cuname\_aa" value='' />
+<a href=
+"javascript:pjump('date_end','End Date Assistant Co-Author',document.cu.end_$cudom\_$cuname\_aa.value,'end_$cudom\_$cuname\_aa','cu.pres','dateset')">$lt{'sed'}</a></td>
+</tr>
 </table>
 ENDCOAUTH
     }
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.642 loncom/lonnet/perl/lonnet.pm:1.643
--- loncom/lonnet/perl/lonnet.pm:1.642	Fri Jun 17 17:04:40 2005
+++ loncom/lonnet/perl/lonnet.pm	Sat Jun 18 20:41:33 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.642 2005/06/17 21:04:40 albertel Exp $
+# $Id: lonnet.pm,v 1.643 2005/06/19 00:41:33 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2968,9 +2968,12 @@
 
 # If this is generating or modifying users, exit with special codes
 
-    if (':csu:cdc:ccc:cin:cta:cep:ccr:cst:cad:cli:cau:cdg:cca:'=~/\:\Q$priv\E\:/) {
-	if ($priv eq 'cca') {
+    if (':csu:cdc:ccc:cin:cta:cep:ccr:cst:cad:cli:cau:cdg:cca:caa:'=~/\:\Q$priv\E\:/) {
+	if (($priv eq 'cca') || ($priv eq 'caa')) {
 	    my ($audom,$auname)=split('/',$uri);
+# no author name given, so this just checks on the general right to make a co-author in this domain
+	    unless ($auname) { return $thisallowed; }
+# an author name is given, so we are about to actually make a co-author for a certain account
 	    if (($auname ne $env{'user.name'} && $env{'request.role'} !~ /^dc\./) ||
 		(($audom ne $env{'user.domain'} && $env{'request.role'} !~ /^dc\./) &&
 		 ($audom ne $env{'request.role.domain'}))) { return ''; }