Subversion Repositories wimsdev

Rev

Rev 10372 | Rev 10561 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2691 czzmrn 1
 
2
# This line prevents clashes of users with same login.
3
adduser_replace=nopass
4
wims_priv_cryptpass=allow
5
wims_deposit=!word 1 of $wims_deposit
6
!if $wims_deposit=$empty
7
 !exit
8
!endif
9
 
10
!if / isin $wims_deposit or .. isin $wims_deposit
11
 error=bad_filename
12
 !exit
13
!endif
14
 
15
d=!translate . to $ $ in $wims_deposit
16
d=!word -1 of $d
17
!if $d notwordof csv tsv txt
18
 error=bad_filename
19
 !exit
20
!endif
21
 
22
sdir=$wims_home/$wims_sesdir
23
t=!exec ftype $sdir/user-deposit
24
!if $t=$empty
25
 !exit
26
!endif
27
!if $t=binary
28
 error=binary_upload
29
 !exit
30
!endif
31
 
32
!sh grep . $sdir/user-deposit | awk '{print ":"$$0}' | tr '	"' ', ' >$sdir/user_deposit
33
file=wimshome/$wims_sesdir/user_deposit
34
 
5151 bpr 35
!read csv/gotlogin $file,login
36
 
37
!if $gotlogin=$empty
38
 !read adm/class/initclass $wims_class,auth
39
 !if $auth_method notitemof $auth_method_list
40
  error=no_login
41
  !exit
42
 !else
43
   !read csv/gotlogin $file,external_auth
44
   !if $(gotexternal_auth)=$empty
45
     error=no_login_external_auth
46
     !exit
3714 bpr 47
   !else
5151 bpr 48
    extern=yes
3714 bpr 49
   !endif
2691 czzmrn 50
 !endif
51
!endif
52
 
53
remark=
54
!if sheet isin $types or exam isin $types or average isin $types
55
 remark=$remark noauto
56
!endif
57
 
58
prop=no
59
!if noauto iswordof $remark or manual isin $types
60
 remark=$remark noprop
61
!else
5151 bpr 62
!! pourquoi cette condition ???
2691 czzmrn 63
 !if firstname isitemof $types and lastname isitemof $types
64
  prop=yes
8057 bpr 65
 !endif
5151 bpr 66
 !read adm/class/userremain.proc
2691 czzmrn 67
!endif
68
 
69
!if manual isin $types
70
 manual=yes
71
!endif
72
 
73
replacelist=$types
74
types=!replace , by ,up_ in up_$types
75
types_cnt=!itemcnt $types
76
gotcnt=!itemcnt $loglist
77
propcnt=0
78
gradecnt=0
3714 bpr 79
!reset missing erased bad added change badlogin
2691 czzmrn 80
processed=yes
5151 bpr 81
!! on parcourt la liste des lignes des bons logins
82
!for i = 1 to $gotcnt
83
  l=$(loglist[$i])
84
  l__=$(logtest[$i])
10372 bpr 85
  !reset up_firstname,up_lastname,up_email,up_password,up_comments,up_regnum,up_photourl,\
86
    up_vars,up_participate,up_external_auth,up_supervise,up_supervisable
5151 bpr 87
  !! fill in the fields ...
2691 czzmrn 88
  !distribute items $(dep_$l__) into $types
89
  !for m = 1 to $types_cnt
90
    typ=$(types[$m])
91
    !if Aup_var_ isin A$typ
92
      typ1=!replace internal up_var_ by  in $typ
93
      up_vars=!append line $typ1=$($typ) to $up_vars
94
    !endif
10020 guerimand 95
  !next m
2691 czzmrn 96
  up_vars=!lines2rows $up_vars
5151 bpr 97
  !if $extern=yes
5775 bpr 98
    up_external_auth=!lowercase $l
5659 bpr 99
    l=!lookup $l in wimshome/$sclassdir/.userlist_external
5151 bpr 100
    !if $l=$empty
8057 bpr 101
      l=!lookup $l in wimshome/$sclassdir/.teacherlist_external
5151 bpr 102
    !endif
103
    !if $l=$empty
104
       !if $idp_method=ldap
105
!!define login_method
8057 bpr 106
        !read adm/class/initldap
5151 bpr 107
       !endif
108
      !read adm/class/hashlogin $up_external_auth,$wims_class,$login_method
109
      l=$login
110
      !default up_password=!randint 1999999,3000000
111
    !endif
112
  !endif extern=yes
113
 
114
!! $l is now the login in all cases
2691 czzmrn 115
  exist=!defof user_exists in wimshome/$userdir/$l
116
  existsup=$exist
5151 bpr 117
  !if $existsup=yes
5660 bpr 118
     lfname=!defof user_lastname,user_firstname,user_external_auth in wimshome/$userdir/$l
5151 bpr 119
     !default up_firstname=$(lfname[2])
120
     !default up_lastname=$(lfname[1])
5660 bpr 121
     !default up_external_auth=$(lfname[3])
5151 bpr 122
     !if $up_firstname!=$empty and $up_lastname!=$empty
123
       prop=yes
124
     !endif
125
  !else
126
!!FIXME
127
    !if $idp_method isitemof $idp_method_list and ($up_firstname=$empty or $up_lastname=$empty)
128
!! I am not sure of what we must do : priority to the idp or to the modification of the teacher ??
5660 bpr 129
      !distribute item $up_firstname, $up_lastname into up_firstname_ , $up_lastname_
5151 bpr 130
      !read adm/class/idp_$idp_method $up_external_auth
5660 bpr 131
      !if $up_lastname_!=$empty
5151 bpr 132
        up_lastname=$up_lastname_
133
      !endif
134
      !if $up_firstname_!=$empty
135
        up_firstname=$up_firstname_
136
      !endif
137
      !if $up_firstname!=$empty and $up_lastname!=$empty
138
       prop=yes
139
      !endif
140
    !endif
8057 bpr 141
  !endif
2691 czzmrn 142
  !if $wims_superclass!=$empty and $wims_superclass!=$wims_class
143
   participate=!defof user_participate in wimshome/$userdir/$l
144
   !if $wims_class notitemof $participate
145
    exist=
146
   !endif
147
  !endif
148
  !if $exist=yes
5151 bpr 149
    !if $prop=yes
150
     !read adm/class/adduser $l
151
    !endif
2691 czzmrn 152
  !else
153
   exist2=!defof user_exists in wimshome/$userdir/.$l
154
   !if $exist2=yes
3439 bpr 155
    erased=!append item $l to $erased
2691 czzmrn 156
   !else
157
    missing=!append item $l to $missing
5151 bpr 158
    !! ici aussi on a besoin d'avoir le nom et prenom
159
    !if $existsup=yes or ($up_firstname!=$empty and $up_lastname!=$empty and $up_password!=$empty)
2691 czzmrn 160
     !if $prop=yes
161
      !if $userremain>0
162
       !read adm/class/adduser $l
163
       !if $l notitemof $bad
164
        added=!append item $l to $added
5151 bpr 165
	    userremain=$[$userremain-1]
166
       !endif  l notitemof bad
2691 czzmrn 167
      !else
168
       remark=$remark full
5151 bpr 169
      !endif userremain
170
     !endif prop=yes
171
    !endif firstname ... non empty
172
   !endif exist2=yes
173
  !endif exist=yes
2691 czzmrn 174
!next l
175
 
176
!if $change!=$empty
177
 !read adm/class/mkuserlist
178
 !if $classtype isin 24
179
  !read adm/gateway/mkteacherlist
180
 !endif
10132 bpr 181
 !read adm/class/stat
4599 bpr 182
 wims_class_log=spreadsheet userinfo by $wims_realuser
2691 czzmrn 183
!endif
184
 
185
missing=!listcomplement $added in $missing
186
change=!listcomplement $added in $change
4445 bpr 187
added=!listcomplement $missing in $added
2691 czzmrn 188
 
189
!if $manual=yes
190
 fn=wimshome/log/classes/$wims_class/.grades
191
 fu=wimshome/log/classes/$wims_class/.userlist
192
 l=!record 1 of $fn
193
 t=!line 2 of $l
194
 n=!itemcnt $t
195
 n=$[$n-2]
196
 !if $n<1
197
  error=no_manual
198
  !exit
199
 !endif
200
 otypes=nn
201
 !for i=1 to $n
202
  otypes=$otypes,o_$i
203
 !next i
204
 first=$l
205
 cnt=!recordcnt $fn
206
 !for u=2 to $cnt
207
  l=!record $u of $fn
208
  uu=!item 1 of $l
209
  orig_$uu=!item 2 to -1 of $l
210
 !next u
211
 !writefile $fn :$first
212
 cnt=!recordcnt $fu
213
 !for i=1 to $cnt
214
  l_=!record $i of $fu
215
  u=!item 3 of $l_
216
  !distribute items $(dep_$u) into $types
217
  !distribute items $(orig_$u) into $otypes
218
  t_=!defof user_firstname user_lastname in wimshome/$userdir/$u
219
  !for i=1 to $n
220
   l_=$[$(up_manual$i)]
221
   !if NaN isin $l_ or Inf isin $l_ or $l_<0 or $l_>100000 or $(up_manual$i)=$empty
222
    l_=
223
   !endif
224
   !default l_=$(o_$i)
225
   t_=!append item $l_ to $t_
226
  !next i
227
  !appendfile $fn :$u,$t_
228
 !next u
4598 bpr 229
 wims_class_log=spreadsheet grades by $wims_realuser
2691 czzmrn 230
!endif
231