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