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