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