Subversion Repositories wimsdev

Rev

Rev 13323 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5025 bpr 1
!!!this file must be in the module directory because of the !mexec !!!!
5151 bpr 2
INPUT external_login
5025 bpr 3
OUTPUT : the up_xxx needed for the register of the user
4
!readproc adm/class/initldap
5126 bpr 5
!set l_=$wims_read_parm
6
!default l_=$auth_user
5025 bpr 7
!set sup_=!item 2 to -1 of $l_
9589 bpr 8
!set l_=!item 1 of $l_
17846 bpr 9
!if xxxldap: notin xxx$ldap_auth and xxxldaps: notin xxx$ldap_auth
10
  ldap_auth=ldap://$ldap_auth
11
!endif
13323 georgesk 12
!! quite anonymous search, since $ldap_oneuser is unpriviledged
17846 bpr 13
ldap_user=!sh ldapsearch -x -LLL -t -H $ldap_auth:$ldap_port -b "$ldap_base" $ldap_accreditation $ldap_uid="$l_" $ldap_code_ | grep -v "^[d]n:"
9589 bpr 14
ldap_user=!replace internal http: by httpxx in $ldap_user
15
ldap_user=!replace internal : by = in $ldap_user
16
ldap_user=!replace internal httpxx by http: in $ldap_user
5641 bpr 17
!!    f=!replace internal .. by $adonis in $f
5025 bpr 18
 !!gestion des accents (avec l'option -h ou -t ? de ldapsearch)
9589 bpr 19
ldap_user=!replace internal < file=///../tmp/sessions/$wims_session/ by file_save, in $ldap_user
5025 bpr 20
### field can be on several lines (photo for example)
9589 bpr 21
ldap_user=!replace internal $\
5025 bpr 22
$ $ by in $ldap_user
9589 bpr 23
ldap_user=!replace internal $ $ by _ in $ldap_user
5025 bpr 24
 
25
### datauser ne sert pas ici mais dans la creation d'un fichier csv. Je laisse pour l'instant
26
!reset data_user
27
 
28
!for field in $ldap_code
29
  !reset f
30
  f=!getopt $field in $ldap_user
31
  !if $(f[1])=file_save
5150 bpr 32
    f=!sh cat $wims_home/tmp/sessions/$wims_session/$(f[2]) | perl -e 'use Encode;while (<>) {print encode("iso-8859-1",decode("utf-8",$$_))}'
5025 bpr 33
  !endif
5642 bpr 34
  f=!replace internal _ by $ $ in $f
5025 bpr 35
  !if $field=$l_login
5096 bpr 36
    login=!nospace $f
5025 bpr 37
    char=!charcnt $f
38
    !if $char=3
39
      f=!nospace $f 0
40
      login=$f
41
    !endif
42
  !endif login
43
  !if $field=password
12555 bpr 44
    f=!randint 100000,400000
5025 bpr 45
  !endif password
46
  data_user=!append item $f to $data_user
9589 bpr 47
  !if $f !=$empty
12555 bpr 48
    nfield=!positionof item $field in $ldap_code
49
    wfield=$(wims_code[$nfield])
50
    up_$wfield=$f
51
    replacelist=!append item $wfield to $replacelist
52
  !endif
53
!next