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