--- loncom/interface/loncreateuser.pm 2002/11/18 20:06:53 1.44
+++ loncom/interface/loncreateuser.pm 2003/07/25 01:18:04 1.66
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.44 2002/11/18 20:06:53 matthew Exp $
+# $Id: loncreateuser.pm,v 1.66 2003/07/25 01:18:04 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,36 +25,44 @@
#
# http://www.lon-capa.org/
#
-# (Create a course
-# (My Desk
-#
-# (Internal Server Error Handler
-#
-# (Login Screen
-# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
-# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
-#
-# YEAR=2001
-# 3/1/1 Gerd Kortemeyer)
-#
-# 3/1 Gerd Kortemeyer)
-#
-# 2/14 Gerd Kortemeyer)
-#
-# 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer
-# April Guy Albertelli
-# 05/10,10/16 Gerd Kortemeyer
-# 11/12,11/13,11/15 Scott Harrison
-# 02/11/02 Matthew Hall
-#
-# $Id: loncreateuser.pm,v 1.44 2002/11/18 20:06:53 matthew Exp $
###
package Apache::loncreateuser;
+=pod
+
+=head1 NAME
+
+Apache::loncreateuser - handler to create users and custom roles
+
+=head1 SYNOPSIS
+
+Apache::loncreateuser provides an Apache handler for creating users,
+ editing their login parameters, roles, and removing roles, and
+ also creating and assigning custom roles.
+
+=head1 OVERVIEW
+
+=head2 Custom Roles
+
+In LON-CAPA, roles are actually collections of privileges. "Teaching
+Assistant", "Course Coordinator", and other such roles are really just
+collection of privileges that are useful in many circumstances.
+
+Creating custom roles can be done by the Domain Coordinator through
+the Create User functionality. That screen will show all privileges
+that can be assigned to users. For a complete list of privileges,
+please see C.
+
+Custom role definitions are stored in the C file of the role
+author.
+
+=cut
+
use strict;
use Apache::Constants qw(:common :http);
use Apache::lonnet;
+use Apache::loncommon;
my $loginscript; # piece of javascript used in two separate instances
my $generalrule;
@@ -71,16 +79,30 @@ BEGIN {
my %param = ( formname => 'document.cu',
kerb_def_dom => $krbdefdom
);
- $loginscript = &Apache::loncommon::authform_header(%param);
+# no longer static due to configurable kerberos defaults
+# $loginscript = &Apache::loncommon::authform_header(%param);
$generalrule = &Apache::loncommon::authform_authorwarning(%param);
$authformnop = &Apache::loncommon::authform_nochange(%param);
- $authformkrb = &Apache::loncommon::authform_kerberos(%param);
+# no longer static due to configurable kerberos defaults
+# $authformkrb = &Apache::loncommon::authform_kerberos(%param);
$authformint = &Apache::loncommon::authform_internal(%param);
$authformfsys = &Apache::loncommon::authform_filesystem(%param);
$authformloc = &Apache::loncommon::authform_local(%param);
}
+# ======================================================= Existing Custom Roles
+
+sub my_custom_roles {
+ my %returnhash=();
+ my %rolehash=&Apache::lonnet::dump('roles');
+ foreach (keys %rolehash) {
+ if ($_=~/^rolesdef\_(\w+)$/) {
+ $returnhash{$1}=$1;
+ }
+ }
+ return %returnhash;
+}
# ==================================================== Figure out author access
@@ -102,23 +124,34 @@ sub print_username_entry_form {
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
my $bodytag =&Apache::loncommon::bodytag(
'Create Users, Change User Privileges');
+ my $selscript=&Apache::loncommon::studentbrowser_javascript();
+ my $sellink=&Apache::loncommon::selectstudent_link
+ ('crtuser','ccuname','ccdomain');
+ my %existingroles=&my_custom_roles();
+ my $choice=&Apache::loncommon::select_form('make new role','rolename',
+ ('make new role' => 'Generate new role ...',%existingroles));
$r->print(<<"ENDDOCUMENT");
The LearningOnline Network with CAPA
+$selscript
$bodytag
-