Rev 17386 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
17386 | guerimand | 1 | !! ---------- process manage of anonymous connexion to example class |
2 | !! each connexion use a different login |
||
3 | !! login is generated if necessary |
||
4 | !! anonymous connexion is limited to 50% of class capacity |
||
5 | !! other is reserved to registered login |
||
6 | !! wims_read_parm input parameters are |
||
7 | !! first item : login of user (exit if not anonymous) |
||
8 | !! second item : class number (exit if not <=9999 ) |
||
9 | !! process exit if no place left |
||
10 | !! output=$output_user |
||
11 | |||
12 | !distribute item $wims_read_parm into c_,u_ |
||
13 | t_=!char 1 to 9 of $u_ |
||
14 | t_=!lower $t_ |
||
15 | n_=!char 10 to -1 of $u_ |
||
16 | !default n_=0 |
||
17 | !if NaN notin $[1*$n_] and $t_=anonymous |
||
18 | dispo=!record 2 of wimshome/log/classes/$c_/freelogin |
||
17389 | guerimand | 19 | dispo=!nospace $dispo |
17386 | guerimand | 20 | time=!record 1 of wimshome/log/classes/$c_/freelogin |
21 | !if $dispo=$empty and ($time=$empty or $wims_nowseconds>$time+600) |
||
22 | ltuser=!sh cd $wims_home/sessions;\ |
||
23 | s=`grep wims_class=$c_ ./*/var.stat | cut -d: -f1`;\ |
||
24 | grep "wims_user=" $$s | cut -d= -f2; |
||
25 | !if $ltuser!=$empty |
||
26 | ltuser=!words2items $ltuser |
||
27 | ltuser=!replace anonymous by $empty in $ltuser |
||
28 | !endif |
||
29 | cllimit=!defof class_limit in wimshome/log/classes/$c_/.def |
||
30 | !if $cllimit=$empty |
||
31 | cllimit=!defof class_user_limit in wimshome/log/wims.conf |
||
32 | !if $cllimit=$empty |
||
33 | cllimit=!defof DF_class_limit in wimshome/public_html/bases/sys/defaults.conf |
||
34 | !endif |
||
35 | !endif |
||
36 | dispo=$[rint($cllimit/2)] |
||
37 | dispo=!values v for v=1 to $dispo |
||
38 | dispo=,$dispo |
||
39 | dispo=!listcomplement $ltuser in $dispo |
||
40 | dispo=!nospace $dispo |
||
41 | !endif |
||
42 | !if $dispo=$empty |
||
43 | !restart module=adm/class/classes/&+job=example&+fullcls=1 |
||
44 | !else |
||
45 | num=!item 1 of $dispo |
||
46 | test=!fileexists wimshome/log/classes/$c_/.users/anonymous$num |
||
47 | !if $test!=yes |
||
48 | nbuser=!recordcnt wimshome/log/classes/$c_/.userlist |
||
17389 | guerimand | 49 | !if $cllimit=$empty |
50 | cllimit=!defof class_limit in wimshome/log/classes/$c_/.def |
||
51 | !if $cllimit=$empty |
||
52 | cllimit=!defof class_user_limit in wimshome/log/wims.conf |
||
53 | !if $cllimit=$empty |
||
54 | cllimit=!defof DF_class_limit in wimshome/public_html/bases/sys/defaults.conf |
||
55 | !endif |
||
56 | !endif |
||
57 | !endif |
||
17386 | guerimand | 58 | !if $nbuser<=$cllimit |
59 | !sh cp $wims_home/log/classes/$c_/.users/anonymous $wims_home/log/classes/$c_/.users/anonymous$num |
||
60 | !readproc adm/class/mkuserlist $c_ |
||
61 | !else |
||
62 | !restart module=adm/class/classes/&+job=example&+fullcls=1 |
||
63 | !endif |
||
64 | !endif |
||
65 | output_user=anonymous$num |
||
66 | dispo=!item 2 to -1 of $dispo |
||
67 | !writefile wimshome/log/classes/$c_/freelogin :$wims_nowseconds\ |
||
68 | :$dispo |
||
69 | !endif |
||
70 | !else |
||
71 | output_user=$u_ |
||
72 | !endif |