validate that the admin/reseller has customers in SubDomains.listing(); return all domain fields for admins/resellers in SubDomains.listing()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -727,6 +727,16 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
$customer_ids[] = $customer['customerid'];
|
$customer_ids[] = $customer['customerid'];
|
||||||
$customer_stdsubs[$customer['customerid']] = $customer['standardsubdomain'];
|
$customer_stdsubs[$customer['customerid']] = $customer['standardsubdomain'];
|
||||||
}
|
}
|
||||||
|
if (empty($customer_ids)) {
|
||||||
|
throw new \Exception("Required resource unsatisfied.", 405);
|
||||||
|
}
|
||||||
|
if (empty($customer_stdsubs)) {
|
||||||
|
throw new \Exception("Required resource unsatisfied.", 405);
|
||||||
|
}
|
||||||
|
|
||||||
|
$select_fields = [
|
||||||
|
'`d`.*'
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
if (Settings::IsInList('panel.customer_hide_options', 'domains')) {
|
if (Settings::IsInList('panel.customer_hide_options', 'domains')) {
|
||||||
throw new \Exception("You cannot access this resource", 405);
|
throw new \Exception("You cannot access this resource", 405);
|
||||||
@@ -737,11 +747,27 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
$customer_stdsubs = array(
|
$customer_stdsubs = array(
|
||||||
$this->getUserDetail('customerid') => $this->getUserDetail('standardsubdomain')
|
$this->getUserDetail('customerid') => $this->getUserDetail('standardsubdomain')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$select_fields = [
|
||||||
|
'`d`.`id`',
|
||||||
|
'`d`.`customerid`',
|
||||||
|
'`d`.`domain`',
|
||||||
|
'`d`.`documentroot`',
|
||||||
|
'`d`.`isbinddomain`',
|
||||||
|
'`d`.`isemaildomain`',
|
||||||
|
'`d`.`caneditdomain`',
|
||||||
|
'`d`.`iswildcarddomain`',
|
||||||
|
'`d`.`parentdomainid`',
|
||||||
|
'`d`.`letsencrypt`',
|
||||||
|
'`d`.`registration_date`',
|
||||||
|
'`d`.`termination_date`'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$query_fields = array();
|
$query_fields = array();
|
||||||
|
|
||||||
// prepare select statement
|
// prepare select statement
|
||||||
$domains_stmt = Database::prepare("
|
$domains_stmt = Database::prepare("
|
||||||
SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isbinddomain`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`letsencrypt`, `d`.`termination_date`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias`
|
SELECT " . implode(",", $select_fields) . ", `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias`
|
||||||
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
FROM `" . TABLE_PANEL_DOMAINS . "` `d`
|
||||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
|
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
|
||||||
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id`
|
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id`
|
||||||
|
|||||||
Reference in New Issue
Block a user