File:  [LON-CAPA] / loncom / enrollment / localenroll.pm
Revision 1.37: download - view: text, annotated - select for diffs
Tue Aug 18 20:08:38 2009 UTC (14 years, 10 months ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- lonnet::auto_validate_instcode() used to check if requestor's status permits automatic processing of the course request.
- Additional arguments now passed (besides $instcode and $owner) include comma-separated list of requestor's institutional affiliations (e.g., Faculty, Staff etc.) and comma-separated list of sections.

lond:validate_instcode_handler()
- Passes additional arguments on to corresponding routine in localenroll.pm.

localenroll.pm - update stub args and documentation for validate_instcode().

    1: # functions to glue school database system into Lon-CAPA for 
    2: # automated enrollment
    3: # $Id: localenroll.pm,v 1.37 2009/08/18 20:08:38 raeburn Exp $
    4: #
    5: # Copyright Michigan State University Board of Trustees
    6: #
    7: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    8: #
    9: # LON-CAPA is free software; you can redistribute it and/or modify
   10: # it under the terms of the GNU General Public License as published by
   11: # the Free Software Foundation; either version 2 of the License, or
   12: # (at your option) any later version.
   13: #
   14: # LON-CAPA is distributed in the hope that it will be useful,
   15: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   16: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17: # GNU General Public License for more details.
   18: #
   19: # You should have received a copy of the GNU General Public License
   20: # along with LON-CAPA; if not, write to the Free Software
   21: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   22: #
   23: # /home/httpd/html/adm/gpl.txt
   24: #
   25: # http://www.lon-capa.org/
   26: #
   27: 
   28: =pod
   29: 
   30: =head1 NAME
   31: 
   32: localenroll
   33: 
   34: =head1 SYNOPSIS
   35: 
   36: This is part of the LearningOnline Network with CAPA project
   37: described at http://www.lon-capa.org.
   38: 
   39: 
   40: =head1 NOTABLE SUBROUTINES
   41: 
   42: =over
   43: 
   44: =cut
   45: 
   46: package localenroll;
   47: 
   48: use strict;
   49: 
   50: =pod
   51:  
   52: =item run()
   53:  set this to return 1 if you want the auto enrollment to run
   54: 
   55:  Beginning with LON-CAPA version 2.4, use of this routine is
   56:  deprecated.  Whether or not Autoenroll.pl should run is set
   57:  by the Domain Coordinator via "Set domain configuration",
   58:  provided in the Domain Management section of the Main menu. 
   59: 
   60: =cut
   61: 
   62: sub run() {
   63:     my $dom = shift;
   64:     return 0;
   65: }
   66: 
   67: 
   68: =pod
   69: 
   70: =item fetch_enrollment()
   71: 
   72:  connects to the institutional classlist data source,
   73:  reads classlist data and stores in an XML file
   74:  in /home/httpd/perl/tmp/
   75: 
   76:  classlist files are named as follows:
   77: 
   78:  DOMAIN_COURSE_INSTITUTIONALCODE_classlist.xml
   79: 
   80:  e.g., msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
   81:  where DOMAIN = msu  COURSE = 43551dedcd43febmsul1 
   82:  INSTITUTIONALCODE = fs03nop590001 
   83:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
   84:  department name, 590 = course number, 001 = section number.)
   85: 
   86:  fetch_enrollment requires three arguments -
   87:  $dom - DOMAIN e.g., msu
   88:  $affiliatesref - a reference to a hash of arrays that contains LON-CAPA 
   89:  courses that are to be updated as keys, and institutional coursecodes 
   90:  contributing enrollment to that LON-CAPA course as elements in each array.
   91:  $replyref - a reference to a hash that contains LON-CAPA courses
   92:  that are to be updated as keys, and the total enrollment count in all 
   93:  affiliated sections, as determined from institutional data as hash elements. 
   94: 
   95:  As an example, if fetch_enrollment is called to retrieve institutional
   96:  classlists for a single LON-CAPA course - 43551dedcd43febmsul1 which 
   97:  corresponds to fs03nop590, sections 001, 601 and 602 , and the course
   98:  also accommodates enrollment from a crosslisted course in the ost
   99:  department - fs03ost580002:
  100: 
  101:  the affiliatesref would be a reference to %affiliates which would be:
  102: 
  103:  @{$affiliates{'43551dedcd43febmsul1'}} =
  104:    ("fs03nop590001","fs03nop590601","fs03nop590602","fs03ost580002");
  105: 
  106:  fetch_enrollment would create four files in /home/httpd/perl/tmp/.
  107:  msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
  108:  msu_43551dedcd43febmsul1_fs03nop590601_classlist.xml
  109:  msu_43551dedcd43febmsul1_fs03nop590602_classlist.xml
  110:  msu_43551dedcd43febmsul1_fs03ost580002_classlist.xml
  111: 
  112:  In each file, student data would be stored in the following format
  113:  
  114:  <student username="smith">
  115:   <autharg>MSU.EDU</autharg>
  116:   <authtype>krb4</authtype>
  117:   <email>smith@msu.edu</email>
  118:   <enddate></enddate>
  119:   <firstname>John</firstname>
  120:   <generation>II</generation>
  121:   <groupID>fs03nop590001</groupID>
  122:   <lastname>Smith</lastname>
  123:   <middlename>D</middlename>
  124:   <startdate></startdate>
  125:   <studentID>A12345678</studentID>
  126:  </student>
  127:  
  128:  with the following at the top of the file
  129: <?xml version="1.0" encoding="UTF-8"?>
  130: <!DOCTYPE text>
  131: <students>
  132: 
  133:  (all comment - s removed)
  134: 
  135:  and a closing:
  136: </students>
  137: 
  138:  The <startdate> and the <enddate> are the activation date and expiration date
  139:  for this student's role. If they are absent, then the default access start and
  140:  default access end dates are used. The default access dates can be set when 
  141:  the course is created, and can be modified using the Automated Enrollment
  142:  Manager, or via the 'Upload a class list','Enroll a single student' or 
  143:  'Modify student data' utilities in the Enrollment Manager, by checking the 
  144:  'make these dates the default for future enrollment' checkbox. If no default 
  145:  dates have been set, then the tudent role will be active immediately, and will 
  146:  remain active until the role is explicitly expired using ENRL -> Drop students. 
  147:  If dates are to included in the XML file, they should be in the format
  148:  YYYY:MM:DD:HH:MM:SS (: separators required).
  149: 
  150:  If there were 10 students in fs03nop590001, 5 students in fs03nop59o601, 
  151:  8 students in fs03nop590602, and 2 students in fs03ost580002,
  152:  then $$reply{'43551dedcd43febmsul1'} = 25
  153: 
  154:  The purpose of the %reply hash is to detect cases where the institutional 
  155:  enrollment is 0 (most likely due to a problem with the data source).
  156:  In such a case, the LON-CAPA course roster is left unchanged (i.e., no
  157:  students are expired, even if automated drops is enabled.
  158:  
  159:  fetch_enrollment should return a 0 or 1, depending on whether a connection
  160:  could be established to the institutional data source.
  161:  0 is returned if no connection could be made.
  162:  1 is returned if connection was successful
  163: 
  164:  A return of 1 is required for the calling modules to perform LON-CAPA
  165:  roster changes based on the contents of the XML classlist file(s), e,g,,
  166:  msu_43551dedcd43febmsul1_fs03nop590001_classlist.xml
  167: 
  168:  XML classlist files are temporary. They are deleted after the enrollment 
  169:  update process in the calling module is complete.
  170: 
  171: 
  172: =cut
  173: 
  174: sub fetch_enrollment {
  175:     my ($dom,$affiliatesref,$replyref) = @_;
  176:     foreach my $crs (sort keys %{$affiliatesref}) {
  177:         $$replyref{$crs} = 0;
  178:     }
  179:     my $okflag = 0;
  180:     return $okflag;
  181: }
  182: 
  183: =pod
  184: 
  185: =item get_sections()
  186: 
  187:  This is called by the Automated Enrollment Manager interface
  188:  (lonpopulate.pm) to create an array of valid sections for 
  189:  a specific institutional coursecode.
  190:  e.g., for MSU coursecode: fs03nop590
  191:  ("001","601","602") would be returned
  192: 
  193:  If the array returned contains at least one element, then 
  194:  the interface offerred to the course coordinator, lists
  195:  official sections and provides a checkbox to use to
  196:  select enrollment in the LON-CAPA course from each official section.  
  197: 
  198:  get_sections takes two arguments - (a) the institutional coursecode
  199:  (in the MSU case this is a concatenation of semester code, department
  200:  and course number), and (b) the LON-CAPA domain that contains the course. 
  201:  
  202:  If there is no access to official course sections at your institution,
  203:  then an empty array is returned, and the Automated Enrollment Manager
  204:  interface will allow the course coordinator to enter section numbers
  205:  in text boxes.
  206:  
  207: 
  208: 
  209: =cut
  210: 
  211: sub get_sections {
  212:     my ($coursecode,$dom) = @_;
  213:     my @secs = ();
  214:     return @secs;
  215: }
  216: 
  217: =pod
  218: 
  219: =item new_course()
  220: 
  221:  This is called by loncreatecourse.pm and 
  222:  lonpopulate.pm to record that fact that a new course section
  223:  has been added to LON-CAPA that requires access to institutional data
  224:  At MSU, this is required, as institutional classlists can only made
  225:  available to faculty who are officially assigned to a course.
  226:  
  227:  The new_course subroutine is used to check that the course owner
  228:  of the LON-CAPA course is permitted to access the institutional
  229:  classlist for any course sections and crosslisted classes that
  230:  the course coordinator wishes to have affiliated with the course.
  231:  
  232:  If access is permitted, then 'ok' is returned.
  233:  The course section or crosslisted course will only be added to the list of
  234:  affiliates if 'ok' is returned.
  235: 
  236:  new_course takes three arguments -
  237:  (a) the institutional courseID (in the MSU case this is a concatenation of 
  238:  semester code, department code, course number, and section number
  239:  e.g., fs03nop590001).
  240:  (b) the course owner. This is the LON-CAPA username and domain of the course 
  241:  coordinator assigned to the course when it is first created, in the form
  242:  username:domain
  243:  (c) the LON-CAPA domain that contains the course
  244: 
  245: =cut
  246: 
  247: sub new_course  {
  248:     my ($course_id,$owner,$dom) = @_;
  249:     my $outcome = 'ok';
  250:     return $outcome;
  251: }
  252: 
  253: =pod
  254: 
  255: =item validate_courseID()
  256: 
  257:  This is called whenever a new course section or crosslisted course
  258:  is being affiliated with a LON-CAPA course (i.e., by loncreatecourse.pm
  259:  and the Automated Enrollment Manager in lonpopulate.pm).
  260:  A check is made that the courseID that the course coordinator wishes
  261:  to affiliate with the course is valid according to the institutional
  262:  schedule of official classes 
  263: 
  264:  A valid courseID is confirmed by returning 'ok'
  265: 
  266:  validate_courseID takes two arguments -
  267:  (a) the institutional courseID (in the MSU case this is a concatenation of
  268:  semester code, department code, course number, and section number
  269:  e.g., fs03nop590001).
  270:  (b) the LON-CAPA domain that contains the course
  271: 
  272: =cut  
  273: 
  274: sub validate_courseID {
  275:     my ($course_id,$dom) = @_;
  276:     my $outcome = 'ok';
  277:     return $outcome;   
  278: }
  279: 
  280: =pod
  281: 
  282: =item validate_instcode()
  283: 
  284: This is called when a request is being made for an official course.
  285: A check is made that the institutional code for which a course is
  286: is being requested is valid according to the institutional
  287: schedule of official classes.
  288: 
  289: If the username of the course owner is provided, a more restrictive
  290: test is used, namely that the requestor is listed as instructor of
  291: record for the course in the institution's course schedule/database.
  292: 
  293: A valid instcode is confirmed by returning 'valid'.
  294: In the case of a check for the instructor of record, the following can
  295: be returned:
  296: (a) valid  - the requestor is the recorded instructor - create the course
  297: (b) reject - the requestor should never be requesting this course, reject the
  298:     request permanently
  299: (c) pending - the requestor is not the recorded instructor, but could
  300:     become so after administrative action at the institution. Put the
  301:     request ina queue and check localenroll:validate_instcode()
  302:     periodically until the status changes to "valid".
  303: (d) approval - the request will be held pending review by a Domain Coordinator.
  304: (e) error  (followed by the error condition);  
  305: 
  306: validate_instcode takes five arguments -
  307:  (a) the LON-CAPA domain that will contain the course
  308:  (b) the institutional code (in the MSU case this is a concatenation of
  309:  semester code, department code, and course number, e.g., fs03nop590.
  310:  (c) an optional institutional username for the course owner.
  311:  (d) an optional comma-separated list of institutional affiliations of 
  312:      the course owner.
  313:  (e) an optional comma-separated list of institutional sections included in
  314:      the course request
  315: 
  316: =cut
  317: 
  318: sub validate_instcode {
  319:     my ($dom,$instcode,$owner,$inststatuslist,$instseclist) = @_;
  320:     my $outcome = '';
  321:     return $outcome;
  322: }
  323: 
  324: =pod
  325: 
  326: =item create_password()
  327: 
  328:  This is called when the authentication method set for the automated 
  329:  enrollment process when enrolling new users in the domain is "localauth".
  330:  This could be signalled for the specific user by the value of localauth
  331:  for the <authtype> tag from the classlist.xml files, or if this is blank,
  332:  the default authtype, set by the domain coordinator when creating the course
  333:  with loncreatecourse.pm.
  334:   
  335:  create_password takes three arguments -
  336:  (a) $authparam - the value of <autharg> from the classlist.xml files,
  337:  or if this blank, the default autharg, set by the domain coordinator when 
  338:  creating the course with loncreatecourse.pm
  339:  (b) $dom - the domain of the new user.
  340:  (c) $username - the username of the new user (currently not actually used)
  341: 
  342:  Four values are returned:
  343:  (a) the value of $authparam - which might have been changed
  344:  (b) a flag to indicate whether a password had been created
  345:  0 means no password created
  346:  1 means password created.  In this case the calling module - Enrollment.pm
  347:  will send the LON-CAPA username and password to the new user's e-mail
  348:  (if one was provided), or to the course owner (if one was not provided and
  349:  the new user was created by the automated process), or to the active
  350:  course coordinator (if the new user was created using the 'update roster
  351:  now' interface included in the Automated Enrollment Manager).  
  352:  (c) a flag to indicate that the authentication method is correct - 'ok'.
  353:  If $authchk is not set to 'ok' then account creation and enrollment of the 
  354:  new user will not occur.
  355:  (d) if a password was created it can be sent along.  This is the password 
  356:  which will be included in the e-mail sent to the new user, or made available    
  357:  to the course owner/course coordinator if no e-mail address is provided. If
  358:  you do not wish to send a password, but want to give instructions on obtaining
  359:  one, you could set $newpasswd as those instructions. (e.g.,
  360:  $newpasswd = '(Please visit room 212, ACNS Bldg. to obtain your password)';
  361:  The value of $newpasswd is NOT written in the user's LON-CAPA passwd file in
  362:  /home/httpd/lonUsers/$dom/a/b/c/abcuser/passwd, which in the case of a user
  363:  employing localauth will contain 'localauth:$authparam'.  If you need to include
  364:  a parameter in the user's passwd file, you should return it as $authparam,
  365:  i.e., the first of the variables returned by create_password().             
  366: 
  367: 
  368: =cut 
  369: 
  370: sub create_password {
  371:     my ($authparam,$dom,$username) = @_;
  372:     my $authchk = 'ok';
  373:     my $newpasswd = '';
  374:     my $create_passwd = 0;
  375:     return ($authparam,$create_passwd,$authchk,$newpasswd);
  376: }
  377: 
  378: =pod
  379: 
  380: =item instcode_format()
  381: 
  382:  Split coursecodes into constituent parts.   
  383:  e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1
  384:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
  385:  department name, 590 = course number)
  386: 
  387:  Incoming data:
  388:  $dom (domain)
  389:  $$instcodes{'43551dedcd43febmsul1'} = 'fs03nop590' (hash of courseIDs)
  390:  
  391:  fs03nop590 would be split as follows
  392:  @{$codetitles} = ("year","semester","department","number")
  393:  $$codes{'year'} = '2003'
  394:  $$codes{'semester'} = 'Fall'
  395:  $$codes{'department'} = 'nop'
  396:  $$codes{'number'} = '590'
  397: 
  398:  requires six arguments:
  399:  domain ($dom)
  400:  reference to hash of institutional course IDs ($instcodes)  
  401:  reference to hash of codes ($codes)
  402:  reference to array of titles ($codetitles)
  403:  reference to hash of abbreviations used in categories
  404:  reference to hash of arrays specifying sort order used in category titles   
  405: 
  406:  e.g.,     %{$$cat_titles{'Semester'}} = (
  407:                    fs => 'Fall',
  408:                    ss => 'Spring',
  409:                    us => 'Summer');
  410: 
  411:  e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs'); 
  412:  returns 1 parameter: 'ok' if no processing errors. 
  413: 
  414:  Detailed help:
  415:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  416: 
  417: =cut
  418: 
  419: 
  420: sub instcode_format () {
  421:     my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
  422:     my $outcome = 'ok';
  423:     return $outcome;
  424: }
  425: 
  426: =pod
  427: 
  428: =item possible_instcodes()
  429: 
  430: Gather acceptable values for institutional categories to use in course creation request form for official courses.
  431: 
  432:  requires four arguments:
  433:  domain ($dom)
  434:  reference to array of titles ($codetitles)
  435:  reference to hash of abbreviations used in categories ($cat_titles).
  436:  reference to hash of arrays specifying sort order used in category titles ($cat_order).
  437: 
  438:  e.g., 
  439:  @{$codetitles} = ("Year","Semester","Department","Number");
  440: 
  441:  %{$$cat_titles{'Semester'}} = (
  442:                    fs => 'Fall',
  443:                    ss => 'Spring',
  444:                    us => 'Summer');
  445: 
  446:  @{$$cat_order{'Semester'}} = ('ss','us','fs');
  447: 
  448:  returns 1 parameter: 'ok' if no processing errors.
  449: 
  450: =cut
  451: 
  452: sub possible_instcodes {
  453:     my ($dom,$codetitles,$cat_titles,$cat_order) = @_;
  454:     @{$codetitles} = ();
  455:     %{$$cat_titles{'Semester'}} = ();
  456:     @{$$cat_order{'Semester'}} = ('ss','us','fs');
  457:     ($$cat_titles{'Department'},$$cat_order{'Department'}) = &get_all_depts($dom);
  458:     ($$cat_titles{'Year'},$$cat_order{'Year'}) = &get_possible_years($dom);
  459:     return 'ok';
  460: }
  461: 
  462: 
  463: 
  464: =pod
  465: 
  466: =item institutional_photos()
  467: 
  468:  Called when automated enrollment manager is used to update student photos.
  469: 
  470:  Incoming data: six arguments
  471:  (a) $dom (domain)
  472:  (b) $crs (LONCAPA course number)
  473:  (c) $affiliates: a reference to a hash with the keys set to the 
  474:  institutional course IDs for the course.
  475:  (d) $result: a reference to a hash which will return usernames  
  476:      of students (& separated) in following categories (the keys):
  477:      new, update, missing, same, deleted, noid, nouser. The list 
  478:      includes those students for whom the result of the modification 
  479:      process was either addition of a new photo. update of an
  480:      existing photo, photo was found to be missing from institution's
  481:      data store, photo used is same as before, or photo was 
  482:      deleted from storage on LON-CAPA server housing student's
  483:      information, no student/employee ID was available. 
  484:                
  485:  (e) $action: the type of action needed. (e.g., update, delete);
  486:  (f) $students: a reference to a hash with the keys set to student 
  487:  usernames and domains in the form username:domain, and values set
  488:  to the studentID, if action is required for specific students.  
  489: 
  490:  returns 1 parameter: 'ok' if no processing errors.
  491:  other course or student specific values can be stored as values
  492:  in the appropriate referenced hashes. 
  493: 
  494: =cut
  495: 
  496: sub institutional_photos {
  497:     my ($dom,$crs,$affiliates,$result,$action,$students) = @_;
  498:     my $outcome = 'ok';
  499:     return $outcome;
  500: }
  501: 
  502: =pod
  503: 
  504: =item photo_permission()
  505: 
  506:  Incoming data: three arguments
  507:  (a) $dom (domain)
  508:  (b) $perm_reqd: a reference to a a scalar that is either 'yes'
  509:  if a course owner must indicate acceptance of conditions of use,
  510:  'no' otherwise.
  511:  (c) $conditions: the text of the conditions of use.
  512:     
  513:  returns 1 parameter: 'ok' if no processing errors.
  514:  $$perm_reqd is set to 'yes' or 'no'
  515:  $$agreement is set to conditions of use - plain text string
  516:              which will be displayed in a textarea in a web form.
  517: 
  518: 
  519: =cut
  520: 
  521: sub photo_permission {
  522:    my ($dom,$perm_reqd,$conditions) = @_;
  523:    $$perm_reqd = 'no';
  524:    $$conditions = '';
  525:    my $outcome = 'ok';
  526:    return $outcome;
  527: }
  528: 
  529: =pod
  530: 
  531: =item manager_photo_update()
  532: 
  533:  Incoming data: one argument
  534:  (a) $dom (domain)
  535: 
  536:  returns 2 parameters: update (0 or 1), and comment.
  537:  Called by automated enrollment manager, to determine 
  538:  whether "Update Student photos" button will be available,
  539:  and if so, the message (plain text string) that will be displayed
  540:  with the button. 
  541: 
  542: 
  543: =cut
  544:                                                                                         
  545: sub manager_photo_update {
  546:     my ($dom) = @_;
  547:     my $update = 0;
  548:     my $comment = '';
  549:     return ($update,$comment);
  550: }
  551: 
  552: =pod
  553: 
  554: 
  555: =item check_section()
  556: 
  557:  Incoming data: three arguments (+ fourth optional argument)
  558:  (a) $class - institutional class id (coursecode concatanated with section) 
  559:  (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username;
  560:                             2.6 and later - comma-separated list of 
  561:                             username:domain for course owner and co-owners.)
  562:  (c) $dom - domain of course
  563:  (d) $dbh - optional database handle
  564: 
  565:  returns 1 parameter - $sectioncheck ('ok' or other value). 
  566:  Verifies that at least one of the course owner (or co-owners) have access 
  567:  to classlist for specific class according to institution's SIS
  568:  'ok' if access available  
  569: 
  570: 
  571: =cut
  572: 
  573: sub check_section {
  574:     my ($class,$owner,$dom,$dbh) = @_;
  575:     my $sectioncheck = 'ok';
  576:     return $sectioncheck;
  577: }
  578: 
  579: =pod
  580: 
  581: =item instcode_defaults()
  582: 
  583:  Incoming data: three arguments
  584:  (a) $dom - domain
  585:  (b) $defaults - reference to hash which will contain default regular
  586:                  expression matches for different components of an 
  587:                  institutional course code 
  588:  (c) $code_order - reference to array which will contain order of 
  589:                    component parts used in institutional code.  
  590: 
  591:  returns 1 parameter - ('ok' or other value).
  592:  Used to construct a regular expression to be used when searching for
  593:  courses based on fragments of an institutional code.
  594:  $defaults contains defaults to use for each component, and code_order
  595:  contains keys of hash in order in which they are to be concatenated.
  596: 
  597:  e.g., INSTITUTIONALCODE = fs03nop590
  598:  (MSU's course naming scheme - fs  = semester, 03 = year, nop =
  599:  department name, 590 = course number)
  600: 
  601:      %{$defaults} = (
  602:         'Year' => '\d{2}',
  603:         'Semester' => '^[sfu]s', 
  604:         'Department' => '\w{2,3}',
  605:         'Number' => '\d{3,4}\w?',
  606:      );
  607: 
  608:      @{$code_order} = ('Semester','Year','Department','Number');
  609: 
  610:  Detailed help:
  611:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  612: 
  613: =cut
  614: 
  615: sub instcode_defaults {
  616:     my ($dom,$defaults,$code_order) = @_;
  617:     return 'ok';
  618: }
  619: 
  620: 
  621: =pod
  622: 
  623: =item allusers_info()
  624: 
  625:  Incoming data: three arguments
  626:  (a) $dom - domain
  627:  (b) $instusers - reference to hash which will contain hashes, 
  628:                  where keys will be usernames and value will be a 
  629:                  hash of user information. Keys in the inner hash 
  630:                  will be some or all of: lastname,firstname,
  631:                  middlename, generation, id, inststatus - 
  632:                  institutional status (e.g., faculty,staff,student)
  633:                  Values are all scalars except inststatus,
  634:                  which is an array.
  635:  (c) $instids - reference to hash which will contain ID numbers. 
  636:                 keys will be unique IDs (student or faculty/staff ID)
  637:                 values will be either: scalar (username) or an array 
  638:                 if a single ID matches multiple usernames.
  639:  returns 1 parameter - 'ok' if no processing error, or other value 
  640:                        if an error occurred.
  641:  side effects - populates the $instusers and $instids refs to hashes.
  642:                 with information for all users from all available 
  643:                 institutional datafeeds.
  644: 
  645: 
  646: =cut
  647: 
  648: sub allusers_info {
  649:     my ($dom,$instusers,$instids) = @_;
  650:     my $outcome = 'ok';
  651:     return $outcome; 
  652: }
  653: 
  654: =pod
  655: 
  656: =item get_userinfo()
  657: 
  658:  Incoming data: four required arguments and additional optional arguments
  659:  Two modes of operation:
  660:  (1) Retrieves institutional data for a single user either by username
  661:      if $uname is included as second argument, or by ID if $id is 
  662:      included as a third argument.  Either (b) or (c) must be provided.
  663:      (g), (h) and (i) will be undefined.
  664:  (2) Retrieves institutional user data from search of an institutional
  665:      directory based on a search. (g) and (h) are required.
  666:      (i) is optional. (b) and (c) will be undefined. 
  667: 
  668:  (a) $dom - domain
  669:  (b) $uname - username of user
  670:  (c) $id - student/faculty ID of user
  671:  (d) $instusers - reference to hash which will contain info for user
  672:                  as key = value; keys will be one or all of:
  673:                  lastname,firstname,middlename,generation,id,inststatus -
  674:                  institutional status (e.g., faculty,staff,student)
  675:                  Values are all scalars except inststatus,
  676:                  which is an array.
  677:  (e) $instids - reference to hash which will contain ID numbers - 
  678:                  keys will be unique IDs (student or faculty/staff ID)  
  679:                  values will be either: scalar (username) or an array
  680:                  if a single ID matches multiple usernames.
  681:  (f) $types - optional reference to array which contains 
  682:               institutional types to check.
  683:  (g) $srchby - optional if $uname or $id defined, otherwise required.
  684:                Allowed values include: 1. lastfirst, 2. last, 3. uname
  685:                corresponding to searches by 1. lastname,firstname;
  686:                2. lastname; 3. username
  687:  (h) $srchterm - optional if $uname or $id defined, otherwise required
  688:                 String to search for.
  689:  (i) $srchtype - optional. Allowed values: contains, begins (defaults
  690:                 to exact match otherwise).
  691: 
  692:  returns 1 parameter - 'ok' if no processing error, or other value 
  693:                        if an error occurred.
  694:  side effects - populates the $instusers and $instids refs to hashes.
  695:                 with information for specified username, or specified
  696:                 id, if fifth argument provided, from all available, or 
  697:                 specified (e.g., faculty only) institutional datafeeds,
  698:                 if sixth argument provided.
  699: 
  700:  WARNING: You need to set $outcome to 'ok' once you have customized
  701:           this routine to communicate with an instititional 
  702:           directory data source, otherwise institutional directory 
  703:           searches will always be reported as being unavailable
  704:           in domain $dom.
  705: 
  706: =cut
  707: 
  708: sub get_userinfo {
  709:     my ($dom,$uname,$id,$instusers,$instids,$types,
  710:         $srchby,$srchterm,$srchtype) = @_;
  711:     my $outcome = 'unavailable';
  712:     return $outcome;
  713: }
  714: 
  715: =pod
  716: 
  717: =item inst_usertypes() 
  718: 
  719:  Incoming data: three arguments
  720:  (a) $dom - domain
  721:  (b) $usertypes - reference to hash which will contain 
  722:                  key = value, where keys are institution 
  723:                  affiliation types (e.g., Faculty, Student etc.)
  724:                  and values are titles (e.g., Faculty/Academic Staff)
  725:  (c) $order - reference to array which will contain the order in
  726:               which institutional types should be shown
  727:               when displaying data tables (e.g., default quotas    
  728:               or updateable user fields (see domainprefs.pm) 
  729:  returns 1 parameter - 'ok' if no processing error, or other value 
  730:                         if an error occurred.
  731: 
  732: 
  733: =cut
  734: 
  735: sub inst_usertypes {
  736:     my ($dom,$usertypes,$order) = @_;
  737:     @{$order} = ();
  738:     %{$usertypes} = ();
  739:     my $outcome = 'ok';
  740:     return $outcome;
  741: }
  742: 
  743: =pod
  744: 
  745: =item username_rules()
  746: 
  747:  Incoming data: three arguments 
  748:  (a) $dom - domain
  749:  (b) $ruleshash - reference to hash containing rules
  750:                   (a hash of a hash)
  751:                   keys of top level hash are short names  
  752:                    (e.g., netid, noncredit) 
  753:                   for each key, value is a hash
  754:                       desc => long name for rule  
  755:                       rule => description of rule
  756:                       authtype => (krb5,krb4,int, or loc)
  757:                                  authentication type for rule 
  758:                       authparm => authentication parameter for rule
  759:                       authparmfixed => 1 if authparm used when
  760:                           creating user for rule must be authparm  
  761:                       authmsg => Message to display describing 
  762:                                  authentication to use for this rule
  763: 
  764:  (c) $rulesorder - reference to array containing rule names 
  765:                    in order to be displayed
  766: 
  767: 
  768:   returns 'ok' if no processing error.
  769: 
  770: =cut
  771: 
  772: sub username_rules {
  773:     my ($dom,$ruleshash,$rulesorder) = @_;
  774:     my $outcome;
  775:     return $outcome;
  776: }
  777: 
  778: =pod
  779: 
  780: =item id_rules()
  781: 
  782:  Incoming data: three arguments
  783:  (a) $dom - domain
  784:  (b) $ruleshash - reference to hash containing rules
  785:                   (a hash of a hash)
  786:                   keys of top level hash are short names
  787:                    (e.g., netid, noncredit)
  788:                   for each key, value is a hash
  789:                       desc => long name for rule
  790:                       rule => description of rule
  791: 
  792:  (c) $rulesorder - reference to array containing rule names
  793:                    in order to be displayed
  794: 
  795:   returns 'ok' if no processing error.
  796: 
  797: =cut
  798: 
  799: sub id_rules {
  800:     my ($dom,$ruleshash,$rulesorder) = @_;
  801:     my $outcome;
  802:     return $outcome;
  803: }
  804: 
  805: =pod
  806: 
  807: =item selfcreate_rules()
  808: 
  809:  Incoming data: three arguments
  810:  (a) $dom - domain
  811:  (b) $ruleshash - reference to hash containing rules
  812:                   (a hash of a hash)
  813:                   keys of top level hash are short names
  814:                    (e.g., netid)
  815:                   for each key, value is a hash
  816:                       desc => long name for rule
  817:                       rule => description of rule
  818: 
  819:  (c) $rulesorder - reference to array containing rule names
  820:                    in order to be displayed
  821: 
  822:   returns 'ok' if no processing error.
  823: 
  824: 
  825: =cut
  826: 
  827: sub selfcreate_rules {
  828:     my ($dom,$ruleshash,$rulesorder) = @_;
  829:     my $outcome;
  830:     return $outcome;
  831: }
  832: 
  833: =pod
  834: 
  835: =item username_check() 
  836: 
  837:  Incoming data: four arguments
  838:  (a) $dom - domain (scalar) 
  839:  (b) $uname - username to compare against rules (scalar)
  840:  (c) $to_check (reference to array of rule names to check)
  841:  (d) $resultshash (reference to hash of results)
  842:                     hash of results for rule checked
  843:                    - keys are rule names
  844:                    - values are: 1 or 0 (for matched or unmatched) 
  845: 
  846:  returns 'ok' if no processing error.
  847: 
  848: 
  849: =cut
  850: 
  851: sub username_check {
  852:     my ($dom,$uname,$to_check,$resultshash) = @_;
  853:     my $outcome;
  854:     return $outcome; 
  855: }
  856: 
  857: =pod
  858: 
  859: =item id_check()
  860: 
  861:  Incoming data: four arguments
  862:  (a) $dom - domain (scalar)
  863:  (b) $id - ID to compare against rules (scalar)
  864:  (c) $to_check (reference to array of rule names to check)
  865:  (d) $resultshash (reference to hash of results)
  866:                     hash of results for rule checked
  867:                    - keys are rule names
  868:                    - values are: 1 or 0 (for matched or unmatched)
  869: 
  870:  returns 'ok' if no processing error.
  871: 
  872: 
  873: =cut
  874: 
  875: sub id_check {
  876:     my ($dom,$id,$to_check,$resultshash) = @_;
  877:     my $outcome;
  878:     return $outcome;
  879: }
  880: 
  881: =pod
  882: 
  883: =item selfcreate_check()
  884: 
  885:  Incoming data: four arguments
  886:  (a) $dom - domain (scalar)
  887:  (b) $selfcreatename - e-mail proposed as username (compare against rules - scalar)
  888:  (c) $to_check (reference to array of rule names to check)
  889:  (d) $resultshash (reference to hash of results)
  890:                    hash of results for rule checked
  891:                    - keys are rule names
  892:                    - values are: 1 or 0 (for matched or unmatched)
  893: 
  894:  returns 'ok' if no processing error.
  895: 
  896: 
  897: =cut
  898: 
  899: sub selfcreate_check {
  900:     my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
  901:     my $outcome;
  902:     return $outcome;
  903: }
  904: 
  905: =pod
  906: 
  907: =item AUTOLOAD()
  908: 
  909:  Incoming data: none
  910:  Returns ''
  911: 
  912:  Prevents errors when undefined subroutines are called in this package
  913:  Will allow new routines added in the future to be called from lond etc.
  914:  without the need for customized versions of local*.pm packages to be
  915:  modified to include the new subroutines immediately.
  916: 
  917:  See "Programming Perl" 3rd ed. pp 296-298.   
  918: 
  919: =back
  920: 
  921: =cut
  922: 
  923: sub AUTOLOAD {
  924:     our $AUTOLOAD;
  925:     return '';
  926: }
  927: 
  928: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>