Rev 13211 | Rev 13256 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
13012 | bpr | 1 | !set wims_ariane_self=no |
2 | |||
2368 | bpr | 3 | !read adm/class/classlang names.phtml |
23 | reyssat | 4 | wims_form_method=post |
5 | wims_prefix=class user tmp n sharing sharable |
||
6 | wims_helper=chapter=3 |
||
5002 | bpr | 7 | !default class=$wims_class |
13254 | guerimand | 8 | !if $class=$empty |
9 | error=noclass |
||
10 | !exit |
||
11 | !endif |
||
13012 | bpr | 12 | !set wims_ariane=!append line "$(module_title_$lang)",8,\ |
13 | to $wims_ariane |
||
10366 | bpr | 14 | ## output auth_method_list, idp_method_list, auth_method, idp_method |
5110 | bpr | 15 | !read adm/class/initclass $class,auth |
9475 | bpr | 16 | !set regvars_cnt=!itemcnt $regvars_class |
5111 | bpr | 17 | !!! test pour une nouvelle inscription dans une classe d'un groupement |
5135 | bpr | 18 | !if $auth_method isitemof $auth_method_list and $user_auth=$empty and $wims_user!=supervisor |
5111 | bpr | 19 | !if $wims_external_auth!=$empty |
13064 | bpr | 20 | m_test=!lookup $wims_external_auth in wimshome/log/classes/$wims_superclass/.userlist_external |
21 | !if $m_test=$wims_user |
||
22 | user_auth=$wims_external_auth |
||
23 | !else |
||
24 | m_test=!defof user_supervisable in wimshome/log/classes/$wims_superclass/.users/$wims_realuser |
||
25 | !if $m_test=yes |
||
5111 | bpr | 26 | m_test=!lookup $wims_external_auth in wimshome/log/classes/$wims_superclass/.teacherlist_external |
27 | !if $m_test=$wims_realuser |
||
28 | user_auth=$wims_external_auth |
||
5117 | bpr | 29 | !endif |
13064 | bpr | 30 | !endif |
31 | !endif |
||
5111 | bpr | 32 | !endif |
33 | !endif |
||
5294 | bpr | 34 | |
5122 | bpr | 35 | !! inscription by the supervisor |
36 | !if $auth_method isitemof $auth_method_list and $wims_user=supervisor |
||
12955 | bpr | 37 | !reset login_bak |
5122 | bpr | 38 | !endif |
5111 | bpr | 39 | |
5004 | bpr | 40 | ##################################### |
41 | ## need to set user_external_auth |
||
42 | ##################################### |
||
5002 | bpr | 43 | |
5013 | bpr | 44 | !if $auth_method isitemof $auth_method_list |
12955 | bpr | 45 | !! in case of auth_method=cas, is it right that we have $user_auth=$empty here ?? |
46 | !! |
||
47 | !! !! I think these lines were wrong: not needed and breaking reguser |
||
48 | !! !! by supervisor |
||
49 | !! !if $idp_method=php |
||
50 | !! !default user_auth=$wims_user |
||
51 | !! !endif |
||
5004 | bpr | 52 | !set auth_user=$user_auth |
5028 | bpr | 53 | !if $type=authsupervisor |
12955 | bpr | 54 | !!! FIXME ???? is it useful |
5028 | bpr | 55 | !set auth_user=$user_auth |
56 | !set wims_user=supervisor |
||
57 | !endif |
||
12955 | bpr | 58 | ## define wims login |
5064 | bpr | 59 | !reset login_method |
8030 | bpr | 60 | !if $idp_method=ldap |
12955 | bpr | 61 | !!define login_method |
8030 | bpr | 62 | !read adm/class/initldap |
5064 | bpr | 63 | !endif |
5135 | bpr | 64 | !if $wims_user=supervisor and $auth_method isitemof $auth_method_list and $auth_user=$empty |
5100 | bpr | 65 | !if $search!=$empty |
66 | !goto begin |
||
67 | !endif |
||
5097 | bpr | 68 | !exit |
69 | !endif |
||
5064 | bpr | 70 | !read adm/class/hashlogin $auth_user,$class,$login_method |
5121 | bpr | 71 | !if $error!=$empty |
72 | !exit |
||
73 | !endif |
||
5004 | bpr | 74 | !default pass=!randint 10000,100000 |
75 | !default pass2=$pass |
||
76 | !default login_bak=$login,$pass |
||
5097 | bpr | 77 | !if $wims_user=supervisor |
78 | passverify=ok |
||
79 | !goto step3 |
||
80 | !endif |
||
5004 | bpr | 81 | !endif |
5100 | bpr | 82 | :begin |
23 | reyssat | 83 | !read tabletheme |
10367 | bpr | 84 | |
23 | reyssat | 85 | !if $site_total=$empty |
12955 | bpr | 86 | !read adm/class/stat |
87 | site_total=$usercnt |
||
88 | !default site_total=0 |
||
89 | site_dispo=$[$wims_user_limit-$site_total] |
||
90 | !if NaN isin $site_dispo |
||
91 | error=internal_total |
||
92 | !exit |
||
93 | !endif |
||
94 | !if $site_dispo<1 |
||
95 | error=site_complete |
||
96 | !exit |
||
97 | !endif |
||
23 | reyssat | 98 | !endif |
99 | |||
100 | !if $class!=$empty and $subclass=yes |
||
12955 | bpr | 101 | ctype=!defof class_type in wimshome/log/classes/$class/.def |
102 | classlist= |
||
103 | !if $ctype=2 |
||
104 | classcnt=!recordcnt wimshome/log/classes/$class/.subclasses |
||
105 | !for i=1 to $classcnt |
||
106 | l=!record $i of wimshome/log/classes/$class/.subclasses |
||
107 | classlist=!append item $(l[1]) to $classlist |
||
108 | !next i |
||
109 | !endif |
||
110 | !if $ctype=4 |
||
111 | classlist=!record 0 of wimshome/log/classes/$class/classes |
||
112 | classlist=!column 1 of $classlist |
||
113 | classlist=!nonempty items $classlist |
||
114 | classlist=!makelist $class/xx for xx in $classlist |
||
115 | !endif |
||
116 | !if $classlist!=$empty |
||
117 | classcnt=!itemcnt $classlist |
||
118 | institution_name=!defof class_institution in wimshome/log/classes/$class/.def |
||
119 | !reset class, subclass |
||
120 | !exit |
||
121 | !endif |
||
23 | reyssat | 122 | !endif |
123 | !if $class!=$empty and $subclass!=yes and $wims_user=supervisor |
||
12955 | bpr | 124 | ctype=!defof class_typename in wimshome/log/classes/$class/.def |
125 | !if $ctype=course |
||
126 | ctest=!sh readlink $wims_home/log/classes/$class/.userlist |
||
127 | cl=!defof n_part in wimshome/log/classes/$class/neighbors |
||
128 | ctype=!defof class_typename in wimshome/log/classes/$cl/.def |
||
129 | !if $ctest=../.userlist and $ctype=class |
||
130 | class=$cl |
||
131 | classpass=!defof class_password in wimshome/log/classes/$cl/.def |
||
132 | fromcourse=yes |
||
133 | !endif |
||
23 | reyssat | 134 | !endif |
135 | !endif |
||
136 | |||
13254 | guerimand | 137 | !! non used now (dangerous to activate : give access of email of all supervisor of the server) |
138 | !!if $class=$empty |
||
139 | !! classcnt=!recordcnt wimshome/log/classes/.index |
||
140 | !! !bound classcnt between integer 0 and 500 |
||
141 | !! classe= |
||
142 | !! classlist= |
||
143 | !! ctype=0 |
||
144 | !! !for i=1 to $classcnt |
||
145 | !! l=!record $i of wimshome/log/classes/.index |
||
146 | !! classlist=!append item $(l[1]) to $classlist |
||
147 | !! !next i |
||
148 | !! !exit |
||
149 | !!endif |
||
23 | reyssat | 150 | |
151 | !if $classe=$empty |
||
12955 | bpr | 152 | !defread wimshome/log/classes/$class/.def |
153 | !if $class_defined!=yes |
||
154 | error=no_class |
||
155 | !exit |
||
23 | reyssat | 156 | !endif |
12955 | bpr | 157 | !if $class_typename iswordof level program or \ |
158 | $wims_user=supervisor and $class_typename iswordof course |
||
159 | error=bad_classtype |
||
160 | !exit |
||
161 | !endif |
||
162 | !if $class_typename=course |
||
12978 | bpr | 163 | !!is it a obligatory course ? |
12955 | bpr | 164 | test=!defof class_ocourses in wimshome/log/classes/$class_parent/.def |
165 | test=!makelist $class_superclass/x for x in $test |
||
166 | !if $class isitemof $test |
||
167 | error=bad_classtype |
||
168 | !exit |
||
12978 | bpr | 169 | !else |
170 | !! non obligatory course |
||
171 | !read adm/class/userdef classes,$wims_class,$wims_user |
||
172 | scl=!defof user_participate in $userdef |
||
173 | !if $class notitemof $scl |
||
13064 | bpr | 174 | tmp=!defof class_type in wimshome/log/classes/$class_parent/.def |
175 | !!tmp=3 -> interclasse course |
||
176 | !if $class_parent isin $scl or $tmp=3 |
||
12978 | bpr | 177 | login=$wims_user |
13064 | bpr | 178 | !reset tmp |
12978 | bpr | 179 | !else |
180 | error=bad_optioncourse |
||
12984 | bpr | 181 | !exit |
13064 | bpr | 182 | !reset tmp |
12978 | bpr | 183 | !endif |
184 | !else |
||
185 | !exit |
||
186 | !endif |
||
12955 | bpr | 187 | !endif |
188 | !endif |
||
189 | participants=!recordcnt wimshome/log/classes/$class/.userlist |
||
190 | classe=$class_limit\ |
||
23 | reyssat | 191 | $participants\ |
192 | $class_password\ |
||
193 | $class_institution\ |
||
194 | $class_description\ |
||
195 | $class_supervisor\ |
||
196 | $class_email\ |
||
197 | $class_type |
||
12955 | bpr | 198 | passverify= |
199 | !if $participants>=$class_limit |
||
200 | error=complete |
||
201 | !exit |
||
202 | !endif |
||
23 | reyssat | 203 | !endif |
204 | !distribute lines $classe into limit,participants,password,institution,description,supervisor,smail,cltype |
||
205 | |||
206 | # class password verification. |
||
8956 | bpr | 207 | classpass_=!defof class_password in wimshome/log/classes/$class/.def |
208 | !if $classpass_=* |
||
209 | passverify=ok |
||
210 | !goto passclassok |
||
211 | !endif |
||
212 | |||
5084 | bpr | 213 | !if $step=1 or ($step=$empty and ($wims_user=supervisor or $classpass=$password)) |
12955 | bpr | 214 | !if ($class=$wims_class and $wims_user=supervisor) or $classpass=$password |
215 | superclass=!defof class_superclass in wimshome/log/classes/$class/.def |
||
216 | passverify=ok |
||
217 | search=!translate internal '",\:;$$&@*=+?/|^()[]{} to \ |
||
218 | ................................... in $search |
||
219 | search=!word -1 of $search |
||
220 | !if $class!=$superclass and $superclass!=$empty and $wims_user=supervisor \ |
||
221 | and $search!=$empty |
||
222 | found=!sh cd $wims_home/log/classes\ |
||
223 | comm -23 $superclass/.userlist $class/.userlist | \\ |
||
224 | grep -i "$search" | sed 's/^://' | head -100 |
||
225 | !!add research on the external_login |
||
226 | !if $auth_method isitemof $auth_method_list |
||
227 | found_external=!sh cd $wims_home/log/classes\ |
||
228 | comm -23 $superclass/.userlist_external $class/.userlist_external |\\ |
||
229 | grep -i "$search" | sed 's/:/,/' | head -100 |
||
230 | found_external=!column 2 of $found_external |
||
231 | found_external=!item 1 of $found_external |
||
232 | ext_cnt=!itemcnt $found_external |
||
233 | !for tmp=1 to $ext_cnt |
||
234 | found_ext=!sh cd $wims_home/log/classes\ |
||
235 | comm -23 $superclass/.userlist $class/.userlist | \\ |
||
236 | grep -i "$(found_external[$tmp])" | sed 's/^://' | head -100 |
||
237 | !if $found_e notlineof $found |
||
238 | found=!append line $found_e to $found |
||
239 | !endif |
||
6307 | bpr | 240 | !next |
12955 | bpr | 241 | !endif |
242 | foundcnt=!linecnt $found |
||
243 | !exit |
||
23 | reyssat | 244 | !endif |
12955 | bpr | 245 | !if $superclass!=$empty and ../$superclass/ isin ../$wims_class/ \ |
246 | and $wims_user!=supervisor |
||
247 | !read adm/class/userdef classes,$wims_class,$wims_user |
||
248 | scl=!defof user_participate in $userdef |
||
249 | cl2=!defof user_class in wimshome/log/classes/$class/.users/$wims_user |
||
250 | !if $class notitemof $scl and $cl2=$empty |
||
251 | adduser_replace=none |
||
252 | up_class=$class |
||
253 | !read adm/class/adduser $wims_user |
||
254 | adduser_replace= |
||
255 | !readdef $userdef |
||
256 | login=$wims_user |
||
257 | wims_otherclass=!append item $class $wims_user to $wims_otherclass |
||
258 | mses=!translate internal _ to $ $ in $wims_sesdir |
||
259 | mses=!word 1 of $mses |
||
13182 | bpr | 260 | user_participate=!listuniq $user_participate,$class |
13211 | bpr | 261 | ct=!defof class_typename in wimshome/log/classes/$class/.def |
262 | !if $ct=course |
||
263 | !! for case of intercourse in particular inscription from portal |
||
264 | ctp=!defof class_parent in wimshome/log/classes/$class/.def |
||
265 | ctt=!defof class_typename in wimshome/log/classes/$ctp/.def |
||
266 | !if $ctt=program |
||
267 | ctp_=!replace internal $wims_class/ by in $ctp |
||
268 | !!ctt_=!replace internal $wims_class/ by in $class |
||
269 | !!setdef !set user_class=$ctt_ in wimshome/log/classes/$ctp/.users/$login |
||
270 | !setdef !set user_class=$ctp_ in wimshome/log/classes/$class/.users/$login |
||
271 | !endif |
||
272 | !endif |
||
13182 | bpr | 273 | !setdef !set user_participate=$user_participate in $userdef |
12955 | bpr | 274 | !setdef wims_participate=$user_participate in wimshome/$mses/var.stat |
13182 | bpr | 275 | !setdef wims_otherclass=$wims_otherclass,$class in wimshome/$mses/var.stat |
276 | !appendfile wimshome/log/classes/$wims_class/.log $date $httpd_REMOTE_ADDR User $login added |
||
12955 | bpr | 277 | wims_module_log=Addclass $class by $wims_class/$wims_user |
278 | !read adm/class/mkuserlist $class |
||
279 | !read adm/class/stat |
||
280 | date=!translate : to . in $wims_now |
||
281 | !appendfile wimshome/log/classes/$class/.log $date $httpd_REMOTE_ADDR User $login added: $lastn, $firstn |
||
282 | !endif |
||
283 | step=3 |
||
284 | !exit |
||
285 | !endif |
||
286 | !else |
||
287 | error=bad_classpass |
||
23 | reyssat | 288 | !endif |
12955 | bpr | 289 | !exit |
23 | reyssat | 290 | !endif |
291 | |||
8956 | bpr | 292 | :passclassok |
23 | reyssat | 293 | !if $step=2 |
12955 | bpr | 294 | !read adm/class/authchars |
295 | n=!charcnt $login |
||
296 | !if $n<$login_min or $n>$login_max |
||
297 | error=login_size |
||
298 | !exit |
||
23 | reyssat | 299 | !endif |
12955 | bpr | 300 | ltest=!text select .$char_login in $login |
301 | !if $login!=$ltest |
||
302 | error=bad_login |
||
303 | !exit |
||
304 | !endif |
||
305 | Login=!translate internal . to @ in $login |
||
306 | user_exists= |
||
307 | !read adm/class/userdef classes,$class,$Login |
||
308 | test_exists=!defof user_exists in $userdef |
||
309 | lower_Login=!lower $Login |
||
310 | !if $wims_user=supervisor and $Login!=$empty and $lower_Login!=supervisor and $test_exists=yes |
||
311 | !readdef $userdef |
||
312 | pass=$user_password |
||
313 | ptest=$pass |
||
314 | !goto existing |
||
315 | !endif |
||
316 | !for i in lastn,firstn |
||
317 | $i=!replace , by , in $($i) |
||
318 | $i=!translate internal !$$<" to $ $ in $($i) |
||
319 | $i=!trim $($i) |
||
320 | $i=!singlespace $($i) |
||
321 | $i=!char 1 to 40 of $($i) |
||
322 | !next i |
||
323 | !if $lastn=$empty or $firstn=$empty |
||
324 | error=no_real |
||
325 | !exit |
||
326 | !endif |
||
327 | email=!translate internal "<>',|!$$ to $ $ in $email |
||
328 | email=!word -1 of $email |
||
329 | email=!char 1 to 60 of $email |
||
330 | !if $email!=$empty and (@ notin $email or . notin $email) |
||
331 | email= |
||
332 | !endif |
||
333 | n=!charcnt $pass |
||
334 | !if $n<$login_min or $n>$login_max |
||
335 | error=pass_size |
||
336 | !exit |
||
337 | !endif |
||
338 | ltest=!text select $char_passwd in $pass |
||
339 | !if $pass!=$ltest |
||
340 | error=bad_pass |
||
341 | !exit |
||
342 | !endif |
||
343 | !read adm/class/userdef classes,$class,$Login |
||
344 | userdef2=!replace users/ by users/. in $userdef |
||
345 | :existing |
||
346 | work=!filelist $wims_home/log/classes/$class/{score,noscore}/$Login |
||
347 | work=!trim $work |
||
348 | exist1=!defof user_exists in $userdef |
||
349 | exist2=!defof user_exists in $userdef2 |
||
350 | stest=!defof class_superclass in wimshome/log/classes/$class/.def |
||
351 | !if $exist1!=$empty and $stest!=$empty |
||
352 | ptest=!defof user_password in $userdef |
||
353 | ctest=!defof user_participate in $userdef |
||
354 | ptest1=!passcrypt $ptest |
||
355 | ptest2=!passcrypt $pass |
||
356 | !if $ptest2 iswordof $ptest1 |
||
357 | ctest=!append item $class to $ctest |
||
358 | ctest=!listuniq $ctest |
||
359 | !setdef !set user_participate=$ctest in $userdef |
||
360 | step=3 |
||
361 | !goto endreg |
||
362 | !endif |
||
363 | !endif |
||
364 | lower_login=!lower $login |
||
365 | !if $exist1$exist2!=$empty or $work!=$empty or $lower_login iswordof supervisor visitor |
||
366 | error=login_double |
||
367 | !exit |
||
368 | !endif |
||
369 | !bound agreecgu within yes,no,external default no |
||
370 | !if $agreecgu=no and $wims_user!=supervisor |
||
371 | error=no_cgu |
||
372 | !exit |
||
373 | !endif |
||
374 | login_bak=$login,$pass |
||
23 | reyssat | 375 | !exit |
376 | !endif |
||
5097 | bpr | 377 | :step3 |
23 | reyssat | 378 | !if $step=3 |
12955 | bpr | 379 | !bound agreecgu within yes,no,external default no |
380 | !if $agreecgu=no and $wims_user!=supervisor |
||
381 | error=no_cgu |
||
382 | !exit |
||
383 | !endif |
||
384 | !if $pass!=$pass2 or $login_bak!=$login,$pass |
||
385 | error=pass_error |
||
386 | !exit |
||
387 | !endif |
||
388 | Login=!translate internal . to @ in $login |
||
389 | !read adm/class/userdef classes,$class,$Login |
||
390 | userdef2=!replace internal users/ by users/. in $userdef |
||
391 | !defread $userdef |
||
392 | user_exists= |
||
5023 | bpr | 393 | |
12955 | bpr | 394 | !defread $userdef2 |
395 | work=!filelist $wims_home/log/classes/$class/{score,noscore}/$Login |
||
396 | !if $user_exists=yes or $work!=$empty |
||
397 | error=login_double |
||
398 | !exit |
||
9475 | bpr | 399 | !endif |
12955 | bpr | 400 | !if $idp_method=$empty |
401 | up_firstname=$firstn |
||
402 | up_lastname=$lastn |
||
403 | up_email=$email |
||
404 | !if $regvars_cnt>0 |
||
405 | !for j=1 to $regvars_cnt |
||
406 | up_regprop$j=!detag $(regprop$j) |
||
407 | !next j |
||
408 | !endif |
||
23 | reyssat | 409 | !else |
12955 | bpr | 410 | !read adm/class/idp_$idp_method |
411 | firstn=$up_firstname |
||
412 | lastn=$up_lastname |
||
413 | email=$up_email |
||
23 | reyssat | 414 | !endif |
12955 | bpr | 415 | up_password=$pass |
416 | up_class=$class |
||
417 | up_agreecgu=$agreecgu |
||
418 | up_external_auth=$auth_user |
||
419 | !if ($cltype iswordof 2 4 and $wims_user=$empty) or\ |
||
420 | ($wims_user=supervisor and $utype iswordof 1 3) |
||
421 | up_supervisable=yes |
||
422 | !else |
||
423 | up_supervisable=no |
||
23 | reyssat | 424 | !endif |
12955 | bpr | 425 | !default Login=$login |
426 | !read adm/class/adduser $Login |
||
427 | user_exists= |
||
428 | !defread $userdef |
||
429 | !if $user_exists!=yes |
||
430 | error=insert_fail |
||
431 | !exit |
||
432 | !endif |
||
433 | :endreg |
||
434 | !read adm/class/mkuserlist $class |
||
435 | !if $up_supervisable=yes |
||
436 | superclass=!defof class_superclass in wimshome/log/classes/$class/.def |
||
437 | !if $superclass!=$empty |
||
438 | ctype=!defof class_type in wimshome/log/classes/$superclass/.def |
||
439 | !else |
||
440 | superclass=$class |
||
441 | ctype=$class_type |
||
442 | !endif |
||
443 | !ifval $ctype=4 or $ctype=2 |
||
444 | !read adm/gateway/mkteacherlist $superclass |
||
445 | !endif |
||
446 | !endif |
||
447 | wims_module_log=registered $login in $class |
||
448 | date=!translate : to . in $wims_now |
||
449 | !appendfile wimshome/log/classes/$class/.log $date $httpd_REMOTE_ADDR User $login created: $lastn, $firstn |
||
450 | !read adm/class/stat |
||
451 | !exit |
||
23 | reyssat | 452 | !endif |