Rev 16518 | Rev 16617 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10372 | bpr | 1 | !!! variables used (to check) : replacelist , up_xx for xx in replacelist and in firstname, lastname |
2 | !!! regvars_cnt techvarlist and ??? |
||
3 | |||
20 | reyssat | 4 | uu=$wims_read_parm |
5 | !if user notwordof $wims_prefix |
||
12555 | bpr | 6 | wims_prefix=$wims_prefix user class |
20 | reyssat | 7 | !endif |
8 | !default up_class=$wims_class |
||
9 | class_type=!defof class_type in wimshome/log/classes/$up_class/.def |
||
10 | !default class_type=0 |
||
11 | !read adm/class/authchars |
||
12 | l=!text select $char_login in $uu |
||
13 | t=!char 1 of $uu |
||
14 | n=!charcnt $l |
||
13295 | bpr | 15 | !if $class_type isin 012 |
12934 | guerimand | 16 | !! and $wims_superclass=$empty notneeded 20180612 FG ? |
12555 | bpr | 17 | regvarlist=!makelist regprop x for x=1 to $regvars_cnt |
18 | regvarlist=!nospace $regvarlist |
||
19 | replacelist=!append item $regvarlist to $replacelist |
||
10381 | guerimand | 20 | !else |
12555 | bpr | 21 | regvarlist=$empty |
10381 | guerimand | 22 | !endif |
10367 | bpr | 23 | |
20 | reyssat | 24 | !if $l!=$uu or $t isin $char_punct or $n<$login_min or $n>$login_max |
12555 | bpr | 25 | !exit |
20 | reyssat | 26 | !endif |
27 | uu=!translate internal . to @ in $uu |
||
5097 | bpr | 28 | login_wims=$uu |
20 | reyssat | 29 | |
12076 | guerimand | 30 | !reset user_lastname,user_firstname,user_password,user_email,user_comments,user_photourl,\ |
16615 | guerimand | 31 | user_exists,user_participate,user_supervise,user_supervisable,user_external_auth,user_mkclass,\ |
32 | user_forcechpwd |
||
10367 | bpr | 33 | !for j in $regvarlist |
12555 | bpr | 34 | !if $(user_$j)!=$empty |
35 | !reset user_$j |
||
36 | !endif |
||
10381 | guerimand | 37 | !next j |
20 | reyssat | 38 | !read adm/class/userdef classes,$up_class,$uu |
16465 | guerimand | 39 | !sh mkdir -p $Userfolder |
20 | reyssat | 40 | !defread $userdef |
41 | |||
42 | !if $class_type isin 24 and $user_exists=yes and \ |
||
14336 | bpr | 43 | (($user_supervisable!=yes and $up_supervisable=yes) or \ |
44 | ($user_supervisable=yes and $up_supervisable!=yes and supervisable \ |
||
45 | isitemof $replacelist)) |
||
12555 | bpr | 46 | bad=!append item $uu to $bad |
47 | !exit |
||
20 | reyssat | 48 | !endif |
49 | |||
50 | !if $class_type isin 13 |
||
5374 | bpr | 51 | !if $class_Supervisor=$wims_realuser |
12072 | guerimand | 52 | !if $class_type=1 and $user_supervisable=yes |
53 | replacelist=!listcomplement supervisable in $replacelist |
||
54 | !else |
||
55 | replacelist=!listcomplement participate,supervisable in $replacelist |
||
56 | !endif |
||
5374 | bpr | 57 | !else |
58 | replacelist=!listcomplement supervise,participate,supervisable in $replacelist |
||
59 | !endif |
||
12069 | guerimand | 60 | |
12555 | bpr | 61 | !! only real supervisor of class (mean : creator) can modify teacher account (very important protection) |
62 | !if $wims_user=supervisor and yes isin $user_supervisable $up_supervisable and $class_Supervisor!=$wims_realuser |
||
63 | bad=!append item $uu to $bad |
||
64 | !exit |
||
65 | !endif |
||
12072 | guerimand | 66 | |
12976 | bpr | 67 | !! creator of class cannot loose manage access |
12555 | bpr | 68 | !if $class_Supervisor=$uu and $wims_class notin $up_supervise |
12070 | guerimand | 69 | up_supervise=!append item $wims_class to $up_supervise |
12555 | bpr | 70 | !endif |
12070 | guerimand | 71 | |
12555 | bpr | 72 | !if $adduser_replace iswordof none nopass and $user_password!=$empty |
73 | !if $wims_user iswordof supervisor $uu |
||
74 | !default up_password=$user_password |
||
75 | !endif |
||
15324 | bpr | 76 | !! both can be already crypten |
12555 | bpr | 77 | p1=!word 1 of $user_password |
78 | p1=!passcrypt $p1 |
||
79 | p2=!word 1 of $up_password |
||
15324 | bpr | 80 | pass_check=!passcheck $p2 and $p1 |
12555 | bpr | 81 | p2=!passcrypt $p2 |
15324 | bpr | 82 | !if $p1!=$p2 and $pass_check!=yes |
12555 | bpr | 83 | bad=!append item $uu to $bad |
84 | !exit |
||
85 | !endif |
||
20 | reyssat | 86 | !endif |
87 | !endif |
||
88 | |||
16518 | guerimand | 89 | !if $wims_mail_hidden=yes and $wims_user=supervisor and $user_supervisable!=yes |
90 | replacelist=!listcomplement email in $replacelist |
||
91 | !endif |
||
92 | |||
4568 | bpr | 93 | !if $user_exists= and email notitemof $replacelist |
12555 | bpr | 94 | replacelist=!append item email to $replacelist |
3714 | bpr | 95 | !endif |
1644 | bpr | 96 | |
20 | reyssat | 97 | up_exists=yes |
98 | !default up_supervisable=$user_supervisable |
||
99 | replace_= |
||
100 | !if $adduser_replace=none |
||
12555 | bpr | 101 | !goto next |
20 | reyssat | 102 | !endif |
5124 | bpr | 103 | !!! |
12076 | guerimand | 104 | !for n in lastname,firstname,email,regnum,comments,exists,supervise,supervisable,participate,photourl,\ |
10372 | bpr | 105 | external_auth,agreecgu,$regvarlist,$techvarlist |
10381 | guerimand | 106 | !if $n isitemof $replacelist,lastname,firstname,exists,supervisable,agreecgu,external_auth |
7795 | bpr | 107 | l_=!singlespace $(up_$n) |
12555 | bpr | 108 | !if $n=comments |
14336 | bpr | 109 | !readproc adm/class/mkcomment name |
110 | !let vname=$n$scriptout |
||
13295 | bpr | 111 | !else |
14336 | bpr | 112 | !let vname=$n |
7795 | bpr | 113 | !endif |
13295 | bpr | 114 | !if ($(up_$n)!=$empty or $n=photourl) and $(up_$n)!=$(user_$vname) |
115 | l_=!singlespace $(up_$n) |
||
116 | !if $l_ issametext |
||
117 | l_= |
||
118 | !endif |
||
119 | !if $n iswordof participate supervise |
||
120 | l_=!words2items $l_ |
||
121 | l__= |
||
122 | !for a_ in $l_ |
||
123 | part_=!text select 1234567890/ in $a_ |
||
124 | part_test=!replace internal / by , in $part_ |
||
125 | !if $(part_test[1])=$wims_class or $(part_test[1])=$wims_superclass |
||
126 | l__=!append item $part_ to $l__ |
||
127 | !endif |
||
128 | !next a_ |
||
129 | !if $n iswordof participate |
||
130 | !if $user_supervisable!=yes |
||
131 | l_=!listuniq $l__,$(user_$n) |
||
132 | !endif |
||
133 | !else |
||
134 | l_=!listuniq $l__ |
||
12555 | bpr | 135 | !endif |
13295 | bpr | 136 | !else |
137 | !if techvar isin $n |
||
138 | !!!FIXME add a test for validity or add the value to the possible values |
||
12555 | bpr | 139 | !endif |
13295 | bpr | 140 | !!FIXME one can do l_=!detag $l ??? |
141 | !if $n isitemof $regvarlist |
||
142 | l_=!detag $l_ |
||
143 | !endif |
||
144 | l_=!replace , by , in $l_ |
||
145 | l_=!replace < by < in $l_ |
||
146 | l_=!translate internal "#*!$$ to $.....$ in $l_ |
||
12555 | bpr | 147 | !endif |
13295 | bpr | 148 | !if $n isitemof comments,photourl,$regvarlist |
149 | l_=!char 1 to 5000 of $l_ |
||
1640 | bpr | 150 | !else |
13295 | bpr | 151 | !if $n iswordof participate supervise |
152 | l_=!char 1 to 500 of $l_ |
||
153 | !else |
||
154 | l_=!char 1 to 100 of $l_ |
||
155 | !endif |
||
1640 | bpr | 156 | !endif |
13295 | bpr | 157 | replace_=!append line !set user_$(vname)=$l_ to $replace_ |
7795 | bpr | 158 | !endif |
20 | reyssat | 159 | !endif |
160 | !next n |
||
7403 | bpr | 161 | |
20 | reyssat | 162 | !if $user_exists!=yes and \ |
14336 | bpr | 163 | ($up_password=$empty or $up_lastname=$empty or $up_firstname=$empty) |
13295 | bpr | 164 | bad=!append item $uu to $bad |
12555 | bpr | 165 | !exit |
20 | reyssat | 166 | !endif |
167 | |||
168 | :next |
||
12944 | czzmrn | 169 | !! verification of user_participate and sharing (needed for teachers in order to register as student) |
12976 | bpr | 170 | !if $class_type isin 13 and $up_class notitemof $user_participate |
171 | typename=!defof class_typename in wimshome/log/classes/$up_class/.def |
||
12555 | bpr | 172 | !if $typename != $empty and $typename notwordof class course |
173 | bad=!append item $uu to $bad |
||
174 | !exit |
||
20 | reyssat | 175 | !endif |
12555 | bpr | 176 | !if $typename issametext course |
177 | typename=!defof class_typename in wimshome/log/classes/$wims_class/.def |
||
178 | !if $wims_class!=$empty and $typename issametext course and \ |
||
14336 | bpr | 179 | $wims_class=$up_class and $wims_user=supervisor |
12555 | bpr | 180 | au_1=!translate internal / to , in $wims_class |
181 | au_1=!translate internal , to / in $(au_1[1..-2]) |
||
182 | au_1=!nospace $au_1 |
||
183 | up_class=$au_1 |
||
184 | typename=!defof class_typename in wimshome/log/classes/$au_1/.def |
||
185 | !endif |
||
13211 | bpr | 186 | !!case of program occurs in case of an intercourse |
187 | !if $wims_class=$empty or $typename notwordof class program or \ |
||
14336 | bpr | 188 | ../$wims_superclass/ notin ../$up_class |
12555 | bpr | 189 | !exit |
190 | !endif |
||
191 | user_class=!replace internal ../$wims_superclass/ by in ../$wims_class |
||
192 | user_course=!replace internal ../$wims_superclass/ by in ../$up_class |
||
193 | au_test=!defof user_class in wimshome/log/classes/$up_class/.users/$uu |
||
194 | !if $au_test!=$empty |
||
195 | au_test=$wims_superclass/$au_test |
||
196 | user_courses=!getdef user_courses in wimshome/log/classes/$au_test/.users/$uu |
||
197 | user_courses=!listcomplement $user_course in $user_courses |
||
198 | !setdef !set user_courses=$user_courses in wimshome/log/classes/$au_test/.users/$uu |
||
199 | !endif |
||
200 | !setdef !set user_class=$user_class in wimshome/log/classes/$up_class/.users/$uu |
||
201 | user_courses=!getdef user_courses in wimshome/log/classes/$wims_class/.users/$uu |
||
202 | user_courses=!listunion $user_courses and $user_course |
||
203 | !setdef !set user_courses=$user_courses in wimshome/log/classes/$wims_class/.users/$uu |
||
204 | change=!listunion $change and $uu |
||
205 | !else |
||
206 | !!if participate isitemof $replace_list |
||
207 | !!change up_participate here |
||
208 | up_participate=!listunion $user_participate and $up_class |
||
209 | shclass=!defof sharing_user in wimshome/log/classes/$up_class/neighbors |
||
210 | !default shclass=$up_class |
||
211 | sharing=!defof sharable_user in wimshome/log/classes/$shclass/neighbors |
||
212 | sharing=!append item $shclass to $sharing |
||
213 | sharing=!listcomplement $up_participate in $sharing |
||
214 | !if $sharing!=$empty |
||
215 | !for sh in $sharing |
||
216 | test=!defof class_superclass in wimshome/log/classes/$sh/.def |
||
217 | !if $test!=$empty and $test=$wims_superclass |
||
218 | up_participate=!append item $sh to $up_participate |
||
219 | !endif |
||
220 | !next sh |
||
221 | !endif |
||
222 | !if $user_exists=yes |
||
223 | !setdef !set user_participate=$up_participate in $userdef |
||
224 | change=!listunion $change and $uu |
||
225 | !else |
||
15676 | obado | 226 | replace_=!append line !set user_participate=$up_participate to $replace_ |
20 | reyssat | 227 | !endif |
12555 | bpr | 228 | !endif |
20 | reyssat | 229 | !endif |
230 | |||
231 | !if $adduser_replace=none |
||
12555 | bpr | 232 | !exit |
20 | reyssat | 233 | !endif |
234 | |||
235 | !if $up_password!=$empty and $up_password!=$user_password |
||
12555 | bpr | 236 | c=!char 1 of $up_password |
237 | !if $c=* and $wims_priv_cryptpass=allow |
||
238 | p=!text select */$char_passwd in $up_password |
||
239 | !else |
||
240 | p=!text select $char_passwd in $up_password |
||
241 | !endif |
||
242 | n=!charcnt $p |
||
243 | !if $p!=$up_password or $n<$passwd_min or $n>$passwd_max |
||
244 | bad=!append item $uu to $bad |
||
245 | !exit |
||
246 | !endif |
||
247 | up_password=!passcrypt $up_password |
||
248 | replace_=!append line !set user_password=$up_password to $replace_ |
||
20 | reyssat | 249 | !endif |
250 | |||
16615 | guerimand | 251 | !bound up_forcechpwd within no,yes default no |
252 | replace_=!append line !set user_forcechpwd=$up_forcechpwd to $replace_ |
||
253 | |||
20 | reyssat | 254 | !if $up_vars!=$empty |
255 | up_vars=!nonempty lines $up_vars |
||
256 | up_vars=!replace internal ! by ! in $up_vars |
||
157 | bpr | 257 | up_vars=!rows2lines $up_vars |
10022 | guerimand | 258 | up_vars=!replace internal = by , in $up_vars |
259 | !if $tv_varfilterreaden!=yes |
||
12555 | bpr | 260 | !readproc adm/vfilter/listvarfilter.proc |
10022 | guerimand | 261 | !endif |
20 | reyssat | 262 | n=!linecnt $up_vars |
263 | !for i=1 to $n |
||
12555 | bpr | 264 | llll=!line $i of $up_vars |
265 | llll=!trim $llll |
||
266 | !distribute item $llll into nv_,vv_ |
||
267 | !if $nv_ isitemof $tv_listname |
||
14336 | bpr | 268 | po_=!positionof item $nv_ in $tv_listname |
12555 | bpr | 269 | !if $po_ isitemof $tv_listlocal |
14336 | bpr | 270 | p_=!line $po_ of $tv_listtechvar |
271 | val_=!record $(p_[3]) of wimshome/log/classes/$(p_[2])/.techvar |
||
272 | val_=!line 2 of $val_ |
||
273 | t_=!item $po_ of $tv_listcode |
||
274 | !bound vv_ within $val_,$empty default $empty |
||
275 | replace_=!append line !set user_techvar_$(t_)=$vv_ to $replace_ |
||
276 | !endif |
||
12555 | bpr | 277 | !endif |
20 | reyssat | 278 | !next i |
279 | !endif |
||
10384 | bpr | 280 | !!FIXME even if there is no change in user_techvar, it is changed |
281 | !! and add to the list of users. |
||
12056 | guerimand | 282 | |
16250 | guerimand | 283 | !if $class_type=2 and $user_mkclass!=$up_mkclass and $user_supervisable=yes |
284 | !bound up_mkclass within yes,no default yes |
||
285 | replace_=!append line !set user_mkclass=$up_mkclass to $replace_ |
||
286 | !endif |
||
287 | |||
288 | |||
20 | reyssat | 289 | !if $replace_=$empty |
12555 | bpr | 290 | !exit |
20 | reyssat | 291 | !endif |
292 | |||
293 | change=!listunion $change and $uu |
||
294 | |||
295 | !setdef $replace_ in $userdef |
||
296 | |||
297 | !if $up_class=$wims_class |
||
12555 | bpr | 298 | wims_class_log=User info $uu |
20 | reyssat | 299 | !endif |