fix Domains.update() if called as admin/reseller without change_serversettings privileges, thx to rseffner

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2020-01-22 09:14:07 +01:00
parent 2e273a41b5
commit 6c43f1bc56
3 changed files with 24 additions and 2 deletions

View File

@@ -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'];
}

View File

@@ -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;

View File

@@ -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()