fix deleting of Certificates as admin with customer_see_all flag
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -214,7 +214,6 @@ class Certificates extends ApiCommand implements ResourceEntity
|
|||||||
{
|
{
|
||||||
$id = $this->getParam('id');
|
$id = $this->getParam('id');
|
||||||
|
|
||||||
$chk = ($this->isAdmin() && $this->getUserDetail('customers_see_all') == '1') ? true : false;
|
|
||||||
if ($this->isAdmin() == false) {
|
if ($this->isAdmin() == false) {
|
||||||
$chk_stmt = Database::prepare("
|
$chk_stmt = Database::prepare("
|
||||||
SELECT d.domain FROM `" . TABLE_PANEL_DOMAINS . "` d
|
SELECT d.domain FROM `" . TABLE_PANEL_DOMAINS . "` d
|
||||||
@@ -225,16 +224,18 @@ class Certificates extends ApiCommand implements ResourceEntity
|
|||||||
'id' => $id,
|
'id' => $id,
|
||||||
'cid' => $this->getUserDetail('customerid')
|
'cid' => $this->getUserDetail('customerid')
|
||||||
));
|
));
|
||||||
} elseif ($this->isAdmin() && $this->getUserDetail('customers_see_all') == '0') {
|
} elseif ($this->isAdmin()) {
|
||||||
$chk_stmt = Database::prepare("
|
$chk_stmt = Database::prepare("
|
||||||
SELECT d.domain FROM `" . TABLE_PANEL_DOMAINS . "` d
|
SELECT d.domain FROM `" . TABLE_PANEL_DOMAINS . "` d
|
||||||
LEFT JOIN `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` s ON s.domainid = d.id
|
LEFT JOIN `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` s ON s.domainid = d.id
|
||||||
WHERE s.`id` = :id AND d.`adminid` = :aid
|
WHERE s.`id` = :id" . ($this->getUserDetail('customers_see_all') == '0' ? " AND d.`adminid` = :aid" : ""));
|
||||||
");
|
$params = array(
|
||||||
$chk = Database::pexecute_first($chk_stmt, array(
|
'id' => $id
|
||||||
'id' => $id,
|
);
|
||||||
'aid' => $this->getUserDetail('adminid')
|
if ($this->getUserDetail('customers_see_all') == '0') {
|
||||||
));
|
$params['aid'] = $this->getUserDetail('adminid');
|
||||||
|
}
|
||||||
|
$chk = Database::pexecute_first($chk_stmt, $params);
|
||||||
}
|
}
|
||||||
if ($chk !== false) {
|
if ($chk !== false) {
|
||||||
// additional access check by trying to get the certificate
|
// additional access check by trying to get the certificate
|
||||||
|
|||||||
Reference in New Issue
Block a user