allow settings/updating documentroot (only relative to customer homedirectory) when change_serversettings permission is not granted; fixes #1000
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -138,6 +138,25 @@ class DomainsTest extends TestCase
|
||||
$this->assertEquals(2, $result['subcanemaildomain']);
|
||||
}
|
||||
|
||||
public function testResellerDomainsAddWithAbsolutePathNoChangeServerSettings()
|
||||
{
|
||||
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 = [
|
||||
'domain' => 'test3.local',
|
||||
'customerid' => 1,
|
||||
'documentroot' => '/some/absolute/directory/the_reseller/cannot/set/',
|
||||
'ipandport' => 4
|
||||
];
|
||||
$this->expectExceptionMessage("The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).");
|
||||
$json_result = Domains::getLocal($reseller_userdata, $data)->add();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testAdminDomainsAdd
|
||||
@@ -161,6 +180,27 @@ class DomainsTest extends TestCase
|
||||
$this->assertEquals('test2.local', $result['domain']);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @depends testResellerDomainsUpdate
|
||||
*/
|
||||
public function testResellerDomainsUpdateAboslutePathNotAllowed()
|
||||
{
|
||||
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',
|
||||
'documentroot' => '/some/other/dir'
|
||||
];
|
||||
$this->expectExceptionMessage("The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).");
|
||||
$json_result = Domains::getLocal($reseller_userdata, $data)->update();
|
||||
}
|
||||
|
||||
public function testAdminDomainsAddSysHostname()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
Reference in New Issue
Block a user