Subversion Repositories wimsdev

Rev

Rev 10377 | Rev 10708 | 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
10561 bpr 171
     !else
172
      !if $up_password=$empty
173
        pass_missing=yes
174
      !endif
5151 bpr 175
    !endif firstname ... non empty
176
   !endif exist2=yes
177
  !endif exist=yes
2691 czzmrn 178
!next l
179
!if $change!=$empty
180
 !read adm/class/mkuserlist
181
 !if $classtype isin 24
182
  !read adm/gateway/mkteacherlist
183
 !endif
10132 bpr 184
 !read adm/class/stat
4599 bpr 185
 wims_class_log=spreadsheet userinfo by $wims_realuser
2691 czzmrn 186
!endif
187
missing=!listcomplement $added in $missing
188
change=!listcomplement $added in $change
4445 bpr 189
added=!listcomplement $missing in $added
2691 czzmrn 190
 
191
!if $manual=yes
192
 fn=wimshome/log/classes/$wims_class/.grades
193
 fu=wimshome/log/classes/$wims_class/.userlist
194
 l=!record 1 of $fn
195
 t=!line 2 of $l
196
 n=!itemcnt $t
197
 n=$[$n-2]
198
 !if $n<1
199
  error=no_manual
200
  !exit
201
 !endif
202
 otypes=nn
203
 !for i=1 to $n
204
  otypes=$otypes,o_$i
205
 !next i
206
 first=$l
207
 cnt=!recordcnt $fn
208
 !for u=2 to $cnt
209
  l=!record $u of $fn
210
  uu=!item 1 of $l
211
  orig_$uu=!item 2 to -1 of $l
212
 !next u
213
 !writefile $fn :$first
214
 cnt=!recordcnt $fu
215
 !for i=1 to $cnt
216
  l_=!record $i of $fu
217
  u=!item 3 of $l_
218
  !distribute items $(dep_$u) into $types
219
  !distribute items $(orig_$u) into $otypes
220
  t_=!defof user_firstname user_lastname in wimshome/$userdir/$u
221
  !for i=1 to $n
222
   l_=$[$(up_manual$i)]
223
   !if NaN isin $l_ or Inf isin $l_ or $l_<0 or $l_>100000 or $(up_manual$i)=$empty
224
    l_=
225
   !endif
226
   !default l_=$(o_$i)
227
   t_=!append item $l_ to $t_
228
  !next i
229
  !appendfile $fn :$u,$t_
230
 !next u
4598 bpr 231
 wims_class_log=spreadsheet grades by $wims_realuser
2691 czzmrn 232
!endif
233