Rev 10171 | Rev 13211 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10171 | Rev 12845 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | !if $auth_password=*wims_site_manager |
1 | !if $auth_password=*wims_site_manager |
2 | !if $wims_ismanager<2 |
2 | !if $wims_ismanager<2 |
3 | auth_password= |
3 | auth_password= |
4 | !else |
4 | !else |
5 | !goto auth_ok |
5 | !goto auth_ok |
6 | !endif |
6 | !endif |
7 | !endif |
7 | !endif |
8 | 8 | ||
9 | !if $save_logincgu!=$empty |
9 | !if $save_logincgu!=$empty |
10 | !if $agreecgu=yes |
10 | !if $agreecgu=yes |
11 | !read adm/class/userdef wimshome/log/classes,$class,$save_logincgu |
11 | !read adm/class/userdef wimshome/log/classes,$class,$save_logincgu |
12 | !setdef !set user_agreecgu=yes in $userdef |
12 | !setdef !set user_agreecgu=yes in $userdef |
13 | !readdef $userdef |
13 | !readdef $userdef |
14 | !reset error |
14 | !reset error |
15 | !if $auth_test=OK |
15 | !if $auth_test=OK |
16 | !goto auth_ok2 |
16 | !goto auth_ok2 |
- | 17 | !endif |
|
17 | !endif |
18 | !endif |
18 | !endif |
- | |
19 | !!!reset $save_logincgu |
19 | !!!reset $save_logincgu |
20 | !endif |
20 | !endif |
21 | 21 | ||
22 | !read adm/class/authchars |
22 | !read adm/class/authchars |
23 | auth_user=!word 1 of $auth_user |
23 | auth_user=!word 1 of $auth_user |
24 | auth_password=!word 1 of $auth_password |
24 | auth_password=!word 1 of $auth_password |
Line 29... | Line 29... | ||
29 | 29 | ||
30 | ##### EXTERNAL connection - part 1 ##### |
30 | ##### EXTERNAL connection - part 1 ##### |
31 | !!default sclass=$class |
31 | !!default sclass=$class |
32 | 32 | ||
33 | !if ($auth_user notsametext supervisor or $class_type>0) and $auth_method isitemof $auth_method_list |
33 | !if ($auth_user notsametext supervisor or $class_type>0) and $auth_method isitemof $auth_method_list |
34 | authdef=wimshome/log/classes/$superclass/.def |
34 | authdef=wimshome/log/classes/$superclass/.def |
35 | - | ||
36 | # don't use auth_user and auth_password, some characters are unvailable |
- | |
37 | # parameters are empty for auth-cas |
- | |
38 | !readproc adm/class/auth-$auth_method $auth_user_connection,$auth_password_connection |
- | |
39 | 35 | ||
- | 36 | # don't use auth_user and auth_password, some characters are unvailable |
|
- | 37 | # parameters are empty for auth-cas |
|
- | 38 | !readproc adm/class/auth-$auth_method $auth_user_connection,$auth_password_connection |
|
40 | !endif |
39 | !endif |
41 | ##### end of EXTERNAL connection - part 1 ##### |
40 | ##### end of EXTERNAL connection - part 1 ##### |
- | 41 | ||
42 | # now we can run the script |
42 | # now we can run the script |
43 | !if $auth_method isitemof $auth_method_list and $auth_user!=supervisor |
43 | !if $auth_method isitemof $auth_method_list and $auth_user!=supervisor |
44 | auth_user=!lookup $auth_user_orig in wimshome/log/classes/$superclass/.userlist_external |
44 | auth_user=!lookup $auth_user_orig in wimshome/log/classes/$superclass/.userlist_external |
45 | !if $auth_user=$empty |
45 | !if $auth_user=$empty |
46 | auth_user=!lookup $auth_user_orig in wimshome/log/classes/$superclass/.teacherlist_external |
46 | auth_user=!lookup $auth_user_orig in wimshome/log/classes/$superclass/.teacherlist_external |
Line 55... | Line 55... | ||
55 | logline=$now $auth_user $$passwd $httpd_REMOTE_ADDR |
55 | logline=$now $auth_user $$passwd $httpd_REMOTE_ADDR |
56 | 56 | ||
57 | !read adm/class/userdef classes,$class,$auth_user |
57 | !read adm/class/userdef classes,$class,$auth_user |
58 | 58 | ||
59 | pass=!defof user_password in $userdef |
59 | pass=!defof user_password in $userdef |
- | 60 | ||
60 |
|
61 | ##FIXME ### Have to check that sclass is no yet useful |
61 | sclass=!defof class_superclass in wimshome/log/classes/$class/.def |
62 | sclass=!defof class_superclass in wimshome/log/classes/$class/.def |
62 | !if $superclass!=$empty and $superclass!=$class |
63 | !if $superclass!=$empty and $superclass!=$class |
63 | upartic=!defof user_participate in $userdef |
64 | upartic=!defof user_participate in $userdef |
64 | usuperv=!defof user_supervise in $userdef |
65 | usuperv=!defof user_supervise in $userdef |
65 | pclass=!defof class_parent in wimshome/log/classes/$class/.def |
66 | pclass=!defof class_parent in wimshome/log/classes/$class/.def |
66 | !if / isin $pclass and ../$pclass/ isin ../$class |
67 | !if / isin $pclass and ../$pclass/ isin ../$class |
67 | ss=!defof class_ocourses in wimshome/log/classes/$pclass/.def |
68 | ss=!defof class_ocourses in wimshome/log/classes/$pclass/.def |
68 | !if $ss!=$empty |
69 | !if $ss!=$empty |
69 | ss=!makelist $wims_superclass/xx for xx in $ss |
70 | ss=!makelist $wims_superclass/xx for xx in $ss |
70 | upartic=!append item $ss to $upartic |
71 | upartic=!append item $ss to $upartic |
71 | !endif |
72 | !endif |
72 | !endif |
73 | !endif |
73 | coursecheck=!defof user_class in wimshome/log/classes/$class/.users/$auth_user |
74 | coursecheck=!defof user_class in wimshome/log/classes/$class/.users/$auth_user |
74 | !if $coursecheck!=$empty |
75 | !if $coursecheck!=$empty |
75 | upartic=!append item $class to $upartic |
76 | upartic=!append item $class to $upartic |
76 | !endif |
77 | !endif |
77 | !!check mandatory course |
78 | !!check mandatory course |
78 | dcourse=!record 0 of wimshome/log/classes/$pclass/courses |
79 | dcourse=!record 0 of wimshome/log/classes/$pclass/courses |
79 | dcourse=!column 1 of $dcourse |
80 | dcourse=!column 1 of $dcourse |
80 | !if $dcourse!=$empty |
81 | !if $dcourse!=$empty |
81 |
|
82 | dcourse=!makelist $wims_superclass/xx for xx in $dcourse |
82 |
|
83 | upartic=!append item $dcourse to $upartic |
83 | !endif |
84 | !endif |
84 | upartic=!listuniq $upartic |
85 | upartic=!listuniq $upartic |
85 | !if $auth_user=supervisor and $wims_user=supervisor |
86 | !if $auth_user=supervisor and $wims_user=supervisor |
86 | ctype=!defof class_typename in wimshome/log/classes/$class/.def |
87 | ctype=!defof class_typename in wimshome/log/classes/$class/.def |
87 | prog=!defof sharing_exam in wimshome/log/classes/$class/neighbors |
88 | prog=!defof sharing_exam in wimshome/log/classes/$class/neighbors |
88 | !if $ctype iswordof course icourse and $prog=$wims_class |
89 | !if $ctype iswordof course icourse and $prog=$wims_class |
89 | pass=$current_pass |
90 | pass=$current_pass |
90 | !endif |
91 | !endif |
91 | !endif |
92 | !endif |
92 | !!upartic : no more authentification should check for optional courses ? |
93 | !!upartic : no more authentification should check for optional courses ? |
93 | !if $class notitemof $upartic and $auth_user!=supervisor and $wims_user!=supervisor |
94 | !if $class notitemof $upartic and $auth_user!=supervisor and $wims_user!=supervisor |
94 | pass= |
95 | pass= |
95 | !endif |
96 | !endif |
96 | # These lines should be opened later to close this possibility. |
97 | # These lines should be opened later to close this possibility. |
97 | # !if $auth_user=supervisor and $wims_user=$empty |
98 | # !if $auth_user=supervisor and $wims_user=$empty |
98 | # pass= |
99 | # pass= |
99 | # !endif |
100 | # !endif |
100 | !endif |
101 | !endif |
101 | 102 | ||
102 | !if $auth_user=supervisor |
103 | !if $auth_user=supervisor |
103 | !goto wimsauth |
104 | !goto wimsauth |
104 | !endif |
105 | !endif |
105 | 106 | ||
106 | ##### final test of external connection ##### |
107 | ##### final test of external connection ##### |
107 | # finaly, we must check if user is allowed in class |
108 | # finaly, we must check if user is allowed in class |
108 | 109 | ||
109 | exist_check=!defof user_exists in $userdef |
110 | exist_check=!defof user_exists in $userdef |
110 | 111 | ||
111 | !if OK iswordof $auth_test and $auth_method isitemof $auth_method_list |
112 | !if OK iswordof $auth_test and $auth_method isitemof $auth_method_list |
112 | !if $exist_check issametext yes |
113 | !if $exist_check issametext yes |
113 | !goto auth_ok |
114 | !goto auth_ok |
114 | !else |
115 | !else |
115 | !setdef user_auth=$auth_user_orig in wimshome/$wims_sesdir/var.stat |
116 | !setdef user_auth=$auth_user_orig in wimshome/$wims_sesdir/var.stat |
116 | !goto end |
117 | !goto end |
117 | !endif |
118 | !endif |
118 | !endif |
119 | !endif |
119 | ##### end of final test of external connection ##### |
120 | ##### end of final test of external connection ##### |
120 | :wimsauth |
121 | :wimsauth |
121 | 122 | ||
122 | pass=!passcrypt $pass |
123 | pass=!passcrypt $pass |
123 | !if $pass=$empty |
124 | !if $pass=$empty |
124 | !if $auth_user_connection=$empty |
125 | !if $auth_user_connection=$empty |
125 | !exit |
126 | !exit |
126 | !endif |
127 | !endif |
127 | passwd=???? |
128 | passwd=???? |
128 | !appendfile $logfile $logline |
129 | !appendfile $logfile $logline |
129 | auth_user=$auth_user_connection |
130 | auth_user=$auth_user_connection |
130 | error=bad_password |
131 | error=bad_password |
131 | !exit |
132 | !exit |
132 | !endif |
133 | !endif |
133 | 134 | ||
134 | !if $wims_superclass!=$empty and $wims_user!=supervisor and $auth_user!=$wims_user |
135 | !if $wims_superclass!=$empty and $wims_user!=supervisor and $auth_user!=$wims_user |
135 | supervisable=!defof user_supervisable in wimshome/log/classes/$wims_superclass/.users/$wims_user |
136 | supervisable=!defof user_supervisable in wimshome/log/classes/$wims_superclass/.users/$wims_user |
136 | !if $supervisable!=yes |
137 | !if $supervisable!=yes |
137 | current_pass= |
138 | current_pass= |
138 | !endif |
139 | !endif |
139 | !endif |
140 | !endif |
140 | 141 | ||
141 | cps=!passcrypt $current_pass |
142 | cps=!passcrypt $current_pass |
142 | !if ($auth_user!=$empty and $class $auth_user isitemof $wims_otherclass) or \ |
143 | !if ($auth_user!=$empty and $class $auth_user isitemof $wims_otherclass) or \ |
143 | ($current_pass!=$empty and $cps iswordof $pass) or \ |
144 | ($current_pass!=$empty and $cps iswordof $pass) or \ |
144 | ($auth_user=$wims_user and $class isitemof $wims_participate) or \ |
145 | ($auth_user=$wims_user and $class isitemof $wims_participate) or \ |
145 | ($auth_user=supervisor and $wims_user=supervisor and \ |
146 | ($auth_user=supervisor and $wims_user=supervisor and \ |
146 |
|
147 | (../$wims_class/ isin ../$class/ or $superclass=$wims_class)) or \ |
147 | ($auth_user=supervisor and $class isitemof $wims_supervise) |
148 | ($auth_user=supervisor and $class isitemof $wims_supervise) |
148 | !goto auth_ok |
149 | !goto auth_ok |
149 | !endif |
150 | !endif |
150 | 151 | ||
151 | !if $auth_password=$empty |
152 | !if $auth_password=$empty |
152 | !exit |
153 | !exit |
153 | !endif |
154 | !endif |
154 | 155 | ||
155 | !read adm/class/authdelay |
156 | !read adm/class/authdelay |
156 | !if $auth_password notwordof $pass |
157 | !if $auth_password notwordof $pass |
157 | !if $auth_user_orig=$empty and $auth_password=$empty |
158 | !if $auth_user_orig=$empty and $auth_password=$empty |
158 | !exit |
159 | !exit |
159 | !endif |
160 | !endif |
160 | passwd=?????? |
161 | passwd=?????? |
161 | !appendfile $logfile $logline |
162 | !appendfile $logfile $logline |
162 | auth_user=$auth_user_orig |
163 | auth_user=$auth_user_orig |
163 | error=bad_password |
164 | error=bad_password |
164 | !exit |
165 | !exit |
165 | !endif |
166 | !endif |
166 | 167 | ||
167 | :auth_ok |
168 | :auth_ok |
168 | !if $auth_user=supervisor and $wims_user!=$empty and $wims_user!=supervisor and \ |
169 | !if $auth_user=supervisor and $wims_user!=$empty and $wims_user!=supervisor and \ |
169 | $class notitemof $wims_supervise |
170 | $class notitemof $wims_supervise |
170 | userdef_save=$userdef |
171 | userdef_save=$userdef |
171 | !read adm/class/userdef classes,$wims_class,$wims_user |
172 | !read adm/class/userdef classes,$wims_class,$wims_user |
172 | !exchange userdef_save,userdef |
173 | !exchange userdef_save,userdef |
173 | spv=!defof user_supervisable in $userdef_save |
174 | spv=!defof user_supervisable in $userdef_save |
174 | !if $spv=yes |
175 | !if $spv=yes |
175 | wims_supervise=!append item $class to $wims_supervise |
176 | wims_supervise=!append item $class to $wims_supervise |
176 | !setdef !set user_supervise=$wims_supervise in $userdef_save |
177 | !setdef !set user_supervise=$wims_supervise in $userdef_save |
177 | !endif |
178 | !endif |
178 | !endif |
179 | !endif |
179 | n=!positionof word $auth_password in $pass |
180 | n=!positionof word $auth_password in $pass |
180 | n=!item 1 of $n |
181 | n=!item 1 of $n |
181 | !if $n!=$empty |
182 | !if $n!=$empty |
182 | passwd=OK$n $ |
183 | passwd=OK$n $ |
183 | !else |
184 | !else |
184 | passwd=$wims_class |
185 | passwd=$wims_class |
185 | !endif |
186 | !endif |
186 | # one-time password |
187 | # one-time password |
187 | !if $n!=$empty and $n>1 |
188 | !if $n!=$empty and $n>1 |
188 | pass=!replace word $auth_password by $ in $pass |
189 | pass=!replace word $auth_password by $ in $pass |
189 | pass=!singlespace $pass |
190 | pass=!singlespace $pass |
190 | pass=!trim $pass |
191 | pass=!trim $pass |
191 | !setdef !set user_password=$pass in $userdef |
192 | !setdef !set user_password=$pass in $userdef |
192 | !endif |
193 | !endif |
193 | :auth_ok2 |
194 | :auth_ok2 |
194 | 195 | ||
195 | !defread $userdef |
196 | !defread $userdef |
196 | ctype=!defof class_type in wimshome/log/classes/$class/.def |
197 | ctype=!defof class_type in wimshome/log/classes/$class/.def |
197 | !if $ctype=4 and $auth_user!=supervisor and $user_supervisable!=yes\ |
198 | !if $ctype=4 and $auth_user!=supervisor and $user_supervisable!=yes\ |
198 | and (/ notin $wims_class or ../$wims_superclass/ notin ../$wims_class/) |
199 | and (/ notin $wims_class or ../$wims_superclass/ notin ../$wims_class/) |
199 | utest=!itemcnt $user_participate |
200 | utest=!itemcnt $user_participate |
200 | !if $utest=1 and / isin $user_participate |
201 | !if $utest=1 and / isin $user_participate |
201 | class=!item 1 of $user_participate |
202 | class=!item 1 of $user_participate |
202 | !defread wimshome/log/classes/$class/.def |
203 | !defread wimshome/log/classes/$class/.def |
203 | !endif |
204 | !endif |
204 | !endif |
205 | !endif |
205 | clang=!defof class_lang in wimshome/log/classes/$class/.def |
206 | clang=!defof class_lang in wimshome/log/classes/$class/.def |
206 | 207 | ||
207 | - | ||
208 | 208 | ||
209 | !if $auth_user=supervisor |
209 | !if $auth_user=supervisor |
210 | sech=!defof class_secure in wimshome/log/classes/$class/.def |
210 | sech=!defof class_secure in wimshome/log/classes/$class/.def |
211 | sech=!trim $sech |
211 | sech=!trim $sech |
212 | !if $sech=$empty |
212 | !if $sech=$empty |
213 | t=0 |
213 | t=0 |
214 | !else |
214 | !else |
215 | t=!checkhost $sech |
215 | t=!checkhost $sech |
216 | !if $t<1 |
216 | !if $t<1 |
217 | t=-1 |
217 | t=-1 |
218 | !endif |
218 | !endif |
219 | !endif |
219 | !endif |
220 | sup_secure=$t |
220 | sup_secure=$t |
221 | !else |
221 | !else |
222 | !read adm/class/raftest |
222 | !read adm/class/raftest |
223 | !if $raftest>$lastallow |
223 | !if $raftest>$lastallow |
224 | error=recent_rafale |
224 | error=recent_rafale |
225 | !exit |
225 | !exit |
226 | !endif |
226 | !endif |
227 | sup_secure=-1 |
227 | sup_secure=-1 |
228 | !if $user_agreecgu notwordof yes external and $agreecgu!=yes |
228 | !if $user_agreecgu notwordof yes external and $agreecgu!=yes |
229 | error=no_cgu |
229 | error=no_cgu |
230 | !exit |
230 | !exit |
231 | !endif |
231 | !endif |
232 | !endif |
232 | !endif |
233 | 233 | ||
234 | !read adm/class/authprep $class,$auth_user |
234 | !read adm/class/authprep $class,$auth_user |
235 | 235 | ||
236 | !if $logfile!=$empty |
236 | !if $logfile!=$empty |
237 | !if $auth_user=supervisor |
237 | !if $auth_user=supervisor |
238 | !appendfile $logfiles $now $httpd_REMOTE_ADDR supervisor login |
238 | !appendfile $logfiles $now $httpd_REMOTE_ADDR supervisor login |
239 | !else |
239 | !else |
240 | !appendfile $logfile $logline |
240 | !appendfile $logfile $logline |
241 | !endif |
241 | !endif |
242 | !endif |
242 | !endif |
243 | 243 | ||
244 | !if $class_lock=7 and $auth_user!=supervisor |
244 | !if $class_lock=7 and $auth_user!=supervisor |
245 | !usererror class_closed |
245 | !usererror class_closed |
246 | !exit |
246 | !exit |
247 | !endif |
247 | !endif |
248 | 248 | ||
249 | !if $class_lock iswordof 2 4 6 |
249 | !if $class_lock iswordof 2 4 6 |
250 | !set wims_protocol=https |
250 | !set wims_protocol=https |
251 | !endif |
251 | !endif |
252 | !if $wims_user=$empty and $changesession!=no |
252 | !if $wims_user=$empty and $changesession!=no |
253 | !writefile wimshome/$wims_sesdir/var.class.prep $classdef |
253 | !writefile wimshome/$wims_sesdir/var.class.prep $classdef |
254 | random=!randint 10^5,10^9 |
254 | random=!randint 10^5,10^9 |
255 | !restart session=new.$random&lang=$clang&old_session=$wims_session&module=home |
255 | !restart session=new.$random&lang=$clang&old_session=$wims_session&module=home |
256 | !else |
256 | !else |
257 | !setdef $classdef in wimshome/$wims_sesdir/var.stat |
257 | !setdef $classdef in wimshome/$wims_sesdir/var.stat |
258 | !sh cd $wims_home\ |
258 | !sh cd $wims_home\ |
259 | rm -Rf $(wims_sesdir)_*\ |
259 | rm -Rf $(wims_sesdir)_*\ |
260 | mkdir -p log/classes/$class/score $wims_sesdir/getfile\ |
260 | mkdir -p log/classes/$class/score $wims_sesdir/getfile\ |
261 | rm -f $wims_sesdir/exam*\ |
261 | rm -f $wims_sesdir/exam*\ |
262 | rm -f $wims_sesdir/getfile/oefimages\ |
262 | rm -f $wims_sesdir/getfile/oefimages\ |
263 | ln -s $wims_home/log/classes/$class/src/images $wims_sesdir/getfile/oefimages |
263 | ln -s $wims_home/log/classes/$class/src/images $wims_sesdir/getfile/oefimages |
264 | !restart lang=$clang&module=home |
264 | !restart lang=$clang&module=home |
265 | !endif |
265 | !endif |
266 | 266 | ||
267 | :end |
267 | :end |