--- loncom/interface/domainprefs.pm 2009/08/02 07:21:18 1.99
+++ loncom/interface/domainprefs.pm 2009/08/06 15:14:08 1.100
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.99 2009/08/02 07:21:18 raeburn Exp $
+# $Id: domainprefs.pm,v 1.100 2009/08/06 15:14:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1518,7 +1518,7 @@ sub print_usercreation {
$rowcount ++;
}
} elsif ($position eq 'middle') {
- my @creators = ('author','course','selfcreate');
+ my @creators = ('author','course','requestcrs','selfcreate');
my ($rules,$ruleorder) =
&Apache::lonnet::inst_userrules($dom,'username');
my %lt = &usercreation_types();
@@ -1721,6 +1721,7 @@ sub usercreation_types {
my %lt = &Apache::lonlocal::texthash (
author => 'When adding a co-author',
course => 'When adding a user to a course',
+ requestcrs => 'When requesting a course',
selfcreate => 'User creates own account',
any => 'Any',
official => 'Institutional only ',
@@ -4028,7 +4029,7 @@ sub modify_usercreation {
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule');
my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule');
my @email_rule = &Apache::loncommon::get_env_multiple('form.email_rule');
- my @contexts = ('author','course','selfcreate');
+ my @contexts = ('author','course','requestcrs','selfcreate');
foreach my $item(@contexts) {
if ($item eq 'selfcreate') {
@{$cancreate{$item}} = &Apache::loncommon::get_env_multiple('form.can_createuser_'.$item);
@@ -4232,37 +4233,63 @@ sub modify_usercreation {
if (ref($changes{'cancreate'}) eq 'ARRAY') {
my %lt = &usercreation_types();
foreach my $type (@{$changes{'cancreate'}}) {
- my $chgtext = $lt{$type}.', ';
+ my $chgtext;
+ unless ($type eq 'statustocreate') {
+ $chgtext = $lt{$type}.', ';
+ }
if ($type eq 'selfcreate') {
if (@{$cancreate{$type}} == 0) {
$chgtext .= &mt('creation of a new user account is not permitted.');
} else {
- $chgtext .= &mt('creation of a new account is permitted for:
');
+ $chgtext .= &mt('creation of a new account is permitted for:').'';
foreach my $case (@{$cancreate{$type}}) {
$chgtext .= '- '.$selfcreatetypes{$case}.'
';
}
$chgtext .= '
';
+ if (ref($cancreate{$type}) eq 'ARRAY') {
+ if (grep(/^(login|sso)$/,@{$cancreate{$type}})) {
+ if (ref($cancreate{'statustocreate'}) eq 'ARRAY') {
+ if (@{$cancreate{'statustocreate'}} == 0) {
+ $chgtext .= '
'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'';
+ }
+ }
+ }
+ }
}
} elsif ($type eq 'statustocreate') {
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') &&
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) {
if (@{$cancreate{'selfcreate'}} > 0) {
if (@{$cancreate{'statustocreate'}} == 0) {
+
+ $chgtext .= &mt("Institutional affiliations permitted to create accounts set to 'None'.");
if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) {
- $chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.");
- }
+ $chgtext .= '
'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'';
+ }
} elsif (ref($usertypes) eq 'HASH') {
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {
- $chgtext .= &mt('creation of a new account for an institutional user is restricted to the following institutional affiliation(s):').'';
- foreach my $case (@{$cancreate{$type}}) {
- if ($case eq 'default') {
- $chgtext .= '- '.$othertitle.'
';
- } else {
- $chgtext .= '- '.$usertypes->{$case}.'
';
- }
+ $chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):');
+ } else {
+ $chgtext .= &mt('Institutional affiliations permitted to create accounts with institutional authentication were set as follows:');
+ }
+ $chgtext .= '';
+ foreach my $case (@{$cancreate{$type}}) {
+ if ($case eq 'default') {
+ $chgtext .= '- '.$othertitle.'
';
+ } else {
+ $chgtext .= '- '.$usertypes->{$case}.'
';
}
- $chgtext .= '
';
}
+ $chgtext .= '
';
+ if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {
+ $chgtext .= '
'.&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.').'';
+ }
+ }
+ } else {
+ if (@{$cancreate{$type}} == 0) {
+ $chgtext .= &mt("Institutional affiliations permitted to create accounts were set to 'none'.");
+ } else {
+ $chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.');
}
}
}