[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
raeburn@source.lon-capa.org
Thu, 06 Aug 2009 15:14:08 -0000
raeburn Thu Aug 6 15:14:08 2009 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
- Display warnings when changes to institutional affiliation settings for course creation and/or course creation based on sso and/or institutional log-in don't make sense.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.99 loncom/interface/domainprefs.pm:1.100
--- loncom/interface/domainprefs.pm:1.99 Sun Aug 2 07:21:18 2009
+++ loncom/interface/domainprefs.pm Thu Aug 6 15:14:08 2009
@@ -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 @@
$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 @@
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 @@
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 @@
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:<ul>');
+ $chgtext .= &mt('creation of a new account is permitted for:').'<ul>';
foreach my $case (@{$cancreate{$type}}) {
$chgtext .= '<li>'.$selfcreatetypes{$case}.'</li>';
}
$chgtext .= '</ul>';
+ if (ref($cancreate{$type}) eq 'ARRAY') {
+ if (grep(/^(login|sso)$/,@{$cancreate{$type}})) {
+ if (ref($cancreate{'statustocreate'}) eq 'ARRAY') {
+ if (@{$cancreate{'statustocreate'}} == 0) {
+ $chgtext .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>';
+ }
+ }
+ }
+ }
}
} 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 .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>';
+ }
} 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):').'<ul>';
- foreach my $case (@{$cancreate{$type}}) {
- if ($case eq 'default') {
- $chgtext .= '<li>'.$othertitle.'</li>';
- } else {
- $chgtext .= '<li>'.$usertypes->{$case}.'</li>';
- }
+ $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 .= '<ul>';
+ foreach my $case (@{$cancreate{$type}}) {
+ if ($case eq 'default') {
+ $chgtext .= '<li>'.$othertitle.'</li>';
+ } else {
+ $chgtext .= '<li>'.$usertypes->{$case}.'</li>';
}
- $chgtext .= '</ul>';
}
+ $chgtext .= '</ul>';
+ if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {
+ $chgtext .= '<br /><span class="LC_warning">'.&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.').'</span>';
+ }
+ }
+ } 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.');
}
}
}