Annotation of loncom/enrollment/localenroll.pm, revision 1.32

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

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