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

1.5       albertel    1: # functions to glue school database system into Lon-CAPA for 
                      2: # automated enrollment
1.27    ! raeburn     3: # $Id: localenroll.pm,v 1.26 2007/09/12 19:50:47 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) 
                    430: # (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username)
                    431: # (c) $dom 0 domain of course
                    432: # (d) $dbh - optional database handle  
                    433: #
                    434: # returns 1 parameter - $sectioncheck ('ok' or other value). 
                    435: # Verifies that course owner has access to classlist for specific class
                    436: # according to institution's SIS. 'ok' if access available  
                    437: ###############################
                    438: 
                    439: sub check_section {
                    440:     my ($class,$owner,$dom,$dbh) = @_;
                    441:     my $sectioncheck = 'ok';
                    442:     return $sectioncheck;
                    443: }
                    444: 
                    445: ###############################
1.17      raeburn   446: # sub instcode_defaults
                    447: #
                    448: # Incoming data: three arguments
                    449: # (a) $dom - domain
                    450: # (b) $defaults - reference to hash which will contain default regular
                    451: #                 expression matches for different components of an 
                    452: #                 institutional course code 
                    453: # (c) $code_order - reference to array which will contain order of 
                    454: #                   component parts used in institutional code.  
                    455: #
                    456: # returns 1 parameter - ('ok' or other value).
                    457: # Used to construct a regular expression to be used when searching for
                    458: # courses based on fragments of an institutional code.
                    459: # $defaults contains defaults to use for each component, and code_order
                    460: # contains keys of hash in order in which they are to be concatenated.
                    461: #
                    462: # e.g., INSTITUTIONALCODE = fs03nop590
                    463: # (MSU's course naming scheme - fs  = semester, 03 = year, nop =
                    464: # department name, 590 = course number)
                    465: #
                    466: #     %{$defaults} = (
                    467: #        'Year' => '\d{2}',
                    468: #        'Semester' => '^[sfu]s', 
                    469: #        'Department' => '\w{2,3}',
                    470: #        'Number' => '\d{3,4}\w?',
                    471: #     );
                    472: #
                    473: #     @{$code_order} = ('Semester','Year','Department','Number');
                    474: #
                    475: ###############################
                    476: 
                    477: sub instcode_defaults {
                    478:     my ($dom,$defaults,$code_order) = @_;
                    479:     return 'ok';
                    480: }
                    481: 
1.18      raeburn   482: ###############################
                    483: # sub allusers_info
                    484: #
                    485: # Incoming data: three arguments
                    486: # (a) $dom - domain
                    487: # (b) $instusers - reference to hash which will contain hashes, 
                    488: #                 where keys will be usernames and value will be a 
                    489: #                 hash of user information. Keys in the inner hash 
                    490: #                 will be some or all of: lastname,firstname,
                    491: #                 middlename, generation, id, inststatus - 
                    492: #                 institutional status (e.g., faculty,staff,student)
                    493: #                 Values are all scalars except inststatus,
                    494: #                 which is an array.
                    495: # (c) $instids - reference to hash which will contain ID numbers. 
                    496: #                keys will be unique IDs (student or faculty/staff ID)
                    497: #                values will be either: scalar (username) or an array 
                    498: #                if a single ID matches multiple usernames.
1.24      raeburn   499: # returns 1 parameter - 'ok' if no processing error, or other value 
                    500: #                       if an error occurred.
1.18      raeburn   501: # side effects - populates the $instusers and $instids refs to hashes.
                    502: #                with information for all users from all available 
                    503: #                institutional datafeeds.
                    504: #
                    505: ###############################
                    506: 
                    507: sub allusers_info {
                    508:     my ($dom,$instusers,$instids) = @_;
                    509:     my $outcome = 'ok';
                    510:     return $outcome; 
                    511: }
                    512: 
                    513: ###############################
                    514: # sub get_userinfo
                    515: #
1.23      albertel  516: # Incoming data: four required arguments and additional optional arguments
1.22      raeburn   517: # Two modes of operation:
                    518: # (1) Retrieves institutional data for a single user either by username
                    519: #     if $uname is included as second argument, or by ID if $id is 
                    520: #     included as a third argument.  Either (b) or (c) must be provided.
                    521: #     (g), (h) and (i) will be undefined.
                    522: # (2) Retrieves institutional user data from search of an institutional
                    523: #     directory based on a search. (g) and (h) are required.
                    524: #     (i) is optional. (b) and (c) will be undefined. 
                    525: #
1.18      raeburn   526: # (a) $dom - domain
                    527: # (b) $uname - username of user
                    528: # (c) $id - student/faculty ID of user
                    529: # (d) $instusers - reference to hash which will contain info for user
                    530: #                 as key = value; keys will be one or all of:
                    531: #                 lastname,firstname,middlename,generation,id,inststatus -
                    532: #                 institutional status (e.g., faculty,staff,student)
                    533: #                 Values are all scalars except inststatus,
                    534: #                 which is an array.
                    535: # (e) $instids - reference to hash which will contain ID numbers - 
                    536: #                 keys will be unique IDs (student or faculty/staff ID)  
                    537: #                 values will be either: scalar (username) or an array
                    538: #                 if a single ID matches multiple usernames.
                    539: # (f) $types - optional reference to array which contains 
                    540: #              institutional types to check.
1.21      raeburn   541: # (g) $srchby - optional if $uname or $id defined, otherwise required.
                    542: #               Allowed values include: 1. lastfirst, 2. last, 3. uname
                    543: #               corresponding to searches by 1. lastname,firstname;
                    544: #               2. lastname; 3. username
                    545: # (h) $srchterm - optional if $uname or $id defined, otherwise required
                    546: #                String to search for.
1.22      raeburn   547: # (i) $srchtype - optional. Allowed values: contains, begins (defaults
                    548: #                to exact match otherwise).
1.18      raeburn   549: #
1.24      raeburn   550: # returns 1 parameter - 'ok' if no processing error, or other value 
                    551: #                       if an error occurred.
1.18      raeburn   552: # side effects - populates the $instusers and $instids refs to hashes.
                    553: #                with information for specified username, or specified
                    554: #                id, if fifth argument provided, from all available, or 
                    555: #                specified (e.g., faculty only) institutional datafeeds,
                    556: #                if sixth argument provided.
1.24      raeburn   557: #
                    558: # WARNING: You need to set $outcome to 'ok' once you have customized
                    559: #          this routine to communicate with an instititional 
                    560: #          directory data source, otherwise institutional directory 
                    561: #          searches will always be reported as being unavailable
                    562: #          in domain $dom.
                    563: #
1.18      raeburn   564: ###############################
                    565: 
                    566: sub get_userinfo {
1.21      raeburn   567:     my ($dom,$uname,$id,$instusers,$instids,$types,
                    568:         $srchby,$srchterm,$srchtype) = @_;
1.24      raeburn   569:     my $outcome = 'unavailable';
1.18      raeburn   570:     return $outcome;
                    571: }
                    572: 
                    573: ###############################
                    574: # sub inst_usertypes 
                    575: #
                    576: # Incoming data: three arguments
                    577: # (a) $dom - domain
                    578: # (b) $usertypes - reference to hash which will contain 
                    579: #                 key = value, where keys are institution 
                    580: #                 affiliation types (e.g., Faculty, Student etc.)
                    581: #                 and values are titles (e.g., Faculty/Academic Staff)
                    582: # (c) $order - reference to array which will contain the order in
                    583: #              which institutional types should be shown
                    584: #              when displaying data tables (e.g., default quotas    
                    585: #              or updateable user fields (see domainprefs.pm) 
1.24      raeburn   586: # returns 1 parameter - 'ok' if no processing error, or other value 
                    587: #                        if an error occurred.
1.18      raeburn   588: #
                    589: ###############################
                    590: 
                    591: sub inst_usertypes {
                    592:     my ($dom,$usertypes,$order) = @_;
1.20      raeburn   593:     @{$order} = ();
                    594:     %{$usertypes} = ();
1.18      raeburn   595:     my $outcome = 'ok';
                    596:     return $outcome;
                    597: }
1.17      raeburn   598: 
                    599: ###############################
1.25      raeburn   600: # sub username_rules
                    601: #
                    602: # Incoming data: three arguments 
                    603: # (a) $dom - domain
                    604: # (b) $ruleshash - reference to hash containing rules
                    605: #                  (a hash of a hash)
                    606: #                  keys of top level hash are short names  
                    607: #                   (e.g., netid, noncredit) 
                    608: #                  for each key, value is a hash
                    609: #                      desc => long name for rule  
                    610: #                      rule => description of rule
                    611: #                      authtype => (krb5,krb4,int, or loc)
                    612: #                                 authentication type for rule 
                    613: #                      authparm => authentication parameter for rule
                    614: #                      authparmfixed => 1 if authparm used when
                    615: #                          creating user for rule must be authparm  
                    616: #                      authmsg => Message to display describing 
                    617: #                                 authentication to use for this rule
                    618: #
                    619: # (c) $rulesorder - reference to array containing rule names 
                    620: #                   in order to be displayed
                    621: 
                    622: #
                    623: #  returns 'ok' if no processing error.
                    624: #
                    625: ############################### 
                    626: 
                    627: sub username_rules {
                    628:     my ($dom,$ruleshash,$rulesorder) = @_;
                    629:     my $outcome;
                    630:     return $outcome;
                    631: }
                    632: 
                    633: ###############################
1.27    ! raeburn   634: # sub id_rules
        !           635: #
        !           636: # Incoming data: three arguments
        !           637: # (a) $dom - domain
        !           638: # (b) $ruleshash - reference to hash containing rules
        !           639: #                  (a hash of a hash)
        !           640: #                  keys of top level hash are short names
        !           641: #                   (e.g., netid, noncredit)
        !           642: #                  for each key, value is a hash
        !           643: #                      desc => long name for rule
        !           644: #                      rule => description of rule
        !           645: #
        !           646: # (c) $rulesorder - reference to array containing rule names
        !           647: #                   in order to be displayed
        !           648: 
        !           649: #
        !           650: #  returns 'ok' if no processing error.
        !           651: #
        !           652: ###############################
        !           653: 
        !           654: sub id_rules {
        !           655:     my ($dom,$ruleshash,$rulesorder) = @_;
        !           656:     my $outcome;
        !           657:     return $outcome;
        !           658: }
        !           659: 
        !           660: ###############################
1.26      raeburn   661: # sub username_check 
1.25      raeburn   662: #
                    663: # Incoming data: four arguments
                    664: # (a) $dom - domain (scalar) 
                    665: # (b) $uname - username to compare against rules (scalar)
                    666: # (c) $to_check (reference to array of rule names to check)
                    667: # (d) $resultshash (reference to hash of results)
                    668: #                    hash of results for rule checked
                    669: #                   - keys are rule names
                    670: #                   - values are: 1 or 0 (for matched or unmatched) 
                    671: #
                    672: # returns 'ok' if no processing error.
                    673: #
                    674: ###############################
                    675: 
                    676: sub username_check {
                    677:     my ($dom,$uname,$to_check,$resultshash) = @_;
                    678:     my $outcome;
                    679:     return $outcome; 
                    680: }
                    681: 
                    682: ###############################
1.27    ! raeburn   683: # sub id_check
        !           684: #
        !           685: # Incoming data: four arguments
        !           686: # (a) $dom - domain (scalar)
        !           687: # (b) $id - ID to compare against rules (scalar)
        !           688: # (c) $to_check (reference to array of rule names to check)
        !           689: # (d) $resultshash (reference to hash of results)
        !           690: #                    hash of results for rule checked
        !           691: #                   - keys are rule names
        !           692: #                   - values are: 1 or 0 (for matched or unmatched)
        !           693: #
        !           694: # returns 'ok' if no processing error.
        !           695: #
        !           696: ###############################
        !           697: 
        !           698: sub id_check {
        !           699:     my ($dom,$id,$to_check,$resultshash) = @_;
        !           700:     my $outcome;
        !           701:     return $outcome;
        !           702: }
        !           703: 
        !           704: ###############################
1.14      raeburn   705: # sub AUTOLOAD
                    706: #
                    707: # Incoming data: none
                    708: # Returns ''
                    709: #
                    710: # Prevents errors when undefined subroutines are called in this package
                    711: # Will allow new routines added in the future to be called from lond etc.
                    712: # without the need for customized versions of local*.pm packages to be
                    713: # modified to include the new subroutines immediately.
                    714: #
                    715: # See "Programming Perl" 3rd ed. pp 296-298.   
                    716: ###############################
                    717: 
                    718: sub AUTOLOAD {
                    719:     our $AUTOLOAD;
                    720:     return '';
                    721: }
                    722: 
1.1       raeburn   723: 1;

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