Subversion Repositories wimsdev

Rev

Rev 11563 | Rev 13361 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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