unify customerid/loginname api-parameter-descriptions; fixes #883
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -52,7 +52,9 @@ class CustomerBackups extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
|
|||||||
* @param bool $backup_web
|
* @param bool $backup_web
|
||||||
* optional whether to backup web-data, default is 0 (false)
|
* optional whether to backup web-data, default is 0 (false)
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
* add options for a given directory
|
* add options for a given directory
|
||||||
*
|
*
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* path relative to the customer's home-Directory
|
* path relative to the customer's home-Directory
|
||||||
* @param bool $options_indexes
|
* @param bool $options_indexes
|
||||||
@@ -198,9 +198,9 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* id of dir-protection entry
|
* id of dir-protection entry
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param bool $options_indexes
|
* @param bool $options_indexes
|
||||||
* optional, activate directory-listing for this path, default 0 (false)
|
* optional, activate directory-listing for this path, default 0 (false)
|
||||||
* @param bool $options_cgi
|
* @param bool $options_cgi
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res
|
|||||||
* add htaccess protection to a given directory
|
* add htaccess protection to a given directory
|
||||||
*
|
*
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string $username
|
* @param string $username
|
||||||
* @param string $directory_password
|
* @param string $directory_password
|
||||||
@@ -187,9 +187,9 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res
|
|||||||
* @param string $username
|
* @param string $username
|
||||||
* optional, the username
|
* optional, the username
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param string $directory_password
|
* @param string $directory_password
|
||||||
* optional, leave empty for no change
|
* optional, leave empty for no change
|
||||||
* @param string $directory_authname
|
* @param string $directory_authname
|
||||||
|
|||||||
@@ -199,6 +199,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
* @param string $domain
|
* @param string $domain
|
||||||
* domain-name
|
* domain-name
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param int $adminid
|
* @param int $adminid
|
||||||
* optional, default is the calling admin's ID
|
* optional, default is the calling admin's ID
|
||||||
* @param array $ipandport
|
* @param array $ipandport
|
||||||
@@ -297,7 +300,6 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
|
|
||||||
// parameters
|
// parameters
|
||||||
$p_domain = $this->getParam('domain');
|
$p_domain = $this->getParam('domain');
|
||||||
$customerid = intval($this->getParam('customerid'));
|
|
||||||
|
|
||||||
// optional parameters
|
// optional parameters
|
||||||
$p_ipandports = $this->getParam('ipandport', true, explode(',', Settings::Get('system.defaultip')));
|
$p_ipandports = $this->getParam('ipandport', true, explode(',', Settings::Get('system.defaultip')));
|
||||||
@@ -377,9 +379,8 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
), '', true);
|
), '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$customer = $this->apiCall('Customers.get', array(
|
$customer = $this->getCustomerData();
|
||||||
'id' => $customerid
|
$customerid = $customer['customerid'];
|
||||||
));
|
|
||||||
|
|
||||||
if ($this->getUserDetail('customers_see_all') == '1' && $adminid != $this->getUserDetail('adminid')) {
|
if ($this->getUserDetail('customers_see_all') == '1' && $adminid != $this->getUserDetail('adminid')) {
|
||||||
$admin_stmt = Database::prepare("
|
$admin_stmt = Database::prepare("
|
||||||
@@ -844,7 +845,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
* @param string $domainname
|
* @param string $domainname
|
||||||
* optional, the domainname
|
* optional, the domainname
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional customer-id
|
* required (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* required (if $customerid is not specified)
|
||||||
* @param int $adminid
|
* @param int $adminid
|
||||||
* optional, default is the calling admin's ID
|
* optional, default is the calling admin's ID
|
||||||
* @param array $ipandport
|
* @param array $ipandport
|
||||||
@@ -952,9 +955,18 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
|
|
||||||
// optional parameters
|
// optional parameters
|
||||||
$p_ipandports = $this->getParam('ipandport', true, array());
|
$p_ipandports = $this->getParam('ipandport', true, array());
|
||||||
$customerid = intval($this->getParam('customerid', true, $result['customerid']));
|
|
||||||
$adminid = intval($this->getParam('adminid', true, $result['adminid']));
|
$adminid = intval($this->getParam('adminid', true, $result['adminid']));
|
||||||
|
|
||||||
|
if ($this->getParam('customerid', true, 0) == 0 && $this->getParam('loginname', true, '') == '') {
|
||||||
|
$customerid = $result['customerid'];
|
||||||
|
$customer = $this->apiCall('Customers.get', array(
|
||||||
|
'id' => $customerid
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
$customer = $this->getCustomerData();
|
||||||
|
$customerid = $customer['customerid'];
|
||||||
|
}
|
||||||
|
|
||||||
$subcanemaildomain = $this->getParam('subcanemaildomain', true, $result['subcanemaildomain']);
|
$subcanemaildomain = $this->getParam('subcanemaildomain', true, $result['subcanemaildomain']);
|
||||||
$isemaildomain = $this->getBoolParam('isemaildomain', true, $result['isemaildomain']);
|
$isemaildomain = $this->getBoolParam('isemaildomain', true, $result['isemaildomain']);
|
||||||
$email_only = $this->getBoolParam('email_only', true, $result['email_only']);
|
$email_only = $this->getBoolParam('email_only', true, $result['email_only']);
|
||||||
@@ -1085,13 +1097,6 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
|||||||
if (empty($customer) || $customer['customerid'] != $customerid) {
|
if (empty($customer) || $customer['customerid'] != $customerid) {
|
||||||
\Froxlor\UI\Response::standard_error('customerdoesntexist', '', true);
|
\Froxlor\UI\Response::standard_error('customerdoesntexist', '', true);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$customerid = $result['customerid'];
|
|
||||||
|
|
||||||
// get customer
|
|
||||||
$customer = $this->apiCall('Customers.get', array(
|
|
||||||
'id' => $customerid
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle change of admin (move domain from admin to admin)
|
// handle change of admin (move domain from admin to admin)
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional email-address to add the account for
|
* optional email-address to add the account for
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param string $email_password
|
* @param string $email_password
|
||||||
* password for the account
|
* password for the account
|
||||||
* @param string $alternative_email
|
* @param string $alternative_email
|
||||||
@@ -295,9 +295,9 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to update
|
* optional, the email-address to update
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param int $email_quota
|
* @param int $email_quota
|
||||||
* optional, update quota
|
* optional, update quota
|
||||||
* @param string $email_password
|
* @param string $email_password
|
||||||
@@ -418,9 +418,9 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to delete the account for
|
* optional, the email-address to delete the account for
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param bool $delete_userfiles
|
* @param bool $delete_userfiles
|
||||||
* optional, default false
|
* optional, default false
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ class EmailForwarders extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to add the forwarder for
|
* optional, the email-address to add the forwarder for
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
* email-address to add as forwarder
|
* email-address to add as forwarder
|
||||||
*
|
*
|
||||||
@@ -221,9 +221,9 @@ class EmailForwarders extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address to delete the forwarder from
|
* optional, the email-address to delete the forwarder from
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param int $forwarderid
|
* @param int $forwarderid
|
||||||
* id of the forwarder to delete
|
* id of the forwarder to delete
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param boolean $iscatchall
|
* @param boolean $iscatchall
|
||||||
* optional, make this address a catchall address, default: no
|
* optional, make this address a catchall address, default: no
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@@ -190,9 +190,9 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address
|
* optional, the email-address
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param boolean $iscatchall
|
* @param boolean $iscatchall
|
||||||
* optional
|
* optional
|
||||||
*
|
*
|
||||||
@@ -352,9 +352,9 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param string $emailaddr
|
* @param string $emailaddr
|
||||||
* optional, the email-address
|
* optional, the email-address
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param boolean $delete_userfiles
|
* @param boolean $delete_userfiles
|
||||||
* optional, delete email data from filesystem, default: 0 (false)
|
* optional, delete email data from filesystem, default: 0 (false)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
|||||||
* @param string $ftp_domain
|
* @param string $ftp_domain
|
||||||
* optional if customer.ftpatdomain is allowed, specify a domain (customer must be owner)
|
* optional if customer.ftpatdomain is allowed, specify a domain (customer must be owner)
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
* @param array $additional_members
|
* @param array $additional_members
|
||||||
* optional whether to add additional usernames to the group
|
* optional whether to add additional usernames to the group
|
||||||
* @param bool $is_defaultuser
|
* @param bool $is_defaultuser
|
||||||
@@ -351,7 +353,9 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
|||||||
* @param string $shell
|
* @param string $shell
|
||||||
* optional, default /bin/false (not changeable when deactivated)
|
* optional, default /bin/false (not changeable when deactivated)
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param bool $sendinfomail
|
* @param bool $sendinfomail
|
||||||
* optional, send created resource-information to customer, default: false
|
* optional, send created resource-information to customer, default: false
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@@ -278,9 +278,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param string $description
|
* @param string $description
|
||||||
* optional, description for database
|
* optional, description for database
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@@ -462,9 +462,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
|||||||
* @param int $mysql_server
|
* @param int $mysql_server
|
||||||
* optional, specify database-server, default is none
|
* optional, specify database-server, default is none
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* optional, admin-only, the customer-id
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, admin-only, the loginname
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
* @param bool $hsts_preload
|
* @param bool $hsts_preload
|
||||||
* optional whether or not to preload HSTS header value, default 0
|
* optional whether or not to preload HSTS header value, default 0
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@@ -470,7 +472,9 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
* @param bool $hsts_preload
|
* @param bool $hsts_preload
|
||||||
* optional whether or not to preload HSTS header value
|
* optional whether or not to preload HSTS header value
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@@ -876,7 +880,9 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
|||||||
* @param string $domainname
|
* @param string $domainname
|
||||||
* optional, the domainname
|
* optional, the domainname
|
||||||
* @param int $customerid
|
* @param int $customerid
|
||||||
* required when called as admin, not needed when called as customer
|
* optional, required when called as admin (if $loginname is not specified)
|
||||||
|
* @param string $loginname
|
||||||
|
* optional, required when called as admin (if $customerid is not specified)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ class DomainsTest extends TestCase
|
|||||||
'customerid' => $customer_userdata['customerid'] + 1
|
'customerid' => $customer_userdata['customerid'] + 1
|
||||||
];
|
];
|
||||||
Settings::Set('panel.allow_domain_change_customer', 1);
|
Settings::Set('panel.allow_domain_change_customer', 1);
|
||||||
$this->expectExceptionMessage("The customer you have chosen doesn't exist.");
|
$this->expectExceptionMessage("Customer with id #2 could not be found");
|
||||||
Domains::getLocal($admin_userdata, $data)->update();
|
Domains::getLocal($admin_userdata, $data)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user