fixed deletion of default-ftp-user possible via API (not through the interface though); refs #741
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -541,6 +541,9 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
"username" => $customer_data['loginname']
|
||||
);
|
||||
Database::pexecute($stmt, $params, true, true);
|
||||
} else {
|
||||
// do not allow removing default ftp-account
|
||||
\Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount', '', true);
|
||||
}
|
||||
|
||||
// remove all quotatallies
|
||||
|
||||
@@ -277,4 +277,21 @@ class FtpsTest extends TestCase
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals('test1ftp2', $result['username']);
|
||||
}
|
||||
|
||||
public function testCustomerFtpsDeleteDefaultUser()
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
// get customer
|
||||
$json_result = Customers::getLocal($admin_userdata, array(
|
||||
'loginname' => 'test1'
|
||||
))->get();
|
||||
$customer_userdata = json_decode($json_result, true)['data'];
|
||||
$data = [
|
||||
'username' => 'test1'
|
||||
];
|
||||
$this->expectExceptionCode(400);
|
||||
$this->expectExceptionMessage('You cannot delete your main FTP account');
|
||||
Ftps::getLocal($customer_userdata, $data)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user