File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -147,9 +147,10 @@ function onSubmit() {
147147 }
148148 else {
149149 /*
150- * We edit a existing one, but there is nothing to edit
150+ * We edit a existing one, but domain name can't be changed
151151 */
152- $ this ->dataRecord = $ app ->tform ->getDataRecord ($ this ->id );
152+ $ oldData = $ app ->tform ->getDataRecord ($ this ->id );
153+ $ this ->dataRecord ["domain " ] = $ oldData ["domain " ];
153154 }
154155 } elseif ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
155156 if ($ this ->id == 0 ) {
@@ -199,6 +200,17 @@ function onAfterInsert() {
199200 }
200201 }
201202
203+ function onAfterUpdate () {
204+ global $ app , $ conf ;
205+
206+ // make sure that the record belongs to the client group and not the admin group when admin inserts it
207+ // also make sure that the user can not delete domain created by a admin
208+ if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' && isset ($ this ->dataRecord ["client_group_id " ])) {
209+ $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
210+ $ app ->db ->query ("UPDATE domain SET sys_groupid = $ client_group_id, sys_perm_group = 'ru' WHERE domain_id = " .$ this ->id );
211+ }
212+ }
213+
202214}
203215
204216$ page = new page_action ;
Original file line number Diff line number Diff line change 77 < div class ="ctrlHolder ">
88 < label for ="domain "> {tmpl_var name='domain_txt'}</ label >
99 < tmpl _if name ="edit_disabled ">
10- < input name ="domain " id ="domain " value ="{tmpl_var name='domain'} " size ="30 " maxlength ="255 " type ="text " class ="textInput " disabled =" disabled " />
10+ < input name ="domain " id ="domain " value ="{tmpl_var name='domain'} " size ="30 " maxlength ="255 " type ="text " class ="textInput " readonly =" readonly " />
1111 < tmpl _else >
1212 < input name ="domain " id ="domain " value ="{tmpl_var name='domain'} " size ="30 " maxlength ="255 " type ="text " class ="textInput " />
1313 </ tmpl _if>
1414 </ div >
1515 < div class ="ctrlHolder ">
1616 < label for ="client_group_id "> {tmpl_var name='client_txt'}</ label >
17- < tmpl _if name ="edit_disabled ">
18- < select name ="client_group_id " id ="client_group_id " class ="selectInput " disabled ="disabled ">
19- {tmpl_var name='client_group_id'}
20- </ select >
21- < tmpl _else >
2217 < select name ="client_group_id " id ="client_group_id " class ="selectInput ">
2318 {tmpl_var name='client_group_id'}
2419 </ select >
25- </ tmpl _if>
2620 </ div >
2721 </ fieldset >
2822
You can’t perform that action at this time.
0 commit comments