File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -221,13 +221,23 @@ function onBeforeUpdate() {
221221 //* Check if the server has been changed
222222 // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
223223 if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' || $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
224- $ rec = $ app ->db ->queryOneRecord ("SELECT server_id from mail_domain WHERE domain_id = " .$ this ->id );
224+ $ rec = $ app ->db ->queryOneRecord ("SELECT server_id, domain from mail_domain WHERE domain_id = " .$ this ->id );
225225 if ($ rec ['server_id ' ] != $ this ->dataRecord ["server_id " ]) {
226226 //* Add a error message and switch back to old server
227227 $ app ->tform ->errorMessage .= $ app ->lng ('The Server can not be changed. ' );
228228 $ this ->dataRecord ["server_id " ] = $ rec ['server_id ' ];
229229 }
230230 unset($ rec );
231+ //* If the user is neither admin nor reseller
232+ } else {
233+ //* We do not allow users to change a domain which has been created by the admin
234+ $ rec = $ app ->db ->queryOneRecord ("SELECT domain from mail_domain WHERE domain_id = " .$ this ->id );
235+ if ($ rec ['domain ' ] != $ this ->dataRecord ["domain " ] && $ app ->tform ->checkPerm ($ this ->id ,'u ' )) {
236+ //* Add a error message and switch back to old server
237+ $ app ->tform ->errorMessage .= $ app ->lng ('The Domain can not be changed. Please ask your Administrator if you want to change the domain name. ' );
238+ $ this ->dataRecord ["domain " ] = $ rec ['domain ' ];
239+ }
240+ unset($ rec );
231241 }
232242 }
233243
Original file line number Diff line number Diff line change @@ -294,6 +294,16 @@ function onBeforeUpdate () {
294294 }
295295 unset($ rec );
296296 }
297+ //* If the user is neither admin nor reseller
298+ } else {
299+ //* We do not allow users to change a domain which has been created by the admin
300+ $ rec = $ app ->db ->queryOneRecord ("SELECT domain from web_domain WHERE domain_id = " .$ this ->id );
301+ if (isset ($ this ->dataRecord ["domain " ]) && $ rec ['domain ' ] != $ this ->dataRecord ["domain " ] && $ app ->tform ->checkPerm ($ this ->id ,'u ' )) {
302+ //* Add a error message and switch back to old server
303+ $ app ->tform ->errorMessage .= $ app ->lng ('The Domain can not be changed. Please ask your Administrator if you want to change the domain name. ' );
304+ $ this ->dataRecord ["domain " ] = $ rec ['domain ' ];
305+ }
306+ unset($ rec );
297307 }
298308
299309 //* Check that all fields for the SSL cert creation are filled
You can’t perform that action at this time.
0 commit comments