From 6c43f1bc563b0515146eb2321a9e29f5bd341b15 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 22 Jan 2020 09:14:07 +0100 Subject: [PATCH] fix Domains.update() if called as admin/reseller without change_serversettings privileges, thx to rseffner Signed-off-by: Michael Kaufmann --- lib/Froxlor/Api/Commands/Domains.php | 2 +- tests/Domains/DomainsTest.php | 22 ++++++++++++++++++++++ tests/IpsAndPorts/IpsAndPortsTest.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index 84e72a53..c9e6dfda 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -1223,7 +1223,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn $writeaccesslog = $result['writeaccesslog']; $writeerrorlog = $result['writeerrorlog']; $documentroot = $result['documentroot']; - + $ssl_protocols = $p_ssl_protocols; $override_tls = $result['override_tls']; } diff --git a/tests/Domains/DomainsTest.php b/tests/Domains/DomainsTest.php index edc65799..f3aa40dc 100644 --- a/tests/Domains/DomainsTest.php +++ b/tests/Domains/DomainsTest.php @@ -135,6 +135,28 @@ class DomainsTest extends TestCase $this->assertEquals(2, $result['subcanemaildomain']); } + /** + * + * @depends testAdminDomainsAdd + */ + public function testResellerDomainsUpdate() + { + global $admin_userdata; + // get reseller + $json_result = Admins::getLocal($admin_userdata, array( + 'loginname' => 'reseller' + ))->get(); + $reseller_userdata = json_decode($json_result, true)['data']; + $reseller_userdata['adminsession'] = 1; + $data = [ + 'domainname' => 'test2.local', + 'ssl_protocols' => 'TLSv1' + ]; + $json_result = Domains::getLocal($reseller_userdata, $data)->update(); + $result = json_decode($json_result, true)['data']; + $this->assertEmpty($result['ssl_protocols']); + } + public function testAdminDomainsAddSysHostname() { global $admin_userdata; diff --git a/tests/IpsAndPorts/IpsAndPortsTest.php b/tests/IpsAndPorts/IpsAndPortsTest.php index 36b1a76f..f5e59614 100644 --- a/tests/IpsAndPorts/IpsAndPortsTest.php +++ b/tests/IpsAndPorts/IpsAndPortsTest.php @@ -246,7 +246,7 @@ class IpsAndPortsTest extends TestCase 'ip' => '123.123.123.123' ]; $this->expectExceptionMessage("You cannot change the last system IP, either create another new IP/Port combination for the system IP or change the system IP."); - $json_result = IpsAndPorts::getLocal($admin_userdata, $data)->update(); + IpsAndPorts::getLocal($admin_userdata, $data)->update(); } public function testResellerIpsAndPortsEditNoDuplicate()