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