--- loncom/html/adm/help/tex/Institutional_Integration_Identity_Management.tex 2008/07/29 18:14:24 1.3 +++ loncom/html/adm/help/tex/Institutional_Integration_Identity_Management.tex 2008/07/29 21:07:29 1.4 @@ -179,27 +179,27 @@ database queries are implemented at MSU. \texttt{if (\$srchby eq 'uname') \{} \begin{quotation} -\texttt{if (\$srchterm =\~{} /^\textbackslash{}w\{2,8\}\$/) +\texttt{if (\$srchterm =\~{} /\^{}\textbackslash{}w\{2,8\}\$/) \{} \begin{quotation} \texttt{if (\$srchtype eq 'contains') \{} -\begin{quotation} -\texttt{\$condition = \char`\"{}WHERE MSUNetID LIKE '\%\$srchterm\%'\char`\"{};} -\texttt{\$ldapfilter = '(uid={*}'.\$srchterm.'{*})';} -\end{quotation} +\texttt{~~\$condition = \char`\"{}WHERE MSUNetID LIKE '\%\$srchterm\%'\char`\"{};} + +\texttt{~~\$ldapfilter = '(uid={*}'.\$srchterm.'{*})';} + \texttt{\} elsif (\$srchtype eq 'begins') \{} -\begin{quotation} -\texttt{\$condition = \char`\"{}WHERE MSUNetID LIKE '\$srchterm\%'\char`\"{};} -\texttt{\$ldapfilter = '(uid='.\$srchterm.'{*})';} -\end{quotation} +\texttt{~~\$condition = \char`\"{}WHERE MSUNetID LIKE '\$srchterm\%'\char`\"{};} + +\texttt{~~\$ldapfilter = '(uid='.\$srchterm.'{*})';} + \texttt{\} else \{} -\begin{quotation} -\texttt{\$condition = \char`\"{}WHERE MSUNetID = '\$srchterm'\char`\"{};} -\texttt{\$ldapfilter = '(uid='.\$srchterm.')';} -\end{quotation} +\texttt{~~\$condition = \char`\"{}WHERE MSUNetID = '\$srchterm'\char`\"{};} + +\texttt{~~\$ldapfilter = '(uid='.\$srchterm.')';} + \texttt{\}} \end{quotation} \texttt{\}} @@ -210,41 +210,41 @@ database queries are implemented at MSU. \{} \begin{quotation} \texttt{if (\$srchtype eq 'contains') \{} -\begin{quotation} -\texttt{if (\$dbflag) \{} -\begin{quotation} -\texttt{my \$quoted\_last = \$dbh->quote('\%'.\$srchterm.'\%');} -\texttt{\$condition = \char`\"{}WHERE LastName LIKE \$quoted\_last\char`\"{};} -\end{quotation} -\texttt{\}} +\texttt{~~if (\$dbflag) \{} + +\texttt{~~~~my \$quoted\_last = \$dbh->quote('\%'.\$srchterm.'\%');} + +\texttt{~~~~\$condition = \char`\"{}WHERE LastName LIKE \$quoted\_last\char`\"{};} + +\texttt{~~\}} + +\texttt{~~\$ldapfilter = '(sn={*}'.\$srchterm.'{*})';} -\texttt{\$ldapfilter = '(sn={*}'.\$srchterm.'{*})';} -\end{quotation} \texttt{\} elsif (\$srchtype eq 'begins') \{} -\begin{quotation} -\texttt{if (\$dbflag) \{} -\begin{quotation} -\texttt{my \$quoted\_last = \$dbh->quote(\$srchterm.'\%');} -\texttt{\$condition = \char`\"{}WHERE LastName LIKE \$quoted\_last\char`\"{};} -\end{quotation} -\texttt{\}} +\texttt{~~if (\$dbflag) \{} + +\texttt{~~~~my \$quoted\_last = \$dbh->quote(\$srchterm.'\%');} + +\texttt{~~~~\$condition = \char`\"{}WHERE LastName LIKE \$quoted\_last\char`\"{};} + +\texttt{~~\}} + +\texttt{~~\$ldapfilter = '(sn='.\$srchterm.'{*})';} -\texttt{\$ldapfilter = '(sn='.\$srchterm.'{*})';} -\end{quotation} \texttt{\} else \{} -\begin{quotation} -\texttt{if (\$dbflag) \{} -\begin{quotation} -\texttt{my \$quoted\_last = \$dbh->quote(\$srchterm);} -\texttt{\$condition = \char`\"{}WHERE LastName = \$quoted\_last\char`\"{};} -\end{quotation} -\texttt{\}} +\texttt{~~if (\$dbflag) \{} + +\texttt{~~~my \$quoted\_last = \$dbh->quote(\$srchterm);} + +\texttt{~~~~\$condition = \char`\"{}WHERE LastName = \$quoted\_last\char`\"{};} + +\texttt{~~\}} + +\texttt{~~\$ldapfilter = '(sn='.\$srchterm.')';} -\texttt{\$ldapfilter = '(sn='.\$srchterm.')';} -\end{quotation} \texttt{\}} \end{quotation} \texttt{\}} @@ -255,7 +255,7 @@ database queries are implemented at MSU. \texttt{\$srchlast =\~{} s/\textbackslash{}s+\$//;} -\texttt{\$srchfirst =\~{} s/^\textbackslash{}s+//;} +\texttt{\$srchfirst =\~{} s/\^{}\textbackslash{}s+//;} \texttt{if ((\$srchlast =\~{} /{[}A-Za-z\textbackslash{}-\textbackslash{}.'\textbackslash{}s]+/) \&\& (\$srchfirst =\~{} /{[}A-Za-z\textbackslash{}-\textbackslash{}.'\textbackslash{}s]+/)) @@ -264,35 +264,56 @@ database queries are implemented at MSU. \texttt{my (\$quoted\_first,\$quoted\_last);} \texttt{if (\$srchtype eq 'contains') \{} -\begin{quotation} -\texttt{if (\$dbflag) \{} -\begin{quotation} -\texttt{\$quoted\_last = \$dbh->quote('\%'.\$srchlast.'\%');} -\texttt{\$quoted\_first = \$dbh->quote('\%'.\$srchfirst.'\%');} +\texttt{~~if (\$dbflag) \{} + +\texttt{~~~~\$quoted\_last = \$dbh->quote('\%'.\$srchlast.'\%');} + +\texttt{~~~~\$quoted\_first = \$dbh->quote('\%'.\$srchfirst.'\%');} -\texttt{\$condition = \char`\"{}WHERE ( LastName LIKE \$quoted\_last +\texttt{~~~~\$condition = \char`\"{}WHERE ( LastName LIKE \$quoted\_last AND FirstName LIKE \$quoted\_first )\char`\"{};} -\end{quotation} -\texttt{\}} -\texttt{\$ldapfilter = '(\&(sn='.\$srchlast.'{*})(givenName='.\$srchfirst.'{*}))';} -\end{quotation} +\texttt{~~\}} + +\texttt{~~\$ldapfilter = '(\&(sn='.\$srchlast.'{*})(givenName='.\$srchfirst.'{*}))';} + \texttt{\} else \{} \begin{quotation} -\texttt{if (\$dbflag) \{} +\texttt{foreach my \$table (@\{\$srchtables\}) \{} \begin{quotation} -\texttt{\$quoted\_last = \$dbh->quote(\$srchterm);} +\texttt{next if (\$srchby \&\& \$condition eq '');} + +\texttt{my \$statement = \char`\"{}SELECT MSUNetID,Pid,FirstName,LastName,Person\_Type +FROM \$table \$condition\char`\"{};} -\texttt{\$quoted\_first = \$dbh->quote(\$srchterm);} +\texttt{my \$sth = \$dbh->prepare(\char`\"{}\$statement\char`\"{});} -\texttt{\$condition = \char`\"{}WHERE ( LastName = \$quoted\_last -AND FirstName = \$quoted\_first )\char`\"{};} -\end{quotation} -\texttt{\}} +\texttt{\$sth->execute();} -\texttt{\$ldapfilter = '(\&(sn='.\$srchlast.')(givenName='.\$srchfirst.'))';} +\texttt{while ( my(\$uname,\$pid,\$first,\$last,\$type) = \$sth->fetchrow\_array +) \{} + +\texttt{~~\$pid=lc(\$pid);} + +\texttt{~~if (ref(\$instusers->\{\$uname\}) eq 'HASH') \{} + +\texttt{~~~~if (ref(\$instusers->\{\$uname\}\{'instst} +\end{quotation} \end{quotation} +\texttt{~~if (\$dbflag) \{} + +\texttt{~~~~\$quoted\_last = \$dbh->quote(\$srchterm);} + +\texttt{~~~~\$quoted\_first = \$dbh->quote(\$srchterm);} + +\texttt{~~~~\$condition = \char`\"{}WHERE ( LastName = \$quoted\_last +AND FirstName = \$quoted\_first )\char`\"{};} + +\texttt{~~\}} + +\texttt{~~\$ldapfilter = '(\&(sn='.\$srchlast.')(givenName='.\$srchfirst.'))';} + \texttt{\}} \end{quotation} \texttt{\}} @@ -300,14 +321,14 @@ AND FirstName = \$quoted\_first )\char`\ \texttt{\} elsif (\$srchby eq 'id') \{} \begin{quotation} \texttt{if (\$dbflag) \{} -\begin{quotation} -\texttt{if (\$srchterm =\~{} /^{[}AZ]\textbackslash{}d\{8\}\$/) + +\texttt{~~if (\$srchterm =\~{} /\^{}{[}AZ]\textbackslash{}d\{8\}\$/) \{} \begin{quotation} -\texttt{\$condition = \char`\"{}WHERE Pid = '\$srchterm'\char`\"{};} -\end{quotation} -\texttt{\}} +\texttt{~~\$condition = \char`\"{}WHERE Pid = '\$srchterm'\char`\"{};} \end{quotation} +\texttt{~~\}} + \texttt{\}} \end{quotation} \texttt{\}} @@ -327,125 +348,125 @@ FROM \$table \$condition\char`\"{};} \texttt{while ( my(\$uname,\$pid,\$first,\$last,\$type) = \$sth->fetchrow\_array ) \{} -\begin{quotation} -\texttt{\$pid=lc(\$pid);} -\texttt{if (ref(\$instusers->\{\$uname\}) eq 'HASH') \{} -\begin{quotation} -\texttt{if (ref(\$instusers->\{\$uname\}\{'inststatus'\}) eq 'ARRAY') +\texttt{~~\$pid=lc(\$pid);} + +\texttt{~~if (ref(\$instusers->\{\$uname\}) eq 'HASH') \{} + +\texttt{~~~~if (ref(\$instusers->\{\$uname\}\{'inststatus'\}) +eq 'ARRAY') \{} + +\texttt{~~~~~~if (!grep(/\^{}\$type\$/,@\{\$instusers->\{\$uname\}\{'inststatus'\}\})) \{} -\begin{quotation} -\texttt{if (!grep(/^\$type\$/,@\{\$instusers->\{\$uname\}\{'inststatus'\}\})) + +\texttt{~~~~~~~~push(@\{\$instusers->\{\$uname\}\{'inststatus'\}\},\$type);} + +\texttt{~~~~~~\}} + +\texttt{~~~~\}} + +\texttt{~~~~if (\$pid ne \$instusers->\{\$uname\}\{'id'\}) \{} + +\texttt{~~~~~~if (\$instusers->\{\$uname\}\{'id'\} =\~{} +/\^{}A\textbackslash{}d\{8\}\$/) \{} + +\texttt{~~~~~~~~if (\$pid =\~{} /\^{}A\textbackslash{}d\{8\}\$/) \{} -\begin{quotation} -\texttt{push(@\{\$instusers->\{\$uname\}\{'inststatus'\}\},\$type);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\}} -\texttt{if (\$pid ne \$instusers->\{\$uname\}\{'id'\}) \{} -\begin{quotation} -\texttt{if (\$instusers->\{\$uname\}\{'id'\} =\~{} /^A\textbackslash{}d\{8\}\$/) +\texttt{~~~~~~~~~~if (ref(\$multipids\{\$uname\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (\$pid =\~{} /^A\textbackslash{}d\{8\}\$/) + +\texttt{~~~~~~~~~~~~if (!grep(/\^{}\$pid\$/,@\{\$multipids\{\$uname\}\})) \{} -\begin{quotation} -\texttt{if (ref(\$multipids\{\$uname\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (!grep(/^\$pid\$/,@\{\$multipids\{\$uname\}\})) + +\texttt{~~~~~~~~~~~~~~push(@\{\$multipids\{\$uname\}\},\$pid);} + +\texttt{~~~~~~~~~~~~\}} + +\texttt{~~~~~~~~~~\} else \{} + +\texttt{~~~~~~~~~~~~@\{\$multipids\{\$uname\}\} = (\$instusers->\{\$uname\}\{'id'\},\$pid);} + +\texttt{~~~~~~~~~~\}} + +\texttt{~~~~~~~~~~\$instusers->\{\$uname\}\{'id'\} = \$pid;} + +\texttt{~~~~~~~~\}} + +\texttt{~~~~~~\} elsif (\$instusers->\{\$uname\}\{'id'\} =\~{} +/\^{}Z\textbackslash{}d\{8\}\$/) \{} + +\texttt{~~~~~~~~if (\$pid =\~{} /\^{}Z\textbackslash{}d\{8\}\$/) \{} -\begin{quotation} -\texttt{push(@\{\$multipids\{\$uname\}\},\$pid);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} else \{} -\begin{quotation} -\texttt{@\{\$multipids\{\$uname\}\} = (\$instusers->\{\$uname\}\{'id'\},\$pid);} -\end{quotation} -\texttt{\}} -\texttt{\$instusers->\{\$uname\}\{'id'\} = \$pid;} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} elsif (\$instusers->\{\$uname\}\{'id'\} =\~{} -/^Z\textbackslash{}d\{8\}\$/) \{} -\begin{quotation} -\texttt{if (\$pid =\~{} /^Z\textbackslash{}d\{8\}\$/) +\texttt{~~~~~~~~~~if (ref(\$multipids\{\$uname\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (ref(\$multipids\{\$uname\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (!grep(/^\$pid\$/,@\{\$multipids\{\$uname\}\})) + +\texttt{~~~~~~~~~~~~if (!grep(/\^{}\$pid\$/,@\{\$multipids\{\$uname\}\})) \{} -\begin{quotation} -\texttt{push(@\{\$multipids\{\$uname\}\},\$pid);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} else \{} -\begin{quotation} -\texttt{@\{\$multipids\{\$uname\}\} = (\$instusers->\{\$uname\}\{'id'\},\$pid);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} elsif (\$pid =\~{} /^A\textbackslash{}d\{8\}\$/) + +\texttt{~~~~~~~~~~~~~~push(@\{\$multipids\{\$uname\}\},\$pid);} + +\texttt{~~~~~~~~~~~~\}} + +\texttt{~~~~~~~~~~\} else \{} + +\texttt{~~~~~~~~~~~~@\{\$multipids\{\$uname\}\} = (\$instusers->\{\$uname\}\{'id'\},\$pid);} + +\texttt{~~~~~~~~~~\}} + +\texttt{~~~~~~~~\} elsif (\$pid =\~{} /\^{}A\textbackslash{}d\{8\}\$/) \{} -\begin{quotation} -\texttt{\$instusers->\{\$uname\}\{'id'\} = \$pid;} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} else \{} -\begin{quotation} -\texttt{\$instusers->\{\$uname\} = \{} -\begin{quotation} -\texttt{firstname => \$first,} -\texttt{lastname => \$last,} +\texttt{~~~~~~~~~~\$instusers->\{\$uname\}\{'id'\} = \$pid;} -\texttt{id => \$pid,} +\texttt{~~~~~~~~\}} -\texttt{permanentemail => \$uname.'@msu.edu', } +\texttt{~~~~~~\}} -\texttt{inststatus => {[}\$type],} -\end{quotation} -\texttt{\};} -\end{quotation} -\texttt{\}} +\texttt{~~~~\}} -\texttt{if (defined(\$instids->\{\$pid\})) \{} -\begin{quotation} -\texttt{if (ref(\$instids->\{\$pid\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (!grep(/^\$uname\$/,@\{\$instids->\{\$pid\}\})) +\texttt{~~\} else \{} + +\texttt{~~~~\$instusers->\{\$uname\} = \{} + +\texttt{~~~~~~firstname => \$first,} + +\texttt{~~~~~~lastname => \$last,} + +\texttt{~~~~~~id => \$pid,} + +\texttt{~~~~~~permanentemail => \$uname.'@msu.edu', } + +\texttt{~~~~~~inststatus => {[}\$type],} + +\texttt{~~~~\};} + +\texttt{~~\}} + +\texttt{~~if (defined(\$instids->\{\$pid\})) \{} + +\texttt{~~~~if (ref(\$instids->\{\$pid\}) eq 'ARRAY') \{} + +\texttt{~~~~~~if (!grep(/\^{}\$uname\$/,@\{\$instids->\{\$pid\}\})) \{} -\begin{quotation} -\texttt{push(@\{\$instids->\{\$pid\}\},\$uname);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\} elsif (\$instids->\{\$pid\} ne \$uname) \{} -\begin{quotation} -\texttt{@\{\$instids->\{\$pid\}\} = (\$instids->\{\$pid\},\$uname);} -\end{quotation} -\texttt{\}} -\end{quotation} -\end{quotation} -\end{quotation} -\texttt{\} else \{} -\begin{quotation} -\texttt{\$instids->\{\$pid\} = \$uname;} -\begin{quotation} -\texttt{\}} -\end{quotation} + +\texttt{~~~~~~~~push(@\{\$instids->\{\$pid\}\},\$uname);} + +\texttt{~~~~~~\}} + +\texttt{~~~~\} elsif (\$instids->\{\$pid\} ne \$uname) \{} + +\texttt{~~~~~~@\{\$instids->\{\$pid\}\} = (\$instids->\{\$pid\},\$uname);} + +\texttt{~~~~\}} + +\texttt{~~\} else \{} + +\texttt{~~~~\$instids->\{\$pid\} = \$uname;} + +\texttt{~~\}} + \texttt{\}} \texttt{\$outcome = 'ok';} @@ -539,55 +560,52 @@ database tables. \texttt{\}} \texttt{if (ref(\$types) eq 'ARRAY') \{} + +\texttt{~~if (@\{\$types\} > 0) \{} \begin{quotation} -\texttt{if (@\{\$types\} > 0) \{} -\begin{quotation} -\texttt{if ((\$type ne '') \&\& !(grep(/^\$type\$/,@\{\$types\}))) -\{} -\begin{quotation} -\texttt{next if (!grep(/^default\$/,@\{\$types\}));} -\end{quotation} -\texttt{\}} +\texttt{~~if ((\$type ne '') \&\& !(grep(/\^{}\$type\$/,@\{\$types\}))) } + +\texttt{~~~~next if (!grep(/\^{}default\$/,@\{\$types\}));} + +\texttt{~~\}} + +\texttt{~~next if ((\$type eq '') \&\& (!grep(/\^{}default\$/,@\{\$types\})));} -\texttt{next if ((\$type eq '') \&\& (!grep(/^default\$/,@\{\$types\})));} -\end{quotation} \texttt{\}} \end{quotation} \texttt{\}} \texttt{if (ref(\$instusers->\{\$uname\}) eq 'HASH') \{} -\begin{quotation} -\texttt{if (ref(\$instusers->\{\$uname\}\{'inststatus'\}) eq 'ARRAY') + +\texttt{~~if (ref(\$instusers->\{\$uname\}\{'inststatus'\}) eq 'ARRAY') \{} -\begin{quotation} -\texttt{if (!grep(/^\$type\$/,@\{\$instusers->\{\$uname\}\{'inststatus'\}\})) + +\texttt{~~~~if (!grep(/\^{}\$type\$/,@\{\$instusers->\{\$uname\}\{'inststatus'\}\})) \{} -\begin{quotation} -\texttt{push(@\{\$instusers->\{\$uname\}\{'inststatus'\}\},\$type);} -\end{quotation} -\texttt{\}} -\end{quotation} -\texttt{\}} -\end{quotation} + +\texttt{~~~~~~push(@\{\$instusers->\{\$uname\}\{'inststatus'\}\},\$type);} + +\texttt{~~~~\}} + +\texttt{~~\}} + \texttt{\} else \{} -\begin{quotation} -\texttt{\$instusers->\{\$uname\} = \{} -\begin{quotation} -\texttt{firstname => \$first,} -\texttt{lastname => \$last,} +\texttt{~~\$instusers->\{\$uname\} = \{} -\texttt{id => '',} +\texttt{~~firstname => \$first,} -\texttt{permanentemail => \$email,} +\texttt{~~lastname => \$last,} + +\texttt{~~id => '',} + +\texttt{~~permanentemail => \$email,} + +\texttt{~~inststatus => {[}\$type],} -\texttt{inststatus => {[}\$type],} -\end{quotation} \texttt{\};} \end{quotation} \texttt{\}} -\end{quotation} -\texttt{\}} \texttt{\$ldap->unbind;} \end{quotation}