File:
[LON-CAPA] /
loncom /
html /
adm /
help /
tex /
Institutional_Integration_Format_Checks.tex
Revision
1.4:
download - view:
text,
annotated -
select for diffs
Mon Mar 9 01:58:57 2009 UTC (15 years, 5 months ago) by
weissno
Branches:
MAIN
CVS tags:
version_2_9_X,
version_2_9_99_0,
version_2_9_1,
version_2_9_0,
version_2_8_99_1,
version_2_8_99_0,
version_2_10_0_RC2,
version_2_10_0_RC1,
bz6209-base,
bz6209,
bz5969,
bz2851,
PRINT_INCOMPLETE_base,
PRINT_INCOMPLETE,
HEAD,
GCI_3,
GCI_2,
BZ5971-printing-apage,
BZ5434-fox
consistent wording:
changed "student number" to "student/employee ID"
changed "student ID" to "student/employee ID"
changed "student and eyployee IDs" to "student/employee IDs"
1: \label{Institutional_Integration_Format_Checks}
2: Format restrictions for usernames and student/employeeIDs for an institution,
3: and formats which may \emph{not} be used for e-mail addresses used
4: as usernames when users self-create accounts are defined in three
5: subroutines in localenroll.pm: \emph{username\_rules()}, \emph{id\_rules()},
6: and \emph{selfcreate\_rules()}. The three routines accept a similar
7: set of arguments, and return 'ok' in each case, if no error occurred.
8:
9: \textbf{\large username\_rules} - Incoming data: three arguments
10:
11: \begin{enumerate}
12: \item \$dom - domain
13: \item \$ruleshash - reference to hash containing rules (a hash of a hash)
14:
15:
16: keys of top level hash are short names (e.g., netid, noncredit); for
17: each key, value is a hash.
18:
19: \begin{itemize}
20: \item desc => long name for rule
21: \item rule => description of rule
22: \item authtype => (krb5,krb4,int, or loc) authentication type for rule
23: \item authparm => authentication parameter for rule
24: \item authparmfixed => 1 if authparm used when creating user for rule must
25: be authparm
26: \item authmsg => Message to display describing authentication to use for
27: this rule
28: \end{itemize}
29: \item \$rulesorder - reference to array containing rule names in order to
30: be displayed
31: \end{enumerate}
32: At MSU, a NetID consists of eight characters or less, and will be
33: authenticated by Kerberos (version 5) in the MSU.EDU realm. The rule
34: itself is defined in \emph{username\_rules()}, and the code which
35: checks for compliance is in \emph{username\_check()}:
36:
37: \begin{quotation}
38: \texttt{sub username\_rules \{}
39: \begin{quotation}
40: \texttt{my (\$dom,\$ruleshash,\$rulesorder) = @\_;}
41:
42: \texttt{\%\{\$ruleshash\} = (}
43: \begin{quotation}
44: \texttt{netid => \{}
45: \begin{quotation}
46: \texttt{name => 'MSU NetID',}
47:
48: \texttt{desc => 'Eight characters or less',}
49:
50: \texttt{authtype => 'krb5',}
51:
52: \texttt{authparm => 'MSU.EDU',}
53:
54: \texttt{authparmfixed => '',}
55:
56: \texttt{authmsg => 'A new user with a username which matches
57: a valid MSU NetID will log-in using the MSU Net ID and MSU Net password.',}
58: \end{quotation}
59: \texttt{\}}
60: \end{quotation}
61: \texttt{);}
62:
63: \texttt{@\{\$rulesorder\} = ('netid');}
64:
65: \texttt{return 'ok';}
66: \end{quotation}
67: \texttt{\}}
68: \end{quotation}
69: \textbf{\large id\_rules} - Incoming data: three arguments
70:
71: \begin{enumerate}
72: \item \$dom - domain
73: \item \$ruleshash - reference to hash containing rules (a hash of a hash)keys
74: of top level hash are short names (e.g., studentID, employeeID); for
75: each key, value is a hash
76:
77: \begin{itemize}
78: \item desc => long name for rule
79: \item rule => description of rule
80: \end{itemize}
81: \item \$rulesorder - reference to array containing rule names in order to
82: be displayed
83: \end{enumerate}
84: At MSU, student/employee IDs are eight digits prefaced by A
85: or Z. The rule itself is defined in \emph{id\_rules()}, and the code
86: which checks for compliance is in \emph{id\_check()}:
87:
88: \begin{quotation}
89: \texttt{sub id\_rules \{}
90: \begin{quotation}
91: \texttt{my (\$dom,\$ruleshash,\$rulesorder) = @\_;}
92:
93: \texttt{\%\{\$ruleshash\} = (}
94: \begin{quotation}
95: \texttt{studentID => \{}
96: \begin{quotation}
97: \texttt{name => 'MSU student PID',}
98:
99: \texttt{desc => 'Letter A or a, followed by eight digits',}
100: \end{quotation}
101: \texttt{\},}
102:
103: \texttt{facstaffID => \{}
104: \begin{quotation}
105: \texttt{name => 'MSU faculty/staff ID',}
106:
107: \texttt{desc => 'Letter Z or z, followed by eight digits',}
108: \end{quotation}
109: \texttt{\},}
110: \end{quotation}
111: \texttt{);}
112:
113: \texttt{@\{\$rulesorder\} = ('studentID','facstaffID');}
114:
115: \texttt{return 'ok';}
116: \end{quotation}
117: \texttt{\}}
118: \end{quotation}
119: \textbf{\large selfcreate\_rules} - Incoming data: three arguments
120:
121: \begin{enumerate}
122: \item \$dom - domain
123: \item \$ruleshash - reference to hash containing rules (a hash of a hash)
124:
125:
126: keys of top level hash are short names (e.g., msuemail); for each
127: key, value is a hash
128:
129: \begin{itemize}
130: \item desc => long name for rule
131: \item rule => description of rule
132: \end{itemize}
133: \item \$rulesorder - reference to array containing rule names in order to
134: be displayed
135: \end{enumerate}
136: At MSU all users receive a Net ID (e.g., \emph{sparty}), and a corresponding
137: e-mail account: \emph{sparty@msu.edu}. So, at MSU the rules for e-mail
138: addresses to be used as LON-CAPA usernames prohibit e-mails such as
139: \emph{sparty@msu.edu}. In such cases, the user should log-in with
140: the sparty Net ID/password and request account creation for the username:
141: \emph{sparty}. The rule itself is defined in \emph{selfcreate\_rules()},
142: and the code which checks for compliance is in \emph{selfcreate\_check()}:
143:
144: \begin{quotation}
145: \texttt{sub selfcreate\_rules \{}
146: \begin{quotation}
147: \texttt{my (\$dom,\$ruleshash,\$rulesorder) = @\_;}
148:
149: \texttt{\%\{\$ruleshash\} = (}
150: \begin{quotation}
151: \texttt{msuemail => \{}
152:
153: \texttt{name => 'MSU e-mail address ',}
154:
155: \texttt{desc => 'netid@msu.edu',}
156: \end{quotation}
157: \texttt{\},}
158:
159: \texttt{);}
160:
161: \texttt{@\{\$rulesorder\} = ('msuemail');}
162:
163: \texttt{return 'ok';}
164: \end{quotation}
165: \texttt{\}}
166: \end{quotation}
167: The corresponding routines which check for compliance with rules enabled
168: via Domain Configuration-> User Creation are \emph{username\_check()},
169: \emph{id\_check()}, and \emph{selfcreate\_check()}. The three routines
170: accept a similar set of four arguments, and return 'ok' in each case,
171: if no error occurred.
172:
173: \begin{enumerate}
174: \item \$dom - domain (scalar)
175: \item \$uname (username\_check()), \$id (id\_check()) or \$selfcreatename
176: (selfcreate\_check())
177:
178:
179: - proposed username, id or self-created username being compared against
180: rules (scalar)
181:
182: \item \$to\_check (reference to array of rule names to check)
183: \item \$resultshash (reference to hash of results) hash of results for rule
184: checked
185:
186:
187: keys are rule names - values are: 1 or 0 (for matched or unmatched)
188:
189: \end{enumerate}
190: The routines used for checking rule compliance at MSU are as follows:
191:
192: \textbf{\large username\_check}
193:
194: \begin{quotation}
195: \texttt{sub username\_check \{}
196: \begin{quotation}
197: \texttt{my (\$dom,\$uname,\$to\_check,\$resultshash) = @\_;}
198:
199: \texttt{my \$outcome;}
200:
201: \texttt{if (ref(\$to\_check) eq 'ARRAY') \{}
202: \begin{quotation}
203: \texttt{foreach my \$item (@\{\$to\_check\}) \{}
204: \begin{quotation}
205: \texttt{if (\$item eq 'netid') \{}
206: \begin{quotation}
207: \texttt{if (\$uname =\~{} /\^{}\textbackslash{}w\{2,8\}\$/)
208: \{}
209: \begin{quotation}
210: \texttt{\$resultshash->\{\$item\} = 1;}
211: \end{quotation}
212: \texttt{\} else \{}
213: \begin{quotation}
214: \texttt{\$resultshash->\{\$item\} = 0;}
215: \end{quotation}
216: \texttt{\}}
217: \end{quotation}
218: \end{quotation}
219: \texttt{\}}
220:
221: \texttt{\$outcome = 'ok';}
222: \end{quotation}
223: \texttt{\}}
224:
225: \texttt{return \$outcome;}
226: \end{quotation}
227: \texttt{\}}
228: \end{quotation}
229: \textbf{\large id\_check}
230:
231: \begin{quotation}
232: \texttt{sub id\_check \{}
233: \begin{quotation}
234: \texttt{my (\$dom,\$id,\$to\_check,\$resultshash) = @\_;}
235:
236: \texttt{my \$outcome;}
237:
238: \texttt{if (ref(\$to\_check) eq 'ARRAY') \{}
239: \begin{quotation}
240: \texttt{foreach my \$item (@\{\$to\_check\}) \{}
241: \begin{quotation}
242: \texttt{if (\$item eq 'facstaffID') \{}
243: \begin{quotation}
244: \texttt{if (\$id =\~{} /\^{}z\textbackslash{}d\{8\}\$/i)
245: \{}
246: \begin{quotation}
247: \texttt{\$resultshash->\{\$item\} = 1;}
248: \end{quotation}
249: \texttt{\} else \{}
250: \begin{quotation}
251: \texttt{\$resultshash->\{\$item\} = 0;}
252: \end{quotation}
253: \texttt{\}}
254: \end{quotation}
255: \texttt{\} elsif (\$item eq 'studentID') \{}
256: \begin{quotation}
257: \texttt{if (\$id =\~{} /\^{}a\textbackslash{}d\{8\}\$/i)
258: \{}
259: \begin{quotation}
260: \texttt{\$resultshash->\{\$item\} = 1;}
261: \end{quotation}
262: \texttt{\} else \{}
263: \begin{quotation}
264: \texttt{\$resultshash->\{\$item\} = 0;}
265: \end{quotation}
266: \texttt{\}}
267: \end{quotation}
268: \texttt{\}}
269: \end{quotation}
270: \texttt{\}}
271:
272: \texttt{\$outcome = 'ok';}
273: \end{quotation}
274: \texttt{\}}
275:
276: \texttt{return \$outcome;}
277: \end{quotation}
278: \texttt{\}}
279: \end{quotation}
280: \textbf{\large selfcreate\_check}
281:
282: \begin{quotation}
283: \texttt{sub selfcreate\_check \{}
284: \begin{quotation}
285: \texttt{my (\$dom,\$selfcreatename,\$to\_check,\$resultshash) = @\_;}
286:
287: \texttt{my \$outcome;}
288:
289: \texttt{if (ref(\$to\_check) eq 'ARRAY') \{}
290: \begin{quotation}
291: \texttt{foreach my \$item (@\{\$to\_check\}) \{}
292: \begin{quotation}
293: \texttt{if (\$item eq 'msuemail') \{}
294: \begin{quotation}
295: \texttt{if (\$selfcreatename =\~{} /\^{}\textbackslash{}w\{2,8\}\textbackslash{}@msu\textbackslash{}.edu\$/)
296: \{}
297: \begin{quotation}
298: \texttt{\$resultshash->\{\$item\} = 1;}
299: \end{quotation}
300: \texttt{\} else \{}
301: \begin{quotation}
302: \texttt{\$resultshash->\{\$item\} = 0;}
303: \end{quotation}
304: \texttt{\}}
305: \end{quotation}
306: \texttt{\}}
307: \end{quotation}
308: \texttt{\}}
309:
310: \texttt{\$outcome = 'ok';}
311: \end{quotation}
312: \texttt{\}}
313:
314: \texttt{return \$outcome;}
315: \end{quotation}
316: \texttt{\}}
317: \end{quotation}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>