File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,18 @@ function onAfterUpdate() {
175175 // And we want to update all rr records too, that belong to this record
176176 $ app ->db ->query ("UPDATE dns_rr SET sys_groupid = $ client_group_id WHERE zone = " .$ this ->id );
177177 }
178+
179+ //** When the client group has changed, change also the owner of the record if the owner is not the admin user
180+ if ($ this ->oldDataRecord ["client_group_id " ] != $ this ->dataRecord ["client_group_id " ] && $ this ->dataRecord ["sys_userid " ] != 1 ) {
181+ $ client_group_id = intval ($ this ->dataRecord ["client_group_id " ]);
182+ $ tmp = $ app ->db ->queryOneREcord ("SELECT userid FROM sys_user WHERE default_group = " .$ client_group_id );
183+ if ($ tmp ["userid " ] > 0 ) {
184+ $ app ->db ->query ("UPDATE dns_soa SET sys_userid = " .$ tmp ["userid " ]." WHERE id = " .$ this ->id );
185+ $ app ->db ->query ("UPDATE dns_rr SET sys_userid = " .$ tmp ["userid " ]." WHERE zone = " .$ this ->id );
186+ }
187+
188+ }
189+
178190 }
179191
180192}
You can’t perform that action at this time.
0 commit comments