[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 15 May 2008 17:50:18 -0000
raeburn Thu May 15 13:50:18 2008 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Add &selfcreate_rules() and &selfcreate_check() for MSU.
- Prevent self-creation of LON-CAPA account by users using an email of the form netID@msu.edu (where netID has the format required for a valid MSUnetID), as username.
- These types of users should self-create their accounts using just the MSUNetID as username.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.34 modules/msu/localenroll.pm:1.35
--- modules/msu/localenroll.pm:1.34 Mon Jan 7 13:08:28 2008
+++ modules/msu/localenroll.pm Thu May 15 13:50:16 2008
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.34 2008/01/07 18:08:28 raeburn Exp $
+# $Id: localenroll.pm,v 1.35 2008/05/15 17:50:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -717,6 +717,18 @@
return 'ok';
}
+sub selfcreate_rules {
+ my ($dom,$ruleshash,$rulesorder) = @_;
+ %{$ruleshash} = (
+ msuemail => {
+ name => 'MSU e-mail address ',
+ desc => 'netid@msu.edu',
+ },
+ );
+ @{$rulesorder} = ('msuemail');
+ return 'ok';
+}
+
sub username_check {
my ($dom,$uname,$to_check,$resultshash) = @_;
my $outcome;
@@ -765,6 +777,24 @@
return $outcome;
}
+sub selfcreate_check {
+ my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
+ my $outcome;
+ if (ref($to_check) eq 'ARRAY') {
+ foreach my $item (@{$to_check}) {
+ if ($item eq 'msuemail') {
+ if ($selfcreatename =~ /^\w{2,8}\@msu\.edu$/) {
+ $resultshash->{$item} = 1;
+ } else {
+ $resultshash->{$item} = 0;
+ }
+ }
+ }
+ $outcome = 'ok';
+ }
+ return $outcome;
+}
+
###############################
# sub AUTOLOAD
#