From eef23e330a01673ff81698dcdaffa6d08b072add Mon Sep 17 00:00:00 2001 From: Kordian Bruck Date: Thu, 26 Apr 2018 11:53:10 +0200 Subject: [PATCH 1/2] Allow for serial to be increased when deleting any record in the zone --- interface/lib/classes/remote.d/dns.inc.php | 33 ++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php index 66e9d988ff..16f8ea786f 100644 --- a/interface/lib/classes/remote.d/dns.inc.php +++ b/interface/lib/classes/remote.d/dns.inc.php @@ -324,13 +324,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_aaaa_delete($session_id, $primary_id) + public function dns_aaaa_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -374,13 +375,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_a_delete($session_id, $primary_id) + public function dns_a_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_a_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -424,13 +426,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_alias_delete($session_id, $primary_id) + public function dns_alias_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_alias_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -474,13 +477,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_cname_delete($session_id, $primary_id) + public function dns_cname_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_cname_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -524,13 +528,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_hinfo_delete($session_id, $primary_id) + public function dns_hinfo_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -574,13 +579,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_mx_delete($session_id, $primary_id) + public function dns_mx_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_mx_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -624,13 +630,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_ns_delete($session_id, $primary_id) + public function dns_ns_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_ns_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -674,13 +681,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_ptr_delete($session_id, $primary_id) + public function dns_ptr_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_ptr_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -724,13 +732,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_rp_delete($session_id, $primary_id) + public function dns_rp_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_rp_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -774,13 +783,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_srv_delete($session_id, $primary_id) + public function dns_srv_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_srv_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -824,13 +834,14 @@ class remoting_dns extends remoting { } //* Delete a record - public function dns_txt_delete($session_id, $primary_id) + public function dns_txt_delete($session_id, $primary_id, $update_serial=false) { if(!$this->checkPerm($session_id, 'dns_txt_delete')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } $affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php', $primary_id); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } -- GitLab From 5ad41e51f640abf7ff0300e462f0a7d0991f5d36 Mon Sep 17 00:00:00 2001 From: Kordian Bruck Date: Thu, 26 Apr 2018 17:07:25 +0200 Subject: [PATCH 2/2] Simplify boolean condition --- interface/lib/classes/remote.d/dns.inc.php | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php index 16f8ea786f..9938d7543b 100644 --- a/interface/lib/classes/remote.d/dns.inc.php +++ b/interface/lib/classes/remote.d/dns.inc.php @@ -307,7 +307,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_aaaa.tform.php', $client_id, $params); } @@ -319,7 +319,7 @@ class remoting_dns extends remoting { return false; } $affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php', $client_id, $primary_id, $params); - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $affected_rows; } @@ -358,7 +358,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_a.tform.php', $client_id, $params); } @@ -369,7 +369,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -409,7 +409,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_alias.tform.php', $client_id, $params); } @@ -420,7 +420,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -460,7 +460,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_cname.tform.php', $client_id, $params); } @@ -471,7 +471,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -511,7 +511,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_hinfo.tform.php', $client_id, $params); } @@ -522,7 +522,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -562,7 +562,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_mx.tform.php', $client_id, $params); } @@ -573,7 +573,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -613,7 +613,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_ns.tform.php', $client_id, $params); } @@ -624,7 +624,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -664,7 +664,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_ptr.tform.php', $client_id, $params); } @@ -675,7 +675,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -715,7 +715,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_rp.tform.php', $client_id, $params); } @@ -726,7 +726,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -766,7 +766,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_srv.tform.php', $client_id, $params); } @@ -777,7 +777,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php', $client_id, $primary_id, $params); return $affected_rows; } @@ -817,7 +817,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); return $this->insertQuery('../dns/form/dns_txt.tform.php', $client_id, $params); } @@ -828,7 +828,7 @@ class remoting_dns extends remoting { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if($update_serial != false) $this->increase_serial($session_id, $client_id, $params); + if($update_serial) $this->increase_serial($session_id, $client_id, $params); $affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php', $client_id, $primary_id, $params); return $affected_rows; } -- GitLab