Rev 15427 | Rev 16004 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4561 | obado | 1 | # AuthUser |
2 | # permet d'authentifier l'utilisateur quser dans la classe qclass |
||
3 | |||
15427 | obado | 4 | # On commence par verifier la classe $qclass |
4667 | obado | 5 | !read scripts/check.class |
6 | !if $error!=$empty |
||
15427 | obado | 7 | !exit |
4667 | obado | 8 | !endif |
9 | |||
5156 | czzmrn | 10 | !if hashlogin iswordof $option |
15427 | obado | 11 | quser_orig=$quser |
12 | !read adm/class/hashlogin $quser_orig,$qclass, |
||
13 | quser=$login |
||
5156 | czzmrn | 14 | !endif |
15 | |||
15427 | obado | 16 | # Puis on verifie l'existence de $quser |
23 | reyssat | 17 | !read scripts/check.user |
18 | !if $error!=$empty |
||
15427 | obado | 19 | !if hashlogin iswordof $option |
20 | error=hashlogin: $login |
||
21 | !endif |
||
22 | !exit |
||
23 | reyssat | 23 | !endif |
24 | |||
25 | !readdef $userdeffile |
||
26 | !if $qpasswd != $empty and $qpasswd != $user_password |
||
15427 | obado | 27 | error=user authentification failure |
28 | !exit |
||
23 | reyssat | 29 | !endif |
30 | |||
15427 | obado | 31 | wims_mode=$empty |
23 | reyssat | 32 | !readdef $classdeffile |
33 | |||
13140 | czzmrn | 34 | !if $class_type isitemof 2,4 |
15427 | obado | 35 | !default class_superclass=$wims_class |
13140 | czzmrn | 36 | !endif |
3261 | obado | 37 | !default class_typename=class |
38 | !default class_type=0 |
||
39 | |||
4590 | obado | 40 | # Il faut tout d'abord verifier que l'utilisateur n'etait pas en session d'examen |
41 | parmreg=!record 0 of wimshome/log/classes/$wims_class/.parmreg/$quser.exam |
||
42 | nb_parms=!wordcnt $parmreg |
||
43 | |||
44 | ### Schema du fichier .parmreg/user.exam ### |
||
9750 | obado | 45 | ## |
4590 | obado | 46 | ## IP SESS_ID ??? exam_ID |
47 | ## exemple : 134.59.121.121 UI99D09012 1315494761 3 |
||
48 | ## |
||
49 | ############ |
||
50 | |||
51 | num_session=$wims_session |
||
52 | |||
15427 | obado | 53 | # data1 doit contenir l'ip du user et non du serveur appelant |
54 | remote_addr=!word 1 of $data1 |
||
4629 | obado | 55 | |
4590 | obado | 56 | !if $nb_parms>=4 |
9750 | obado | 57 | |
15427 | obado | 58 | !distribute words $parmreg into sess_IP,sess_ID,sess_time,exam_id |
9750 | obado | 59 | |
15427 | obado | 60 | !set r_=!record 0 of wimshome/sessions/$sess_ID/examreg.$exam_id |
61 | !set now=$wims_nowseconds |
||
4590 | obado | 62 | |
15427 | obado | 63 | !set ws=!translate _ to $ $ in $wims_session |
64 | !set ws=!word 1 of $ws |
||
4590 | obado | 65 | |
15427 | obado | 66 | !set restrictions=!record 0 of wimshome/log/classes/$wims_class/.E$exam_id |
9750 | obado | 67 | |
15427 | obado | 68 | # Check if user has changed his IP only if option $class_examscore_withoutip is active |
69 | !if $class_examscore_withoutip!=yes |
||
70 | # if a different exam session has started, is still pending |
||
15856 | czzmrn | 71 | # ("$restrictions!=#" i.e. score registration open for all) |
15427 | obado | 72 | !if $r_!=$empty and $sess_ID!=$ws and $sess_time>$now and $restrictions!=# |
73 | !if $quser != supervisor and $sess_IP != $remote_addr |
||
9750 | obado | 74 | |
15427 | obado | 75 | !sh rm -f ../sessions/$ws/var.stat >/dev/null |
76 | !if $remote_addr=$empty |
||
77 | error= $quser is already in an exam session, but your server didn't provided the user actual IP in data1. |
||
78 | !else |
||
79 | error= $quser is in an exam session started on another IP. Go back quickly to this computer! |
||
80 | !endif |
||
81 | !exit |
||
82 | !endif |
||
83 | num_session=$sess_ID |
||
84 | !endif |
||
85 | !endif |
||
9750 | obado | 86 | |
15427 | obado | 87 | #si la session d'examen est terminee, on reinitialise les parametres de session |
88 | !if $sess_time<$now or $r_=$empty |
||
89 | !writefile wimshome/log/classes/$wims_class/.parmreg/$quser.exam |
||
90 | !endif |
||
4590 | obado | 91 | |
92 | !endif |
||
93 | |||
94 | dir_session=sessions/$num_session |
||
95 | |||
4629 | obado | 96 | !if $remote_addr!=$empty |
15427 | obado | 97 | !setdef REMOTE_ADDR=$remote_addr in wimshome/$dir_session/var |
4629 | obado | 98 | !endif |
99 | |||
100 | |||
5300 | obado | 101 | !writefile wimshome/$dir_session/var.stat wims_class=$wims_class\ |
23 | reyssat | 102 | wims_user=$quser\ |
103 | wims_firstname=$user_firstname\ |
||
104 | wims_lastname=$user_lastname\ |
||
105 | wims_email=$user_email\ |
||
5141 | czzmrn | 106 | wims_external_auth=$user_external_auth\ |
23 | reyssat | 107 | wims_classname=$class_description\ |
108 | wims_institutionname=$class_institution\ |
||
109 | wims_supervisor=$class_supervisor\ |
||
391 | obado | 110 | wims_supervisormail=$class_email\ |
8295 | obado | 111 | wims_css=$class_css\ |
112 | wims_theme=$class_theme\ |
||
8424 | obado | 113 | wims_theme_icon=$class_theme_icon\ |
929 | bpr | 114 | wims_participate=$user_participate\ |
4176 | obado | 115 | wims_superclass=$class_superclass\ |
5303 | obado | 116 | wims_supervise=$user_supervise\ |
3261 | obado | 117 | wims_supertype=$class_type\ |
118 | wims_typename=$class_typename |
||
929 | bpr | 119 | |
13154 | czzmrn | 120 | !read ./adm/class/authprep $wims_class,$quser |
121 | !writefile wimshome/$wims_sesdir/var.stat $classdef |
||
3261 | obado | 122 | |
13154 | czzmrn | 123 | !! the following not needed with lines above |
124 | !! !if $quser!=supervisor |
||
125 | !! !appendfile wimshome/$dir_session/var.stat wims_realuser=$quser |
||
126 | !! !endif |
||
127 | |||
4118 | obado | 128 | !if lightpopup iswordof $option |
15427 | obado | 129 | !setdef wims_lightpopup=yes in wimshome/$dir_session/var.stat |
130 | !setdef w_wims_lightpopup=yes in wimshome/$dir_session/var |
||
4118 | obado | 131 | !endif |
3261 | obado | 132 | |
4590 | obado | 133 | !sh mkdir $wims_home/$dir_session/getfile |
3261 | obado | 134 | |
4590 | obado | 135 | !sh ln -s $wims_home/log/classes/$qclass/src/images $wims_home/$dir_session/getfile/oefimages |
13830 | czzmrn | 136 | |
137 | !if $quser=supervisor |
||
15427 | obado | 138 | !! log supervisor access to class |
139 | date=!translate : to . in $wims_now |
||
140 | !appendfile wimshome/log/classes/$qclass/.log $date $httpd_REMOTE_ADDR supervisor login via adm/raw |
||
13830 | czzmrn | 141 | !endif |
142 |