phpdoc for Admins-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -105,7 +105,6 @@ class FroxlorRPC
|
|||||||
// it will recognize non-api classes+methods as valid commands
|
// it will recognize non-api classes+methods as valid commands
|
||||||
$apiclass = FROXLOR_INSTALL_DIR . '/lib/classes/api/commands/class.' . $command[0] . '.php';
|
$apiclass = FROXLOR_INSTALL_DIR . '/lib/classes/api/commands/class.' . $command[0] . '.php';
|
||||||
if (! file_exists($apiclass) || ! @method_exists($command[0], $command[1])) {
|
if (! file_exists($apiclass) || ! @method_exists($command[0], $command[1])) {
|
||||||
// there will be an exception from the autoloader for class_exists hence the try-catch-block
|
|
||||||
throw new Exception("Unknown command", 400);
|
throw new Exception("Unknown command", 400);
|
||||||
}
|
}
|
||||||
return array(
|
return array(
|
||||||
|
|||||||
@@ -86,6 +86,77 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
/**
|
/**
|
||||||
* create a new admin user
|
* create a new admin user
|
||||||
*
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $email
|
||||||
|
* @param string $admin_password
|
||||||
|
* optional, default auto-generated
|
||||||
|
* @param string $def_language
|
||||||
|
* optional, default is system-default language
|
||||||
|
* @param string $custom_notes
|
||||||
|
* optional, default empty
|
||||||
|
* @param bool $custom_notes_show
|
||||||
|
* optional, default false
|
||||||
|
* @param int $diskspace
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $diskspace_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $traffic
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $traffic_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $customers
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $customers_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $domains
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $domains_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $subdomains
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $subdomains_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $emails
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $emails_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_accounts
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_accounts_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_forwarders
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_forwarders_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_quota
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_quota_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $ftps
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $ftps_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $tickets
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $tickets_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $mysqls
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $mysqls_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $customers_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $domains_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $tickets_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $caneditphpsettings
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $change_serversettings
|
||||||
|
* optional, default false
|
||||||
|
* @param array $ipaddress
|
||||||
|
* optional, list of ip-address id's; default -1 (all IP's)
|
||||||
|
*
|
||||||
* @access admin
|
* @access admin
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return array
|
* @return array
|
||||||
@@ -301,6 +372,82 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
* optional, the admin-id
|
* optional, the admin-id
|
||||||
* @param string $loginname
|
* @param string $loginname
|
||||||
* optional, the loginname
|
* optional, the loginname
|
||||||
|
* @param string $name
|
||||||
|
* optional
|
||||||
|
* @param string $email
|
||||||
|
* optional
|
||||||
|
* @param string $admin_password
|
||||||
|
* optional, default auto-generated
|
||||||
|
* @param string $def_language
|
||||||
|
* optional, default is system-default language
|
||||||
|
* @param string $custom_notes
|
||||||
|
* optional, default empty
|
||||||
|
* @param string $theme
|
||||||
|
* optional
|
||||||
|
* @param bool $deactivated
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $custom_notes_show
|
||||||
|
* optional, default false
|
||||||
|
* @param int $diskspace
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $diskspace_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $traffic
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $traffic_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $customers
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $customers_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $domains
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $domains_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $subdomains
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $subdomains_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $emails
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $emails_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_accounts
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_accounts_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_forwarders
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_forwarders_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $email_quota
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $email_quota_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $ftps
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $ftps_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $tickets
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $tickets_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param int $mysqls
|
||||||
|
* optional, default 0
|
||||||
|
* @param bool $mysqls_ul
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $customers_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $domains_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $tickets_see_all
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $caneditphpsettings
|
||||||
|
* optional, default false
|
||||||
|
* @param bool $change_serversettings
|
||||||
|
* optional, default false
|
||||||
|
* @param array $ipaddress
|
||||||
|
* optional, list of ip-address id's; default -1 (all IP's)
|
||||||
*
|
*
|
||||||
* @access admin
|
* @access admin
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -313,7 +460,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
$id = $this->getParam('id', true, 0);
|
$id = $this->getParam('id', true, 0);
|
||||||
$ln_optional = ($id <= 0 ? false : true);
|
$ln_optional = ($id <= 0 ? false : true);
|
||||||
$loginname = $this->getParam('loginname', $ln_optional, '');
|
$loginname = $this->getParam('loginname', $ln_optional, '');
|
||||||
|
|
||||||
$result = $this->apiCall('Admins.get', array(
|
$result = $this->apiCall('Admins.get', array(
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'loginname' => $loginname
|
'loginname' => $loginname
|
||||||
@@ -579,7 +726,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
$id = $this->getParam('id', true, 0);
|
$id = $this->getParam('id', true, 0);
|
||||||
$ln_optional = ($id <= 0 ? false : true);
|
$ln_optional = ($id <= 0 ? false : true);
|
||||||
$loginname = $this->getParam('loginname', $ln_optional, '');
|
$loginname = $this->getParam('loginname', $ln_optional, '');
|
||||||
|
|
||||||
$result = $this->apiCall('Admins.get', array(
|
$result = $this->apiCall('Admins.get', array(
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'loginname' => $loginname
|
'loginname' => $loginname
|
||||||
@@ -598,7 +745,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
Database::pexecute($del_stmt, array(
|
Database::pexecute($del_stmt, array(
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// delete the traffic-usage
|
// delete the traffic-usage
|
||||||
$del_stmt = Database::prepare("
|
$del_stmt = Database::prepare("
|
||||||
DELETE FROM `" . TABLE_PANEL_TRAFFIC_ADMINS . "` WHERE `adminid` = :adminid
|
DELETE FROM `" . TABLE_PANEL_TRAFFIC_ADMINS . "` WHERE `adminid` = :adminid
|
||||||
@@ -606,7 +753,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
Database::pexecute($del_stmt, array(
|
Database::pexecute($del_stmt, array(
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// delete the diskspace usage
|
// delete the diskspace usage
|
||||||
$del_stmt = Database::prepare("
|
$del_stmt = Database::prepare("
|
||||||
DELETE FROM `" . TABLE_PANEL_DISKSPACE_ADMINS . "` WHERE `adminid` = :adminid
|
DELETE FROM `" . TABLE_PANEL_DISKSPACE_ADMINS . "` WHERE `adminid` = :adminid
|
||||||
@@ -614,7 +761,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
Database::pexecute($del_stmt, array(
|
Database::pexecute($del_stmt, array(
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// set admin-id of the old admin's customer to current admins
|
// set admin-id of the old admin's customer to current admins
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
|
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
|
||||||
@@ -624,7 +771,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
'userid' => $this->getUserDetail('adminid'),
|
'userid' => $this->getUserDetail('adminid'),
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// set admin-id of the old admin's domains to current admins
|
// set admin-id of the old admin's domains to current admins
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
|
||||||
@@ -634,7 +781,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
'userid' => $this->getUserDetail('adminid'),
|
'userid' => $this->getUserDetail('adminid'),
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// delete old admin's api keys if exists (no customer keys)
|
// delete old admin's api keys if exists (no customer keys)
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
DELETE FROM `" . TABLE_API_KEYS . "` WHERE
|
DELETE FROM `" . TABLE_API_KEYS . "` WHERE
|
||||||
@@ -643,7 +790,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
Database::pexecute($upd_stmt, array(
|
Database::pexecute($upd_stmt, array(
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
// set admin-id of the old admin's api-keys to current admins
|
// set admin-id of the old admin's api-keys to current admins
|
||||||
$upd_stmt = Database::prepare("
|
$upd_stmt = Database::prepare("
|
||||||
UPDATE `" . TABLE_API_KEYS . "` SET
|
UPDATE `" . TABLE_API_KEYS . "` SET
|
||||||
@@ -653,7 +800,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
|||||||
'userid' => $this->getUserDetail('adminid'),
|
'userid' => $this->getUserDetail('adminid'),
|
||||||
'adminid' => $id
|
'adminid' => $id
|
||||||
), true, true);
|
), true, true);
|
||||||
|
|
||||||
$this->logger()->logAction(ADM_ACTION, LOG_WARNING, "[API] deleted admin '" . $result['loginname'] . "'");
|
$this->logger()->logAction(ADM_ACTION, LOG_WARNING, "[API] deleted admin '" . $result['loginname'] . "'");
|
||||||
updateCounters();
|
updateCounters();
|
||||||
return $this->response(200, "successfull", $result);
|
return $this->response(200, "successfull", $result);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class Froxlor extends ApiCommand
|
|||||||
$reflection = new \ReflectionClass($mod);
|
$reflection = new \ReflectionClass($mod);
|
||||||
$_functions = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
|
$_functions = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC);
|
||||||
foreach ($_functions as $func) {
|
foreach ($_functions as $func) {
|
||||||
if ($func->class == $mod && $func->isPublic()) {
|
if ($func->class == $mod && $func->isPublic() && !$func->isStatic()) {
|
||||||
array_push($functions, array_merge(array(
|
array_push($functions, array_merge(array(
|
||||||
'module' => $matches[1],
|
'module' => $matches[1],
|
||||||
'function' => $func->name
|
'function' => $func->name
|
||||||
|
|||||||
Reference in New Issue
Block a user