Rev 11431 | Rev 13323 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5060 | bpr | 1 | ## INPUT; identifier, class, method (for the moment only ldap) |
5015 | bpr | 2 | ## OUTPUT : wims compatible unique identifier, compatible with class |
5060 | bpr | 3 | ##FIXME php ? |
4 | |||
5 | !read adm/class/authchars |
||
5002 | bpr | 6 | !set limit=2 |
7 | !set limit_while=$[10^$limit] |
||
5060 | bpr | 8 | |
9 | !distribute items $wims_read_parm into login,cl,meth |
||
5002 | bpr | 10 | !set login=!lower $login |
5055 | bpr | 11 | !if $login=$empty |
12555 | bpr | 12 | error=login_empty |
13 | !exit |
||
5055 | bpr | 14 | !endif |
5031 | bpr | 15 | !set login_ext=$login |
5060 | bpr | 16 | !if $meth!=$empty |
17 | !set meth_=!word 1 of $meth |
||
18 | !bound meth_ within ldap default $empty |
||
19 | !set ldap_id=!word 2 of $meth |
||
20 | !if $ldap_id!=$empty and $meth_ !=$empty |
||
21 | !goto ldap |
||
22 | !exit |
||
23 | !endif |
||
24 | !endif |
||
25 | |||
5002 | bpr | 26 | !set login=!text select $char_alnum in $login |
27 | !set login=!char 1 to $[$login_max -$limit] of $login |
||
5028 | bpr | 28 | !!set cl=!replace internal / by , in $cl |
29 | !set cl=$(cl[1]) |
||
30 | !if $cl=$empty |
||
31 | !reset login |
||
32 | !exit |
||
33 | !endif |
||
5060 | bpr | 34 | cnt=0 |
35 | u_exists=yes |
||
36 | login_init=$login |
||
37 | !while $u_exists=yes and $cnt<$limit_while |
||
12555 | bpr | 38 | !if $cnt>0 |
39 | login=$login_init$cnt |
||
40 | !endif |
||
41 | !set tt1=!lookup $login_ext in wimshome/log/classes/$cl/.teacherlist_external |
||
42 | !set tt2=!lookup $login_ext in wimshome/log/classes/$cl/.userlist_external |
||
43 | !if $tt1!=$empty or $tt2!=$empty |
||
44 | !! user can be both in .userlist and in .teacherlist (see r5260) |
||
45 | !if $tt1=$tt2 |
||
46 | login=$tt1 |
||
47 | !else |
||
48 | login=$tt1$tt2 |
||
49 | !endif |
||
50 | !exit |
||
51 | !endif |
||
52 | !read adm/class/userisinclass $cl,$login |
||
53 | !set u_exists=$script_reply |
||
54 | !increase cnt |
||
5060 | bpr | 55 | !endwhile |
56 | !if $cnt>=$limit_while |
||
12555 | bpr | 57 | !reset login |
5060 | bpr | 58 | !endif |
5121 | bpr | 59 | !if $login=$empty |
5242 | bpr | 60 | error=login_missing |
61 | missing=!append item $login_ext to $missing |
||
5121 | bpr | 62 | !endif |
5060 | bpr | 63 | !exit |
64 | :ldap |
||
65 | |||
5072 | bpr | 66 | !if $ldap_uid!=$ldap_login and $ldap_login notsametext $empty |
12555 | bpr | 67 | !set login=!sh ldapsearch -x -LLL -t -H ldap://$ldap_auth:$ldap_port -b "$ldap_base" $ldap_uid="$login" $ldap_login | grep -v "^[d]n:" |
68 | !set login=!replace internal : by = in $login |
||
69 | !set login=!getopt $ldap_login in $login |
||
70 | !set login=!text select $char_alnum in $login |
||
71 | !set login=!char 1 to $[$login_max -$limit] of $login |
||
72 | !set login_char=!charcnt $login |
||
73 | !if $login_char=3 |
||
74 | !set login=$(login)0 |
||
75 | !endif |
||
5060 | bpr | 76 | !endif |
5121 | bpr | 77 | !if $login=$empty |
78 | error=login_empty |
||
79 | !exit |
||
7403 | bpr | 80 | !endif |