Skip to content

Commit 723dd04

Browse files
committed
Fixed: FS#699 - Bug: Change Client of DNS entry
1 parent 56f1f4f commit 723dd04

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

interface/web/dns/dns_soa_edit.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)