Annotation of loncom/enrollment/localenroll.pm, revision 1.38
1.5 albertel 1: # functions to glue school database system into Lon-CAPA for
2: # automated enrollment
1.38 ! raeburn 3: # $Id: localenroll.pm,v 1.37 2009/08/18 20:08:38 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:
1.37 raeburn 293: A valid instcode is confirmed by returning 'valid'.
1.36 raeburn 294:
1.38 ! raeburn 295: validate_instcode takes three arguments -
1.36 raeburn 296: (a) the LON-CAPA domain that will contain the course
297: (b) the institutional code (in the MSU case this is a concatenation of
298: semester code, department code, and course number, e.g., fs03nop590.
299: (c) an optional institutional username for the course owner.
300:
301: =cut
302:
303: sub validate_instcode {
1.38 ! raeburn 304: my ($dom,$instcode,$owner) = @_;
1.36 raeburn 305: my $outcome = '';
306: return $outcome;
307: }
308:
309: =pod
310:
1.38 ! raeburn 311: =item validate_crsreq()
! 312:
! 313: This is used to check whether a course request should be processed
! 314: automatically, or held in a queue pending administrative action at
! 315: the institution.
! 316:
! 317: Course requests will trigger this check if the process type has been set
! 318: to 'validate' for the course type (official, unofficial or community) and
! 319: the requestor's affiliation. Whether "validate" is an available option
! 320: in the Domain Configuration menu is controlled by auto_courserequest_checks().
! 321: One scenario is where the request is for an official course, in which case
! 322: a check could be made that the requestor is listed as instructor of
! 323: record for the course in the institution's course schedule/database.
! 324:
! 325: Other scenarios are possible, and the routine can be customized according
! 326: to whatever rules a domain wishes to implement to run validations against
! 327: given the data passed in to the routine.
! 328:
! 329: validate_crsreq takes six arguments -
! 330: (a) the LON-CAPA domain that will contain the course.
! 331: (b) the username:domain for the course owner.
! 332: (c) the course type (official, unofficial or community)
! 333: (d) a comma-separated list of institutional affiliations of
! 334: the course owner.
! 335: (e) the institutional code (in the MSU case this is a concatenation of
! 336: semester code, department code, and course number, e.g., fs03nop590.
! 337: (f) a comma-separated list of institutional sections included in
! 338: the course request (only applicable to official courses).
! 339:
! 340: A valid courserequest is confirmed by returning 'process'.
! 341: The following can be returned: process, rejected, pending, approval or error (with error condition - no :), followed by a : and then an optional message.
! 342:
! 343: (a) process - the requestor is the recorded instructor - create the course
! 344: (b) reject - the requestor should never be requesting this course, reject the
! 345: request permanently
! 346: (c) pending - the requestor is not the recorded instructor, but could
! 347: become so after administrative action at the institution. Put the
! 348: request in a queue and check localenroll:validate_instcode()
! 349: periodically until the status changes to "valid".
! 350: (d) approval - the request will be held pending review by a Domain Coordinator.
! 351: (e) error (followed by the error condition).
! 352:
! 353: =cut
! 354:
! 355: sub validate_crsreq {
! 356: my ($dom,$owner,$crstype,$inststatuslist,$instcode,$instseclist) = @_;
! 357: my $outcome = 'approval';
! 358: return $outcome;
! 359: }
! 360:
! 361: =pod
! 362:
! 363: =item crsreq_checks()
! 364:
! 365: This is used to determine whether the "validate" option should appear in the
! 366: possible choices for course request processing in the Domain Configuration
! 367: menu for Course Requests. Ultimately it is called by domainprefs.pm (via:
! 368: lonnet -> lond -> localenroll.pm) The domain configuration menu includes
! 369: a table where columns are course type (official, unofficial or community)
! 370: and rows are institutional affiliations (e.g., Faculty, Staff, Student etc.).
! 371:
! 372: crsreq_checks() takes three arguments: $dom, $reqtyes, $validations.
! 373: $dom - the domain for which validation options are needed.
! 374: $reqtypes - ref to an ARRAY of course types (i.e., official, unofficial and community.
! 375: $validations - ref to a hash of a hash which will determine whether "validate"
! 376: will be one of the possible choices for each course type (outer hash key),
! 377: and institutional type (inner hash key).
! 378:
! 379: For example to allow validate to be a choice for official classes for Faculty,
! 380: req_checks would include:
! 381:
! 382: $validations{'official'}{'Faculty'} = 1;
! 383:
! 384: This routine is closely tied to validate_crsreq(). "Validate" should not be
! 385: a possible choice in the domain configuration menu for a particular course
! 386: type/institutional affiliation, unless a corresponding validation code has
! 387: been implemented in validate_crsreq().
! 388:
! 389: For example at MSU, official courses requested by Faculty will be validated
! 390: against the official schedule of classes to check that the requestor is one
! 391: of the instructors of record for the course. In this case validate_crsreq()
! 392: includes a call to validate_instcode().
! 393:
! 394: =cut
! 395:
! 396: sub crsreq_checks {
! 397: my ($dom,$reqtypes,$validations) = @_;
! 398: if ((ref($reqtypes) eq 'ARRAY') && (ref($validations) eq 'HASH')) {
! 399: my (%usertypes,@order);
! 400: if (&inst_usertypes($dom,\%usertypes,\@order) eq 'ok') {
! 401: foreach my $type (@{$reqtypes}) {
! 402: foreach my $inst_type (@order) {
! 403: $validations->{$type}{$inst_type} = 0;
! 404: }
! 405: }
! 406: }
! 407: }
! 408: return 'ok';
! 409: }
! 410:
! 411: =pod
! 412:
1.32 jms 413: =item create_password()
414:
415: This is called when the authentication method set for the automated
416: enrollment process when enrolling new users in the domain is "localauth".
417: This could be signalled for the specific user by the value of localauth
418: for the <authtype> tag from the classlist.xml files, or if this is blank,
419: the default authtype, set by the domain coordinator when creating the course
420: with loncreatecourse.pm.
421:
422: create_password takes three arguments -
423: (a) $authparam - the value of <autharg> from the classlist.xml files,
424: or if this blank, the default autharg, set by the domain coordinator when
425: creating the course with loncreatecourse.pm
426: (b) $dom - the domain of the new user.
427: (c) $username - the username of the new user (currently not actually used)
428:
429: Four values are returned:
430: (a) the value of $authparam - which might have been changed
431: (b) a flag to indicate whether a password had been created
432: 0 means no password created
433: 1 means password created. In this case the calling module - Enrollment.pm
434: will send the LON-CAPA username and password to the new user's e-mail
435: (if one was provided), or to the course owner (if one was not provided and
436: the new user was created by the automated process), or to the active
437: course coordinator (if the new user was created using the 'update roster
438: now' interface included in the Automated Enrollment Manager).
439: (c) a flag to indicate that the authentication method is correct - 'ok'.
440: If $authchk is not set to 'ok' then account creation and enrollment of the
441: new user will not occur.
442: (d) if a password was created it can be sent along. This is the password
443: which will be included in the e-mail sent to the new user, or made available
444: to the course owner/course coordinator if no e-mail address is provided. If
445: you do not wish to send a password, but want to give instructions on obtaining
446: one, you could set $newpasswd as those instructions. (e.g.,
447: $newpasswd = '(Please visit room 212, ACNS Bldg. to obtain your password)';
448: The value of $newpasswd is NOT written in the user's LON-CAPA passwd file in
449: /home/httpd/lonUsers/$dom/a/b/c/abcuser/passwd, which in the case of a user
450: employing localauth will contain 'localauth:$authparam'. If you need to include
451: a parameter in the user's passwd file, you should return it as $authparam,
452: i.e., the first of the variables returned by create_password().
453:
454:
455: =cut
1.4 raeburn 456:
457: sub create_password {
1.13 albertel 458: my ($authparam,$dom,$username) = @_;
1.4 raeburn 459: my $authchk = 'ok';
1.11 raeburn 460: my $newpasswd = '';
1.4 raeburn 461: my $create_passwd = 0;
1.11 raeburn 462: return ($authparam,$create_passwd,$authchk,$newpasswd);
1.1 raeburn 463: }
464:
1.32 jms 465: =pod
466:
467: =item instcode_format()
468:
469: Split coursecodes into constituent parts.
470: e.g., INSTITUTIONALCODE = fs03nop590, LON-CAPA COURSEID: 43551dedcd43febmsul1
471: (MSU's course naming scheme - fs03 = Fall semester 2003, nop =
472: department name, 590 = course number)
473:
474: Incoming data:
475: $dom (domain)
476: $$instcodes{'43551dedcd43febmsul1'} = 'fs03nop590' (hash of courseIDs)
477:
478: fs03nop590 would be split as follows
479: @{$codetitles} = ("year","semester","department","number")
1.33 bisitz 480: $$codes{'year'} = '2003'
1.32 jms 481: $$codes{'semester'} = 'Fall'
482: $$codes{'department'} = 'nop'
483: $$codes{'number'} = '590'
484:
485: requires six arguments:
486: domain ($dom)
487: reference to hash of institutional course IDs ($instcodes)
488: reference to hash of codes ($codes)
489: reference to array of titles ($codetitles)
490: reference to hash of abbreviations used in categories
491: reference to hash of arrays specifying sort order used in category titles
492:
493: e.g., %{$$cat_titles{'Semester'}} = (
494: fs => 'Fall',
495: ss => 'Spring',
496: us => 'Summer');
497:
498: e.g., @{$$cat_order{'Semester'}} = ('ss','us','fs');
499: returns 1 parameter: 'ok' if no processing errors.
1.33 bisitz 500:
501: Detailed help:
502: http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
503:
1.32 jms 504: =cut
505:
1.10 raeburn 506:
507: sub instcode_format () {
508: my ($dom,$instcodes,$codes,$codetitles,$cat_titles,$cat_order) = @_;
509: my $outcome = 'ok';
510: return $outcome;
511: }
512:
1.35 raeburn 513: =pod
514:
515: =item possible_instcodes()
516:
517: Gather acceptable values for institutional categories to use in course creation request form for official courses.
518:
519: requires four arguments:
520: domain ($dom)
521: reference to array of titles ($codetitles)
522: reference to hash of abbreviations used in categories ($cat_titles).
523: reference to hash of arrays specifying sort order used in category titles ($cat_order).
524:
525: e.g.,
526: @{$codetitles} = ("Year","Semester","Department","Number");
527:
528: %{$$cat_titles{'Semester'}} = (
529: fs => 'Fall',
530: ss => 'Spring',
531: us => 'Summer');
532:
533: @{$$cat_order{'Semester'}} = ('ss','us','fs');
534:
535: returns 1 parameter: 'ok' if no processing errors.
536:
537: =cut
538:
539: sub possible_instcodes {
540: my ($dom,$codetitles,$cat_titles,$cat_order) = @_;
541: @{$codetitles} = ();
542: %{$$cat_titles{'Semester'}} = ();
543: @{$$cat_order{'Semester'}} = ('ss','us','fs');
544: ($$cat_titles{'Department'},$$cat_order{'Department'}) = &get_all_depts($dom);
545: ($$cat_titles{'Year'},$$cat_order{'Year'}) = &get_possible_years($dom);
546: return 'ok';
547: }
548:
549:
1.32 jms 550:
551: =pod
552:
553: =item institutional_photos()
554:
555: Called when automated enrollment manager is used to update student photos.
556:
557: Incoming data: six arguments
558: (a) $dom (domain)
559: (b) $crs (LONCAPA course number)
560: (c) $affiliates: a reference to a hash with the keys set to the
561: institutional course IDs for the course.
562: (d) $result: a reference to a hash which will return usernames
563: of students (& separated) in following categories (the keys):
564: new, update, missing, same, deleted, noid, nouser. The list
565: includes those students for whom the result of the modification
566: process was either addition of a new photo. update of an
567: existing photo, photo was found to be missing from institution's
568: data store, photo used is same as before, or photo was
569: deleted from storage on LON-CAPA server housing student's
1.34 weissno 570: information, no student/employee ID was available.
1.12 raeburn 571:
1.32 jms 572: (e) $action: the type of action needed. (e.g., update, delete);
573: (f) $students: a reference to a hash with the keys set to student
574: usernames and domains in the form username:domain, and values set
575: to the studentID, if action is required for specific students.
576:
577: returns 1 parameter: 'ok' if no processing errors.
578: other course or student specific values can be stored as values
579: in the appropriate referenced hashes.
580:
581: =cut
1.12 raeburn 582:
583: sub institutional_photos {
584: my ($dom,$crs,$affiliates,$result,$action,$students) = @_;
585: my $outcome = 'ok';
586: return $outcome;
587: }
588:
1.32 jms 589: =pod
590:
591: =item photo_permission()
592:
593: Incoming data: three arguments
594: (a) $dom (domain)
595: (b) $perm_reqd: a reference to a a scalar that is either 'yes'
596: if a course owner must indicate acceptance of conditions of use,
597: 'no' otherwise.
598: (c) $conditions: the text of the conditions of use.
599:
600: returns 1 parameter: 'ok' if no processing errors.
601: $$perm_reqd is set to 'yes' or 'no'
602: $$agreement is set to conditions of use - plain text string
603: which will be displayed in a textarea in a web form.
604:
605:
606: =cut
607:
1.12 raeburn 608: sub photo_permission {
609: my ($dom,$perm_reqd,$conditions) = @_;
610: $$perm_reqd = 'no';
611: $$conditions = '';
612: my $outcome = 'ok';
613: return $outcome;
614: }
615:
1.32 jms 616: =pod
617:
618: =item manager_photo_update()
619:
620: Incoming data: one argument
621: (a) $dom (domain)
622:
623: returns 2 parameters: update (0 or 1), and comment.
624: Called by automated enrollment manager, to determine
625: whether "Update Student photos" button will be available,
626: and if so, the message (plain text string) that will be displayed
627: with the button.
1.12 raeburn 628:
1.32 jms 629:
630: =cut
1.12 raeburn 631:
632: sub manager_photo_update {
633: my ($dom) = @_;
634: my $update = 0;
635: my $comment = '';
636: return ($update,$comment);
637: }
638:
1.32 jms 639: =pod
640:
641:
642: =item check_section()
643:
644: Incoming data: three arguments (+ fourth optional argument)
645: (a) $class - institutional class id (coursecode concatanated with section)
646: (b) $owner - course owner (2.2 and later username:domain; pre-2.2 username;
647: 2.6 and later - comma-separated list of
648: username:domain for course owner and co-owners.)
649: (c) $dom - domain of course
650: (d) $dbh - optional database handle
651:
652: returns 1 parameter - $sectioncheck ('ok' or other value).
653: Verifies that at least one of the course owner (or co-owners) have access
654: to classlist for specific class according to institution's SIS
655: 'ok' if access available
656:
657:
658: =cut
1.16 raeburn 659:
660: sub check_section {
661: my ($class,$owner,$dom,$dbh) = @_;
662: my $sectioncheck = 'ok';
663: return $sectioncheck;
664: }
665:
1.32 jms 666: =pod
667:
668: =item instcode_defaults()
669:
670: Incoming data: three arguments
671: (a) $dom - domain
672: (b) $defaults - reference to hash which will contain default regular
673: expression matches for different components of an
674: institutional course code
675: (c) $code_order - reference to array which will contain order of
676: component parts used in institutional code.
677:
678: returns 1 parameter - ('ok' or other value).
679: Used to construct a regular expression to be used when searching for
680: courses based on fragments of an institutional code.
681: $defaults contains defaults to use for each component, and code_order
682: contains keys of hash in order in which they are to be concatenated.
683:
684: e.g., INSTITUTIONALCODE = fs03nop590
685: (MSU's course naming scheme - fs = semester, 03 = year, nop =
686: department name, 590 = course number)
687:
688: %{$defaults} = (
689: 'Year' => '\d{2}',
690: 'Semester' => '^[sfu]s',
691: 'Department' => '\w{2,3}',
692: 'Number' => '\d{3,4}\w?',
693: );
694:
695: @{$code_order} = ('Semester','Year','Department','Number');
696:
1.33 bisitz 697: Detailed help:
698: http://yourloncapaserver/adm/help/Institutional_Integration_Course_Codes.hlp
699:
1.32 jms 700: =cut
1.17 raeburn 701:
702: sub instcode_defaults {
703: my ($dom,$defaults,$code_order) = @_;
704: return 'ok';
705: }
706:
1.32 jms 707:
708: =pod
709:
710: =item allusers_info()
711:
712: Incoming data: three arguments
713: (a) $dom - domain
714: (b) $instusers - reference to hash which will contain hashes,
715: where keys will be usernames and value will be a
716: hash of user information. Keys in the inner hash
717: will be some or all of: lastname,firstname,
718: middlename, generation, id, inststatus -
719: institutional status (e.g., faculty,staff,student)
720: Values are all scalars except inststatus,
721: which is an array.
722: (c) $instids - reference to hash which will contain ID numbers.
723: keys will be unique IDs (student or faculty/staff ID)
724: values will be either: scalar (username) or an array
725: if a single ID matches multiple usernames.
726: returns 1 parameter - 'ok' if no processing error, or other value
727: if an error occurred.
728: side effects - populates the $instusers and $instids refs to hashes.
729: with information for all users from all available
730: institutional datafeeds.
731:
732:
733: =cut
1.18 raeburn 734:
735: sub allusers_info {
736: my ($dom,$instusers,$instids) = @_;
737: my $outcome = 'ok';
738: return $outcome;
739: }
740:
1.32 jms 741: =pod
742:
743: =item get_userinfo()
744:
745: Incoming data: four required arguments and additional optional arguments
746: Two modes of operation:
747: (1) Retrieves institutional data for a single user either by username
748: if $uname is included as second argument, or by ID if $id is
749: included as a third argument. Either (b) or (c) must be provided.
750: (g), (h) and (i) will be undefined.
751: (2) Retrieves institutional user data from search of an institutional
752: directory based on a search. (g) and (h) are required.
753: (i) is optional. (b) and (c) will be undefined.
754:
755: (a) $dom - domain
756: (b) $uname - username of user
757: (c) $id - student/faculty ID of user
758: (d) $instusers - reference to hash which will contain info for user
759: as key = value; keys will be one or all of:
760: lastname,firstname,middlename,generation,id,inststatus -
761: institutional status (e.g., faculty,staff,student)
762: Values are all scalars except inststatus,
763: which is an array.
764: (e) $instids - reference to hash which will contain ID numbers -
765: keys will be unique IDs (student or faculty/staff ID)
766: values will be either: scalar (username) or an array
767: if a single ID matches multiple usernames.
768: (f) $types - optional reference to array which contains
769: institutional types to check.
770: (g) $srchby - optional if $uname or $id defined, otherwise required.
771: Allowed values include: 1. lastfirst, 2. last, 3. uname
772: corresponding to searches by 1. lastname,firstname;
773: 2. lastname; 3. username
774: (h) $srchterm - optional if $uname or $id defined, otherwise required
775: String to search for.
776: (i) $srchtype - optional. Allowed values: contains, begins (defaults
777: to exact match otherwise).
778:
779: returns 1 parameter - 'ok' if no processing error, or other value
780: if an error occurred.
781: side effects - populates the $instusers and $instids refs to hashes.
782: with information for specified username, or specified
783: id, if fifth argument provided, from all available, or
784: specified (e.g., faculty only) institutional datafeeds,
785: if sixth argument provided.
786:
787: WARNING: You need to set $outcome to 'ok' once you have customized
788: this routine to communicate with an instititional
789: directory data source, otherwise institutional directory
790: searches will always be reported as being unavailable
791: in domain $dom.
792:
793: =cut
1.18 raeburn 794:
795: sub get_userinfo {
1.21 raeburn 796: my ($dom,$uname,$id,$instusers,$instids,$types,
797: $srchby,$srchterm,$srchtype) = @_;
1.24 raeburn 798: my $outcome = 'unavailable';
1.18 raeburn 799: return $outcome;
800: }
801:
1.32 jms 802: =pod
803:
804: =item inst_usertypes()
805:
806: Incoming data: three arguments
807: (a) $dom - domain
808: (b) $usertypes - reference to hash which will contain
809: key = value, where keys are institution
810: affiliation types (e.g., Faculty, Student etc.)
811: and values are titles (e.g., Faculty/Academic Staff)
812: (c) $order - reference to array which will contain the order in
813: which institutional types should be shown
814: when displaying data tables (e.g., default quotas
815: or updateable user fields (see domainprefs.pm)
816: returns 1 parameter - 'ok' if no processing error, or other value
817: if an error occurred.
818:
819:
820: =cut
1.18 raeburn 821:
822: sub inst_usertypes {
823: my ($dom,$usertypes,$order) = @_;
1.20 raeburn 824: @{$order} = ();
825: %{$usertypes} = ();
1.18 raeburn 826: my $outcome = 'ok';
827: return $outcome;
828: }
1.17 raeburn 829:
1.32 jms 830: =pod
831:
832: =item username_rules()
833:
834: Incoming data: three arguments
835: (a) $dom - domain
836: (b) $ruleshash - reference to hash containing rules
837: (a hash of a hash)
838: keys of top level hash are short names
839: (e.g., netid, noncredit)
840: for each key, value is a hash
841: desc => long name for rule
842: rule => description of rule
843: authtype => (krb5,krb4,int, or loc)
844: authentication type for rule
845: authparm => authentication parameter for rule
846: authparmfixed => 1 if authparm used when
847: creating user for rule must be authparm
848: authmsg => Message to display describing
849: authentication to use for this rule
850:
851: (c) $rulesorder - reference to array containing rule names
852: in order to be displayed
853:
854:
855: returns 'ok' if no processing error.
1.25 raeburn 856:
1.32 jms 857: =cut
1.25 raeburn 858:
859: sub username_rules {
860: my ($dom,$ruleshash,$rulesorder) = @_;
861: my $outcome;
862: return $outcome;
863: }
864:
1.32 jms 865: =pod
866:
867: =item id_rules()
868:
869: Incoming data: three arguments
870: (a) $dom - domain
871: (b) $ruleshash - reference to hash containing rules
872: (a hash of a hash)
873: keys of top level hash are short names
874: (e.g., netid, noncredit)
875: for each key, value is a hash
876: desc => long name for rule
877: rule => description of rule
878:
879: (c) $rulesorder - reference to array containing rule names
880: in order to be displayed
881:
882: returns 'ok' if no processing error.
883:
884: =cut
1.27 raeburn 885:
1.30 raeburn 886: sub id_rules {
887: my ($dom,$ruleshash,$rulesorder) = @_;
888: my $outcome;
889: return $outcome;
890: }
891:
1.32 jms 892: =pod
893:
894: =item selfcreate_rules()
895:
896: Incoming data: three arguments
897: (a) $dom - domain
898: (b) $ruleshash - reference to hash containing rules
899: (a hash of a hash)
900: keys of top level hash are short names
901: (e.g., netid)
902: for each key, value is a hash
903: desc => long name for rule
904: rule => description of rule
905:
906: (c) $rulesorder - reference to array containing rule names
907: in order to be displayed
908:
909: returns 'ok' if no processing error.
910:
1.27 raeburn 911:
1.32 jms 912: =cut
1.30 raeburn 913:
1.31 raeburn 914: sub selfcreate_rules {
1.27 raeburn 915: my ($dom,$ruleshash,$rulesorder) = @_;
916: my $outcome;
917: return $outcome;
918: }
919:
1.32 jms 920: =pod
921:
922: =item username_check()
923:
924: Incoming data: four arguments
925: (a) $dom - domain (scalar)
926: (b) $uname - username to compare against rules (scalar)
927: (c) $to_check (reference to array of rule names to check)
928: (d) $resultshash (reference to hash of results)
929: hash of results for rule checked
930: - keys are rule names
931: - values are: 1 or 0 (for matched or unmatched)
932:
933: returns 'ok' if no processing error.
934:
935:
936: =cut
1.25 raeburn 937:
938: sub username_check {
939: my ($dom,$uname,$to_check,$resultshash) = @_;
940: my $outcome;
941: return $outcome;
942: }
943:
1.32 jms 944: =pod
945:
946: =item id_check()
947:
948: Incoming data: four arguments
949: (a) $dom - domain (scalar)
950: (b) $id - ID to compare against rules (scalar)
951: (c) $to_check (reference to array of rule names to check)
952: (d) $resultshash (reference to hash of results)
953: hash of results for rule checked
954: - keys are rule names
955: - values are: 1 or 0 (for matched or unmatched)
956:
957: returns 'ok' if no processing error.
958:
959:
960: =cut
1.27 raeburn 961:
962: sub id_check {
963: my ($dom,$id,$to_check,$resultshash) = @_;
964: my $outcome;
965: return $outcome;
966: }
967:
1.32 jms 968: =pod
969:
970: =item selfcreate_check()
971:
972: Incoming data: four arguments
973: (a) $dom - domain (scalar)
974: (b) $selfcreatename - e-mail proposed as username (compare against rules - scalar)
975: (c) $to_check (reference to array of rule names to check)
976: (d) $resultshash (reference to hash of results)
977: hash of results for rule checked
978: - keys are rule names
979: - values are: 1 or 0 (for matched or unmatched)
980:
981: returns 'ok' if no processing error.
982:
983:
984: =cut
1.30 raeburn 985:
1.31 raeburn 986: sub selfcreate_check {
987: my ($dom,$selfcreatename,$to_check,$resultshash) = @_;
1.30 raeburn 988: my $outcome;
989: return $outcome;
990: }
991:
1.32 jms 992: =pod
993:
994: =item AUTOLOAD()
995:
996: Incoming data: none
997: Returns ''
998:
999: Prevents errors when undefined subroutines are called in this package
1000: Will allow new routines added in the future to be called from lond etc.
1001: without the need for customized versions of local*.pm packages to be
1002: modified to include the new subroutines immediately.
1003:
1004: See "Programming Perl" 3rd ed. pp 296-298.
1005:
1006: =back
1007:
1008: =cut
1.14 raeburn 1009:
1010: sub AUTOLOAD {
1011: our $AUTOLOAD;
1012: return '';
1013: }
1014:
1.1 raeburn 1015: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>