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

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

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