--- loncom/interface/loncreateuser.pm	2005/06/06 00:07:43	1.103
+++ loncom/interface/loncreateuser.pm	2005/06/23 21:59:13	1.107
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.103 2005/06/06 00:07:43 albertel Exp $
+# $Id: loncreateuser.pm,v 1.107 2005/06/23 21:59:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,10 +108,8 @@ sub my_custom_roles {
 
 sub authorpriv {
     my ($auname,$audom)=@_;
-    if (($auname ne $env{'user.name'}) ||
-        (($audom ne $env{'user.domain'}) &&
-         ($audom ne $env{'request.role.domain'}))) { return ''; }
-    unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; }
+    unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname))
+         || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; }
     return 1;
 }
 
@@ -158,14 +156,18 @@ $lt{'dom'}:</td><td>$domform</td></tr>
 </table>
 <input name="userrole" type="submit" value="$lt{usrr}" />
 </form>
+ENDDOCUMENT
+   if (&Apache::lonnet::allowed('mcr','/')) {
+       $r->print(<<ENDCUSTOM);
 <form action="/adm/createuser" method="post" name="docustom">
 <input type="hidden" name="phase" value="selected_custom_edit">
 <h2>$lt{'ecrp'}$helpecpr</h2>
 $lt{'nr'}: $choice <input type="text" size="15" name="newrolename" /><br />
 <input name="customeditor" type="submit" value="$lt{'cre'}" />
-</body>
-</html>
-ENDDOCUMENT
+</form>
+ENDCUSTOM
+    }
+    $r->print('</body></html>');
 }
 
 # =================================================================== Phase two
@@ -574,7 +576,7 @@ END
 		       $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;
@@ -778,6 +780,7 @@ ENDOTHERAUTHS
                     'sta'  => "Start",
                     'end'  => "End",
                     'cau'  => "Co-Author",
+                    'caa'  => "Assistant Co-Author",
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"
 				       );
@@ -796,6 +799,17 @@ ENDOTHERAUTHS
 <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
     }
@@ -1553,7 +1567,7 @@ sub handler {
         (&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || 
         (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || 
         (&Apache::lonnet::allowed('cep',$env{'request.course.id'})) ||
-        (&Apache::lonnet::allowed('cca',$env{'request.role.domain'})) ||
+	(&authorpriv($env{'user.name'},$env{'request.role.domain'})) ||
         (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) {
        &Apache::loncommon::content_type($r,'text/html');
        $r->send_http_header;