File:  [LON-CAPA] / loncom / enrollment / localenroll.pm
Revision 1.35: download - view: text, annotated - select for diffs
Thu Jun 11 20:09:25 2009 UTC (15 years ago) by raeburn
Branches: MAIN
CVS tags: bz5969, HEAD, BZ5971-printing-apage
- Request creation of official courses.
    - retrieve possible values for institutional categories.
    - used by lond::get_possible_instcodes_handler().

    1: # functions to glue school database system into Lon-CAPA for 
    2: # automated enrollment
    3: # $Id: localenroll.pm,v 1.35 2009/06/11 20:09:25 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 create_password()
  283: 
  284:  This is called when the authentication method set for the automated 
  285:  enrollment process when enrolling new users in the domain is "localauth".
  286:  This could be signalled for the specific user by the value of localauth
  287:  for the <authtype> tag from the classlist.xml files, or if this is blank,
  288:  the default authtype, set by the domain coordinator when creating the course
  289:  with loncreatecourse.pm.
  290:   
  291:  create_password takes three arguments -
  292:  (a) $authparam - the value of <autharg> from the classlist.xml files,
  293:  or if this blank, the default autharg, set by the domain coordinator when 
  294:  creating the course with loncreatecourse.pm
  295:  (b) $dom - the domain of the new user.
  296:  (c) $username - the username of the new user (currently not actually used)
  297: 
  298:  Four values are returned:
  299:  (a) the value of $authparam - which might have been changed
  300:  (b) a flag to indicate whether a password had been created
  301:  0 means no password created
  302:  1 means password created.  In this case the calling module - Enrollment.pm
  303:  will send the LON-CAPA username and password to the new user's e-mail
  304:  (if one was provided), or to the course owner (if one was not provided and
  305:  the new user was created by the automated process), or to the active
  306:  course coordinator (if the new user was created using the 'update roster
  307:  now' interface included in the Automated Enrollment Manager).  
  308:  (c) a flag to indicate that the authentication method is correct - 'ok'.
  309:  If $authchk is not set to 'ok' then account creation and enrollment of the 
  310:  new user will not occur.
  311:  (d) if a password was created it can be sent along.  This is the password 
  312:  which will be included in the e-mail sent to the new user, or made available    
  313:  to the course owner/course coordinator if no e-mail address is provided. If
  314:  you do not wish to send a password, but want to give instructions on obtaining
  315:  one, you could set $newpasswd as those instructions. (e.g.,
  316:  $newpasswd = '(Please visit room 212, ACNS Bldg. to obtain your password)';
  317:  The value of $newpasswd is NOT written in the user's LON-CAPA passwd file in
  318:  /home/httpd/lonUsers/$dom/a/b/c/abcuser/passwd, which in the case of a user
  319:  employing localauth will contain 'localauth:$authparam'.  If you need to include
  320:  a parameter in the user's passwd file, you should return it as $authparam,
  321:  i.e., the first of the variables returned by create_password().             
  322: 
  323: 
  324: =cut 
  325: 
  326: sub create_password {
  327:     my ($authparam,$dom,$username) = @_;
  328:     my $authchk = 'ok';
  329:     my $newpasswd = '';
  330:     my $create_passwd = 0;
  331:     return ($authparam,$create_passwd,$authchk,$newpasswd);
  332: }
  333: 
  334: =pod
  335: 
  336: =item instcode_format()
  337: 
  338:  Split coursecodes into constituent parts.   
  339:  e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1
  340:  (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
  341:  department name, 590 = course number)
  342: 
  343:  Incoming data:
  344:  $dom (domain)
  345:  $$instcodes{'43551dedcd43febmsul1'} = 'fs03nop590' (hash of courseIDs)
  346:  
  347:  fs03nop590 would be split as follows
  348:  @{$codetitles} = ("year","semester","department","number")
  349:  $$codes{'year'} = '2003'
  350:  $$codes{'semester'} = 'Fall'
  351:  $$codes{'department'} = 'nop'
  352:  $$codes{'number'} = '590'
  353: 
  354:  requires six arguments:
  355:  domain ($dom)
  356:  reference to hash of institutional course IDs ($instcodes)  
  357:  reference to hash of codes ($codes)
  358:  reference to array of titles ($codetitles)
  359:  reference to hash of abbreviations used in categories
  360:  reference to hash of arrays specifying sort order used in category titles   
  361: 
  362:  e.g.,     %{$$cat_titles{'Semester'}} = (
  363:                    fs => 'Fall',
  364:                    ss => 'Spring',
  365:                    us => 'Summer');
  366: 
  367:  e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs'); 
  368:  returns 1 parameter: 'ok' if no processing errors. 
  369: 
  370:  Detailed help:
  371:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  372: 
  373: =cut
  374: 
  375: 
  376: sub instcode_format () {
  377:     my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
  378:     my $outcome = 'ok';
  379:     return $outcome;
  380: }
  381: 
  382: =pod
  383: 
  384: =item possible_instcodes()
  385: 
  386: Gather acceptable values for institutional categories to use in course creation request form for official courses.
  387: 
  388:  requires four arguments:
  389:  domain ($dom)
  390:  reference to array of titles ($codetitles)
  391:  reference to hash of abbreviations used in categories ($cat_titles).
  392:  reference to hash of arrays specifying sort order used in category titles ($cat_order).
  393: 
  394:  e.g., 
  395:  @{$codetitles} = ("Year","Semester","Department","Number");
  396: 
  397:  %{$$cat_titles{'Semester'}} = (
  398:                    fs => 'Fall',
  399:                    ss => 'Spring',
  400:                    us => 'Summer');
  401: 
  402:  @{$$cat_order{'Semester'}} = ('ss','us','fs');
  403: 
  404:  returns 1 parameter: 'ok' if no processing errors.
  405: 
  406: =cut
  407: 
  408: sub possible_instcodes {
  409:     my ($dom,$codetitles,$cat_titles,$cat_order) = @_;
  410:     @{$codetitles} = ();
  411:     %{$$cat_titles{'Semester'}} = ();
  412:     @{$$cat_order{'Semester'}} = ('ss','us','fs');
  413:     ($$cat_titles{'Department'},$$cat_order{'Department'}) = &get_all_depts($dom);
  414:     ($$cat_titles{'Year'},$$cat_order{'Year'}) = &get_possible_years($dom);
  415:     return 'ok';
  416: }
  417: 
  418: 
  419: 
  420: =pod
  421: 
  422: =item institutional_photos()
  423: 
  424:  Called when automated enrollment manager is used to update student photos.
  425: 
  426:  Incoming data: six arguments
  427:  (a) $dom (domain)
  428:  (b) $crs (LONCAPA course number)
  429:  (c) $affiliates: a reference to a hash with the keys set to the 
  430:  institutional course IDs for the course.
  431:  (d) $result: a reference to a hash which will return usernames  
  432:      of students (& separated) in following categories (the keys):
  433:      new, update, missing, same, deleted, noid, nouser. The list 
  434:      includes those students for whom the result of the modification 
  435:      process was either addition of a new photo. update of an
  436:      existing photo, photo was found to be missing from institution's
  437:      data store, photo used is same as before, or photo was 
  438:      deleted from storage on LON-CAPA server housing student's
  439:      information, no student/employee ID was available. 
  440:                
  441:  (e) $action: the type of action needed. (e.g., update, delete);
  442:  (f) $students: a reference to a hash with the keys set to student 
  443:  usernames and domains in the form username:domain, and values set
  444:  to the studentID, if action is required for specific students.  
  445: 
  446:  returns 1 parameter: 'ok' if no processing errors.
  447:  other course or student specific values can be stored as values
  448:  in the appropriate referenced hashes. 
  449: 
  450: =cut
  451: 
  452: sub institutional_photos {
  453:     my ($dom,$crs,$affiliates,$result,$action,$students) = @_;
  454:     my $outcome = 'ok';
  455:     return $outcome;
  456: }
  457: 
  458: =pod
  459: 
  460: =item photo_permission()
  461: 
  462:  Incoming data: three arguments
  463:  (a) $dom (domain)
  464:  (b) $perm_reqd: a reference to a a scalar that is either 'yes'
  465:  if a course owner must indicate acceptance of conditions of use,
  466:  'no' otherwise.
  467:  (c) $conditions: the text of the conditions of use.
  468:     
  469:  returns 1 parameter: 'ok' if no processing errors.
  470:  $$perm_reqd is set to 'yes' or 'no'
  471:  $$agreement is set to conditions of use - plain text string
  472:              which will be displayed in a textarea in a web form.
  473: 
  474: 
  475: =cut
  476: 
  477: sub photo_permission {
  478:    my ($dom,$perm_reqd,$conditions) = @_;
  479:    $$perm_reqd = 'no';
  480:    $$conditions = '';
  481:    my $outcome = 'ok';
  482:    return $outcome;
  483: }
  484: 
  485: =pod
  486: 
  487: =item manager_photo_update()
  488: 
  489:  Incoming data: one argument
  490:  (a) $dom (domain)
  491: 
  492:  returns 2 parameters: update (0 or 1), and comment.
  493:  Called by automated enrollment manager, to determine 
  494:  whether "Update Student photos" button will be available,
  495:  and if so, the message (plain text string) that will be displayed
  496:  with the button. 
  497: 
  498: 
  499: =cut
  500:                                                                                         
  501: sub manager_photo_update {
  502:     my ($dom) = @_;
  503:     my $update = 0;
  504:     my $comment = '';
  505:     return ($update,$comment);
  506: }
  507: 
  508: =pod
  509: 
  510: 
  511: =item check_section()
  512: 
  513:  Incoming data: three arguments (+ fourth optional argument)
  514:  (a) $class - institutional class id (coursecode concatanated with section) 
  515:  (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username;
  516:                             2.6 and later - comma-separated list of 
  517:                             username:domain for course owner and co-owners.)
  518:  (c) $dom - domain of course
  519:  (d) $dbh - optional database handle
  520: 
  521:  returns 1 parameter - $sectioncheck ('ok' or other value). 
  522:  Verifies that at least one of the course owner (or co-owners) have access 
  523:  to classlist for specific class according to institution's SIS
  524:  'ok' if access available  
  525: 
  526: 
  527: =cut
  528: 
  529: sub check_section {
  530:     my ($class,$owner,$dom,$dbh) = @_;
  531:     my $sectioncheck = 'ok';
  532:     return $sectioncheck;
  533: }
  534: 
  535: =pod
  536: 
  537: =item instcode_defaults()
  538: 
  539:  Incoming data: three arguments
  540:  (a) $dom - domain
  541:  (b) $defaults - reference to hash which will contain default regular
  542:                  expression matches for different components of an 
  543:                  institutional course code 
  544:  (c) $code_order - reference to array which will contain order of 
  545:                    component parts used in institutional code.  
  546: 
  547:  returns 1 parameter - ('ok' or other value).
  548:  Used to construct a regular expression to be used when searching for
  549:  courses based on fragments of an institutional code.
  550:  $defaults contains defaults to use for each component, and code_order
  551:  contains keys of hash in order in which they are to be concatenated.
  552: 
  553:  e.g., INSTITUTIONALCODE = fs03nop590
  554:  (MSU's course naming scheme - fs  = semester, 03 = year, nop =
  555:  department name, 590 = course number)
  556: 
  557:      %{$defaults} = (
  558:         'Year' => '\d{2}',
  559:         'Semester' => '^[sfu]s', 
  560:         'Department' => '\w{2,3}',
  561:         'Number' => '\d{3,4}\w?',
  562:      );
  563: 
  564:      @{$code_order} = ('Semester','Year','Department','Number');
  565: 
  566:  Detailed help:
  567:  http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
  568: 
  569: =cut
  570: 
  571: sub instcode_defaults {
  572:     my ($dom,$defaults,$code_order) = @_;
  573:     return 'ok';
  574: }
  575: 
  576: 
  577: =pod
  578: 
  579: =item allusers_info()
  580: 
  581:  Incoming data: three arguments
  582:  (a) $dom - domain
  583:  (b) $instusers - reference to hash which will contain hashes, 
  584:                  where keys will be usernames and value will be a 
  585:                  hash of user information. Keys in the inner hash 
  586:                  will be some or all of: lastname,firstname,
  587:                  middlename, generation, id, inststatus - 
  588:                  institutional status (e.g., faculty,staff,student)
  589:                  Values are all scalars except inststatus,
  590:                  which is an array.
  591:  (c) $instids - reference to hash which will contain ID numbers. 
  592:                 keys will be unique IDs (student or faculty/staff ID)
  593:                 values will be either: scalar (username) or an array 
  594:                 if a single ID matches multiple usernames.
  595:  returns 1 parameter - 'ok' if no processing error, or other value 
  596:                        if an error occurred.
  597:  side effects - populates the $instusers and $instids refs to hashes.
  598:                 with information for all users from all available 
  599:                 institutional datafeeds.
  600: 
  601: 
  602: =cut
  603: 
  604: sub allusers_info {
  605:     my ($dom,$instusers,$instids) = @_;
  606:     my $outcome = 'ok';
  607:     return $outcome; 
  608: }
  609: 
  610: =pod
  611: 
  612: =item get_userinfo()
  613: 
  614:  Incoming data: four required arguments and additional optional arguments
  615:  Two modes of operation:
  616:  (1) Retrieves institutional data for a single user either by username
  617:      if $uname is included as second argument, or by ID if $id is 
  618:      included as a third argument.  Either (b) or (c) must be provided.
  619:      (g), (h) and (i) will be undefined.
  620:  (2) Retrieves institutional user data from search of an institutional
  621:      directory based on a search. (g) and (h) are required.
  622:      (i) is optional. (b) and (c) will be undefined. 
  623: 
  624:  (a) $dom - domain
  625:  (b) $uname - username of user
  626:  (c) $id - student/faculty ID of user
  627:  (d) $instusers - reference to hash which will contain info for user
  628:                  as key = value; keys will be one or all of:
  629:                  lastname,firstname,middlename,generation,id,inststatus -
  630:                  institutional status (e.g., faculty,staff,student)
  631:                  Values are all scalars except inststatus,
  632:                  which is an array.
  633:  (e) $instids - reference to hash which will contain ID numbers - 
  634:                  keys will be unique IDs (student or faculty/staff ID)  
  635:                  values will be either: scalar (username) or an array
  636:                  if a single ID matches multiple usernames.
  637:  (f) $types - optional reference to array which contains 
  638:               institutional types to check.
  639:  (g) $srchby - optional if $uname or $id defined, otherwise required.
  640:                Allowed values include: 1. lastfirst, 2. last, 3. uname
  641:                corresponding to searches by 1. lastname,firstname;
  642:                2. lastname; 3. username
  643:  (h) $srchterm - optional if $uname or $id defined, otherwise required
  644:                 String to search for.
  645:  (i) $srchtype - optional. Allowed values: contains, begins (defaults
  646:                 to exact match otherwise).
  647: 
  648:  returns 1 parameter - 'ok' if no processing error, or other value 
  649:                        if an error occurred.
  650:  side effects - populates the $instusers and $instids refs to hashes.
  651:                 with information for specified username, or specified
  652:                 id, if fifth argument provided, from all available, or 
  653:                 specified (e.g., faculty only) institutional datafeeds,
  654:                 if sixth argument provided.
  655: 
  656:  WARNING: You need to set $outcome to 'ok' once you have customized
  657:           this routine to communicate with an instititional 
  658:           directory data source, otherwise institutional directory 
  659:           searches will always be reported as being unavailable
  660:           in domain $dom.
  661: 
  662: =cut
  663: 
  664: sub get_userinfo {
  665:     my ($dom,$uname,$id,$instusers,$instids,$types,
  666:         $srchby,$srchterm,$srchtype) = @_;
  667:     my $outcome = 'unavailable';
  668:     return $outcome;
  669: }
  670: 
  671: =pod
  672: 
  673: =item inst_usertypes() 
  674: 
  675:  Incoming data: three arguments
  676:  (a) $dom - domain
  677:  (b) $usertypes - reference to hash which will contain 
  678:                  key = value, where keys are institution 
  679:                  affiliation types (e.g., Faculty, Student etc.)
  680:                  and values are titles (e.g., Faculty/Academic Staff)
  681:  (c) $order - reference to array which will contain the order in
  682:               which institutional types should be shown
  683:               when displaying data tables (e.g., default quotas    
  684:               or updateable user fields (see domainprefs.pm) 
  685:  returns 1 parameter - 'ok' if no processing error, or other value 
  686:                         if an error occurred.
  687: 
  688: 
  689: =cut
  690: 
  691: sub inst_usertypes {
  692:     my ($dom,$usertypes,$order) = @_;
  693:     @{$order} = ();
  694:     %{$usertypes} = ();
  695:     my $outcome = 'ok';
  696:     return $outcome;
  697: }
  698: 
  699: =pod
  700: 
  701: =item username_rules()
  702: 
  703:  Incoming data: three arguments 
  704:  (a) $dom - domain
  705:  (b) $ruleshash - reference to hash containing rules
  706:                   (a hash of a hash)
  707:                   keys of top level hash are short names  
  708:                    (e.g., netid, noncredit) 
  709:                   for each key, value is a hash
  710:                       desc => long name for rule  
  711:                       rule => description of rule
  712:                       authtype => (krb5,krb4,int, or loc)
  713:                                  authentication type for rule 
  714:                       authparm => authentication parameter for rule
  715:                       authparmfixed => 1 if authparm used when
  716:                           creating user for rule must be authparm  
  717:                       authmsg => Message to display describing 
  718:                                  authentication to use for this rule
  719: 
  720:  (c) $rulesorder - reference to array containing rule names 
  721:                    in order to be displayed
  722: 
  723: 
  724:   returns 'ok' if no processing error.
  725: 
  726: =cut
  727: 
  728: sub username_rules {
  729:     my ($dom,$ruleshash,$rulesorder) = @_;
  730:     my $outcome;
  731:     return $outcome;
  732: }
  733: 
  734: =pod
  735: 
  736: =item id_rules()
  737: 
  738:  Incoming data: three arguments
  739:  (a) $dom - domain
  740:  (b) $ruleshash - reference to hash containing rules
  741:                   (a hash of a hash)
  742:                   keys of top level hash are short names
  743:                    (e.g., netid, noncredit)
  744:                   for each key, value is a hash
  745:                       desc => long name for rule
  746:                       rule => description of rule
  747: 
  748:  (c) $rulesorder - reference to array containing rule names
  749:                    in order to be displayed
  750: 
  751:   returns 'ok' if no processing error.
  752: 
  753: =cut
  754: 
  755: sub id_rules {
  756:     my ($dom,$ruleshash,$rulesorder) = @_;
  757:     my $outcome;
  758:     return $outcome;
  759: }
  760: 
  761: =pod
  762: 
  763: =item selfcreate_rules()
  764: 
  765:  Incoming data: three arguments
  766:  (a) $dom - domain
  767:  (b) $ruleshash - reference to hash containing rules
  768:                   (a hash of a hash)
  769:                   keys of top level hash are short names
  770:                    (e.g., netid)
  771:                   for each key, value is a hash
  772:                       desc => long name for rule
  773:                       rule => description of rule
  774: 
  775:  (c) $rulesorder - reference to array containing rule names
  776:                    in order to be displayed
  777: 
  778:   returns 'ok' if no processing error.
  779: 
  780: 
  781: =cut
  782: 
  783: sub selfcreate_rules {
  784:     my ($dom,$ruleshash,$rulesorder) = @_;
  785:     my $outcome;
  786:     return $outcome;
  787: }
  788: 
  789: =pod
  790: 
  791: =item username_check() 
  792: 
  793:  Incoming data: four arguments
  794:  (a) $dom - domain (scalar) 
  795:  (b) $uname - username to compare against rules (scalar)
  796:  (c) $to_check (reference to array of rule names to check)
  797:  (d) $resultshash (reference to hash of results)
  798:                     hash of results for rule checked
  799:                    - keys are rule names
  800:                    - values are: 1 or 0 (for matched or unmatched) 
  801: 
  802:  returns 'ok' if no processing error.
  803: 
  804: 
  805: =cut
  806: 
  807: sub username_check {
  808:     my ($dom,$uname,$to_check,$resultshash) = @_;
  809:     my $outcome;
  810:     return $outcome; 
  811: }
  812: 
  813: =pod
  814: 
  815: =item id_check()
  816: 
  817:  Incoming data: four arguments
  818:  (a) $dom - domain (scalar)
  819:  (b) $id - ID to compare against rules (scalar)
  820:  (c) $to_check (reference to array of rule names to check)
  821:  (d) $resultshash (reference to hash of results)
  822:                     hash of results for rule checked
  823:                    - keys are rule names
  824:                    - values are: 1 or 0 (for matched or unmatched)
  825: 
  826:  returns 'ok' if no processing error.
  827: 
  828: 
  829: =cut
  830: 
  831: sub id_check {
  832:     my ($dom,$id,$to_check,$resultshash) = @_;
  833:     my $outcome;
  834:     return $outcome;
  835: }
  836: 
  837: =pod
  838: 
  839: =item selfcreate_check()
  840: 
  841:  Incoming data: four arguments
  842:  (a) $dom - domain (scalar)
  843:  (b) $selfcreatename - e-mail proposed as username (compare against rules - scalar)
  844:  (c) $to_check (reference to array of rule names to check)
  845:  (d) $resultshash (reference to hash of results)
  846:                    hash of results for rule checked
  847:                    - keys are rule names
  848:                    - values are: 1 or 0 (for matched or unmatched)
  849: 
  850:  returns 'ok' if no processing error.
  851: 
  852: 
  853: =cut
  854: 
  855: sub selfcreate_check {
  856:     my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
  857:     my $outcome;
  858:     return $outcome;
  859: }
  860: 
  861: =pod
  862: 
  863: =item AUTOLOAD()
  864: 
  865:  Incoming data: none
  866:  Returns ''
  867: 
  868:  Prevents errors when undefined subroutines are called in this package
  869:  Will allow new routines added in the future to be called from lond etc.
  870:  without the need for customized versions of local*.pm packages to be
  871:  modified to include the new subroutines immediately.
  872: 
  873:  See "Programming Perl" 3rd ed. pp 296-298.   
  874: 
  875: =back
  876: 
  877: =cut
  878: 
  879: sub AUTOLOAD {
  880:     our $AUTOLOAD;
  881:     return '';
  882: }
  883: 
  884: 1;

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