From 9a61a56732466368762dbc18d34e3441aead5d04 Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Sat, 24 Feb 2018 10:57:52 +0100 Subject: [PATCH] enhance phpdoc and add @access to specify which usergroup can use the ApiCommands; add --import-settings parameter to config-services.php CLI script to gain even more automatism when setting up Signed-off-by: Michael Kaufmann (d00p) --- apihelp.php | 27 +++-- install/scripts/config-services.php | 24 ++++ lib/classes/api/commands/class.Admins.php | 30 ++++- lib/classes/api/commands/class.Customers.php | 105 ++++++++++-------- lib/classes/api/commands/class.FpmDaemons.php | 21 ++++ lib/classes/api/commands/class.Froxlor.php | 24 +++- .../api/commands/class.IpsAndPorts.php | 24 +++- lib/classes/api/commands/class.Mysqls.php | 3 + .../api/commands/class.PhpSettings.php | 21 ++++ 9 files changed, 217 insertions(+), 62 deletions(-) diff --git a/apihelp.php b/apihelp.php index deee08d9..bcc3169b 100644 --- a/apihelp.php +++ b/apihelp.php @@ -1,7 +1,7 @@ listFunctions(); } catch (Exception $e) { @@ -48,7 +48,8 @@ foreach ($m_arr as $module) { $output_arr[$module['module']][$module['function']] = array( 'return_type' => (isset($module['return']['type']) && $module['return']['type'] != "" ? $module['return']['type'] : - 1), 'params_list' => array(), - 'head' => $module['head'] + 'head' => $module['head'], + 'access' => isset($module['access']) ? $module['access'] : null ); if (isset($module['params']) && is_array($module['params'])) { @@ -73,12 +74,12 @@ foreach ($output_arr as $module => $functions) { // sort by function ksort($functions); - $apihelp .= "

".$module."



"; + $apihelp .= "

" . $module . "



"; // output ALL the functions foreach ($functions as $function => $funcdata) { $apihelp .= "
"; - $apihelp .= "

".$module." - "; + $apihelp .= "

" . $module . " - "; // description if (strtoupper(substr($funcdata['head'], 0, 5)) == "@TODO") { $apihelp .= ""; @@ -88,8 +89,12 @@ foreach ($output_arr as $module => $functions) { $apihelp .= ""; } $apihelp .= "

"; - $apihelp .= "Command"." "; - $apihelp .= "".$module.".".$function."
"; + $apihelp .= "Command" . " "; + $apihelp .= "" . $module . "." . $function . "
"; + if (isset($funcdata['access']['groups']) && ! empty($funcdata['access']['groups'])) { + $apihelp .= "
Access: "; + $apihelp .= $funcdata['access']['groups'] . "
"; + } // output ALL the params; if (count($funcdata['params_list']) > 0) { @@ -102,15 +107,15 @@ foreach ($output_arr as $module => $functions) { $parms .= "
";
 				// check whether the parameter is optional
 				if (! empty($param['desc']) && strtolower(substr(trim($param['desc']), 0, 8)) == "optional") {
-					$parms .= "".$param['name']."";
+					$parms .= "" . $param['name'] . "";
 					$param['desc'] = substr(trim($param['desc']), 8);
 					if (substr($param['desc'], 0, 1) == ',') {
 						$param['desc'] = substr(trim($param['desc']), 1);
 					}
 				} else {
-					$parms .= "".$param['name']."";
+					$parms .= "" . $param['name'] . "";
 				}
-				$parms .= "
" . (strtolower($param['type']) == 'unknown' ? "unknown" : $param['type']).""; + $parms .= "" . (strtolower($param['type']) == 'unknown' ? "unknown" : $param['type']) . ""; $parms .= ""; if (! empty($param['desc'])) { $parms .= trim($param['desc']); diff --git a/install/scripts/config-services.php b/install/scripts/config-services.php index 69d1b654..1799ec4e 100755 --- a/install/scripts/config-services.php +++ b/install/scripts/config-services.php @@ -43,6 +43,7 @@ class ConfigServicesCmd extends CmdLineHandler public static $params = array( 'create', 'apply', + 'import-settings', 'daemon', 'list-daemons', 'froxlor-dir', @@ -68,6 +69,10 @@ class ConfigServicesCmd extends CmdLineHandler self::println("--daemon\t\tWhen running --apply you can specify a daemon. This will be the only service that gets configured"); self::println("\t\t\tExample: --apply=/path/to/my-config.json --daemon=apache24"); self::println(""); + self::println(""); + self::println("--import-settings\tImport settings from another froxlor installation. This should be done prior to running --apply or alternatively in the same command together."); + self::println("\t\t\tExample: --import-settings=/path/to/Froxlor_settings-[version]-[dbversion]-[date].json"); + self::println(""); self::println("--froxlor-dir\t\tpath to froxlor installation"); self::println("\t\t\tExample: --froxlor-dir=/var/www/froxlor/"); self::println(""); @@ -115,10 +120,15 @@ class Action require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php'; require FROXLOR_INSTALL_DIR . '/lib/functions.php'; require FROXLOR_INSTALL_DIR . '/lib/classes/settings/class.Settings.php'; + require FROXLOR_INSTALL_DIR . '/lib/classes/settings/class.SImExporter.php'; require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigParser.php'; require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigService.php'; require FROXLOR_INSTALL_DIR . '/lib/classes/config/class.ConfigDaemon.php'; + if (array_key_exists("import-settings", $this->_args)) { + $this->_importSettings(); + } + if (array_key_exists("create", $this->_args)) { $this->_createConfig(); } elseif (array_key_exists("apply", $this->_args)) { @@ -128,6 +138,20 @@ class Action } } + private function _importSettings() + { + if (! is_file($this->_args["import-settings"])) { + throw new Exception("Given settings file is not a file"); + } elseif (! file_exists($this->_args["import-settings"])) { + throw new Exception("Given settings file cannot be found ('" . $this->_args["import-settings"] . "')"); + } elseif (! is_readable($this->_args["import-settings"])) { + throw new Exception("Given settings file cannot be read ('" . $this->_args["import-settings"] . "')"); + } + $imp_content = file_get_contents($this->_args["import-settings"]); + SImExporter::import($imp_content); + CmdLineHandler::printsucc("Successfully imported settings from '" . $this->_args["import-settings"] . "'"); + } + private function _createConfig() { $_daemons_config = array( diff --git a/lib/classes/api/commands/class.Admins.php b/lib/classes/api/commands/class.Admins.php index 88ee04e1..a37a894c 100644 --- a/lib/classes/api/commands/class.Admins.php +++ b/lib/classes/api/commands/class.Admins.php @@ -21,6 +21,8 @@ class Admins extends ApiCommand implements ResourceEntity /** * lists all admin entries * + * @access admin + * @throws Exception * @return array count|list */ public function list() @@ -52,7 +54,8 @@ class Admins extends ApiCommand implements ResourceEntity * optional, the admin-id * @param string $loginname * optional, the loginname - * + * + * @access admin * @throws Exception * @return array */ @@ -84,6 +87,13 @@ class Admins extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * create a new admin user + * + * @access admin + * @throws Exception + * @return array + */ public function add() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -290,6 +300,18 @@ class Admins extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * update an admin user by given id or loginname + * + * @param int $id + * optional, the admin-id + * @param string $loginname + * optional, the loginname + * + * @access admin + * @throws Exception + * @return array + */ public function update() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -551,7 +573,8 @@ class Admins extends ApiCommand implements ResourceEntity * optional, the admin-id * @param string $loginname * optional, the loginname - * + * + * @access admin * @throws Exception * @return array */ @@ -619,7 +642,8 @@ class Admins extends ApiCommand implements ResourceEntity * optional, the admin-id * @param string $loginname * optional, the loginname - * + * + * @access admin * @throws Exception * @return array */ diff --git a/lib/classes/api/commands/class.Customers.php b/lib/classes/api/commands/class.Customers.php index 26ae4568..424bdf92 100644 --- a/lib/classes/api/commands/class.Customers.php +++ b/lib/classes/api/commands/class.Customers.php @@ -21,6 +21,7 @@ class Customers extends ApiCommand implements ResourceEntity /** * lists all customer entries * + * @access admin * @return array count|list */ public function list() @@ -61,20 +62,21 @@ class Customers extends ApiCommand implements ResourceEntity * @param string $loginname * optional, the loginname * + * @access admin, customer * @throws Exception * @return array */ public function get() { + $id = $this->getParam('id', true, 0); + $ln_optional = ($id <= 0 ? false : true); + $loginname = $this->getParam('loginname', $ln_optional, ''); + + if ($id <= 0 && empty($loginname)) { + throw new Exception("Either 'id' or 'loginname' parameter must be given", 406); + } + if ($this->isAdmin()) { - $id = $this->getParam('id', true, 0); - $ln_optional = ($id <= 0 ? false : true); - $loginname = $this->getParam('loginname', $ln_optional, ''); - - if ($id <= 0 && empty($loginname)) { - throw new Exception("Either 'id' or 'loginname' parameter must be given", 406); - } - $result_stmt = Database::prepare(" SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE " . ($id > 0 ? "`customerid` = :idln" : "`loginname` = :idln") . ($this->getUserDetail('customers_see_all') ? '' : " AND `adminid` = :adminid")); @@ -84,17 +86,32 @@ class Customers extends ApiCommand implements ResourceEntity if ($this->getUserDetail('customers_see_all') == '0') { $params['adminid'] = $this->getUserDetail('adminid'); } - $result = Database::pexecute_first($result_stmt, $params, true, true); - if ($result) { - $this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] get customer '" . $result['loginname'] . "'"); - return $this->response(200, "successfull", $result); + } else { + if (($id > 0 && $id != $this->getUserDetail('customerid')) || ! empty($loginname) && $loginname != $this->getUserDetail('loginname')) { + throw new Exception("You cannot access data of other customers", 401); } - $key = ($id > 0 ? "id #" . $id : "loginname '" . $loginname . "'"); - throw new Exception("Customer with " . $key . " could not be found", 404); + $result_stmt = Database::prepare(" + SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` + WHERE " . ($id > 0 ? "`customerid` = :idln" : "`loginname` = :idln")); + $params = array( + 'idln' => ($id <= 0 ? $loginname : $id) + ); } - throw new Exception("Not allowed to execute given command.", 403); + $result = Database::pexecute_first($result_stmt, $params, true, true); + if ($result) { + $this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_NOTICE, "[API] get customer '" . $result['loginname'] . "'"); + return $this->response(200, "successfull", $result); + } + $key = ($id > 0 ? "id #" . $id : "loginname '" . $loginname . "'"); + throw new Exception("Customer with " . $key . " could not be found", 404); } + /** + * create a new customer with default ftp-user and standard-subdomain (if wanted) + * + * @access admin + * @return array + */ public function add() { if ($this->isAdmin()) { @@ -236,7 +253,9 @@ class Customers extends ApiCommand implements ResourceEntity ))->get(); $loginname_check = json_decode($dup_check_result, true)['data']; } catch (Exception $e) { - $loginname_check = array('loginname' => ''); + $loginname_check = array( + 'loginname' => '' + ); } // Check if an admin with the loginname already exists @@ -246,7 +265,9 @@ class Customers extends ApiCommand implements ResourceEntity ))->get(); $loginname_check_admin = json_decode($dup_check_result, true)['data']; } catch (Exception $e) { - $loginname_check_admin = array('loginname' => ''); + $loginname_check_admin = array( + 'loginname' => '' + ); } if (strtolower($loginname_check['loginname']) == strtolower($loginname) || strtolower($loginname_check_admin['loginname']) == strtolower($loginname)) { @@ -646,17 +667,29 @@ class Customers extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * update customer entry by either id or loginname + * + * @param int $id + * optional, the customer-id + * @param string $loginname + * optional, the loginname + * + * @access admin, customer + * @throws Exception + * @return array + */ public function update() { if ($this->isAdmin()) { $id = $this->getParam('id', true, 0); $ln_optional = ($id <= 0 ? false : true); $loginname = $this->getParam('loginname', $ln_optional, ''); - + if ($id <= 0 && empty($loginname)) { throw new Exception("Either 'id' or 'loginname' parameter must be given", 406); } - + $json_result = Customers::getLocal($this->getUserData(), array( 'id' => $id, 'loginname' => $loginname @@ -729,36 +762,18 @@ class Customers extends ApiCommand implements ResourceEntity if (Settings::Get('ticket.enabled') != '1') { $tickets = - 1; } - + if (empty($theme)) { $theme = Settings::Get('panel.default_theme'); } - + $diskspace = $diskspace * 1024; $traffic = $traffic * 1024 * 1024; - - if (((($this->getUserDetail('diskspace_used') + $diskspace - $result['diskspace']) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') - || ((($this->getUserDetail('mysqls_used') + $mysqls - $result['mysqls']) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') - || ((($this->getUserDetail('emails_used') + $emails - $result['emails']) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') - || ((($this->getUserDetail('email_accounts_used') + $email_accounts - $result['email_accounts']) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') - || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders - $result['email_forwarders']) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') - || ((($this->getUserDetail('email_quota_used') + $email_quota - $result['email_quota']) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') - || ((($this->getUserDetail('ftps_used') + $ftps - $result['ftps']) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') - || ((($this->getUserDetail('tickets_used') + $tickets - $result['tickets']) > $this->getUserDetail('tickets')) && $this->getUserDetail('tickets') != '-1') - || ((($this->getUserDetail('subdomains_used') + $subdomains - $result['subdomains']) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') - || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') - || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') - || ($emails == '-1' && $this->getUserDetail('emails') != '-1') - || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') - || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') - || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') - || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') - || ($tickets == '-1' && $this->getUserDetail('tickets') != '-1') - || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1') - ) { + + if (((($this->getUserDetail('diskspace_used') + $diskspace - $result['diskspace']) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') || ((($this->getUserDetail('mysqls_used') + $mysqls - $result['mysqls']) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') || ((($this->getUserDetail('emails_used') + $emails - $result['emails']) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') || ((($this->getUserDetail('email_accounts_used') + $email_accounts - $result['email_accounts']) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders - $result['email_forwarders']) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') || ((($this->getUserDetail('email_quota_used') + $email_quota - $result['email_quota']) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ((($this->getUserDetail('ftps_used') + $ftps - $result['ftps']) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') || ((($this->getUserDetail('tickets_used') + $tickets - $result['tickets']) > $this->getUserDetail('tickets')) && $this->getUserDetail('tickets') != '-1') || ((($this->getUserDetail('subdomains_used') + $subdomains - $result['subdomains']) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') || ($emails == '-1' && $this->getUserDetail('emails') != '-1') || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') || ($tickets == '-1' && $this->getUserDetail('tickets') != '-1') || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')) { standard_error('youcantallocatemorethanyouhave', '', true); } - + // Either $name and $firstname or the $company must be inserted if ($name == '' && $company == '') { standard_error(array( @@ -1160,6 +1175,7 @@ class Customers extends ApiCommand implements ResourceEntity * @param bool $delete_userfiles * optional, default false * + * @access admin * @throws Exception * @return array */ @@ -1405,6 +1421,7 @@ class Customers extends ApiCommand implements ResourceEntity * @param string $loginname * optional, the loginname * + * @access admin * @throws Exception * @return array */ @@ -1414,11 +1431,11 @@ class Customers extends ApiCommand implements ResourceEntity $id = $this->getParam('id', true, 0); $ln_optional = ($id <= 0 ? false : true); $loginname = $this->getParam('loginname', $ln_optional, ''); - + if ($id <= 0 && empty($loginname)) { throw new Exception("Either 'id' or 'loginname' parameter must be given", 406); } - + $json_result = Customers::getLocal($this->getUserData(), array( 'id' => $id, 'loginname' => $loginname diff --git a/lib/classes/api/commands/class.FpmDaemons.php b/lib/classes/api/commands/class.FpmDaemons.php index c604e53c..fd7b30fa 100644 --- a/lib/classes/api/commands/class.FpmDaemons.php +++ b/lib/classes/api/commands/class.FpmDaemons.php @@ -21,6 +21,8 @@ class FpmDaemons extends ApiCommand implements ResourceEntity /** * lists all fpm-daemon entries * + * @access admin + * @throws Exception * @return array count|list */ public function list() @@ -72,6 +74,8 @@ class FpmDaemons extends ApiCommand implements ResourceEntity * * @param int $id fpm-daemon-id * + * @access admin + * @throws Exception * @return array */ public function get() @@ -93,6 +97,13 @@ class FpmDaemons extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * create a new fpm-daemon entry + * + * @access admin + * @throws Exception + * @return array + */ public function add() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -166,6 +177,15 @@ class FpmDaemons extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * update a fpm-daemon entry by given id + * + * @param int $id + * + * @access admin + * @throws Exception + * @return array + */ public function update() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -251,6 +271,7 @@ class FpmDaemons extends ApiCommand implements ResourceEntity * * @param int $id fpm-daemon-id * + * @access admin * @throws Exception * @return array */ diff --git a/lib/classes/api/commands/class.Froxlor.php b/lib/classes/api/commands/class.Froxlor.php index 21c0951e..2f61e20c 100644 --- a/lib/classes/api/commands/class.Froxlor.php +++ b/lib/classes/api/commands/class.Froxlor.php @@ -21,6 +21,7 @@ class Froxlor extends ApiCommand /** * checks whether there is a newer version of froxlor available * + * @access admin * @throws Exception * @return string */ @@ -82,6 +83,8 @@ class Froxlor extends ApiCommand /** * * @todo import settings + * + * @access admin */ public function importSettings() {} @@ -89,6 +92,8 @@ class Froxlor extends ApiCommand /** * * @todo export settings to file + * + * @access admin */ public function exportSettings() {} @@ -96,6 +101,8 @@ class Froxlor extends ApiCommand /** * return a list of all settings * + * @access admin + * @throws Exception * @return array count|list */ public function listSettings() @@ -126,6 +133,7 @@ class Froxlor extends ApiCommand * @param string $key * settinggroup.varname couple * + * @access admin * @throws Exception * @return string */ @@ -146,6 +154,7 @@ class Froxlor extends ApiCommand * @param string $value * optional the new value, default is '' * + * @access admin * @throws Exception * @return string */ @@ -153,7 +162,7 @@ class Froxlor extends ApiCommand { // currently not implemented as it required validation too so no wrong settings are being stored via API throw new Exception("Not available yet.", 501); - + if ($this->isAdmin() && $this->getUserDetail('change_serversettings')) { $setting = $this->getParam('key'); $value = $this->getParam('value', true, ''); @@ -173,6 +182,7 @@ class Froxlor extends ApiCommand * @param string $module * optional, return list of functions for a specific module * + * @access admin, customer * @throws Exception * @return array */ @@ -260,7 +270,7 @@ class Froxlor extends ApiCommand 'head' => 'There is no comment-block for "' . $module . '.' . $function . '"' ); } - + $clines = explode("\n", $comment); $result = array(); $result['params'] = array(); @@ -277,6 +287,15 @@ class Froxlor extends ApiCommand 'desc' => (isset($r[3]) ? trim($r['3']) : '') ); $param_desc = true; + } // check access-section + elseif (strpos($c, '@access')) { + preg_match('/^\*\s\@access\s(.*)/', $c, $r); + if (! isset($r[0]) || empty($r[0])) { + $r[1] = 'This function has no restrictions'; + } + $result['access'] = array( + 'groups' => (isset($r[1]) ? trim($r[1]) : '') + ); } // check return-section elseif (strpos($c, '@return')) { preg_match('/^\*\s\@return\s(\w+)(\s.*)?/', $c, $r); @@ -312,6 +331,7 @@ class Froxlor extends ApiCommand } } } + $result['head'] =trim($result['head']); return $result; } catch (\ReflectionException $e) { return array(); diff --git a/lib/classes/api/commands/class.IpsAndPorts.php b/lib/classes/api/commands/class.IpsAndPorts.php index fe0affa0..32ab79a3 100644 --- a/lib/classes/api/commands/class.IpsAndPorts.php +++ b/lib/classes/api/commands/class.IpsAndPorts.php @@ -21,6 +21,8 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity /** * lists all ip/port entries * + * @access admin + * @throws Exception * @return array count|list */ public function list() @@ -48,7 +50,8 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity * * @param int $id * ip-port-id - * + * + * @access admin * @throws Exception * @return array */ @@ -71,6 +74,13 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * create a new ip/port entry + * + * @access admin + * @throws Exception + * @return array + */ public function add() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings')) { @@ -199,6 +209,15 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * update ip/port entry by given id + * + * @param int $id + * + * @access admin + * @throws ErrorException + * @return array + */ public function update() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings')) { @@ -349,7 +368,8 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity * * @param int $id * ip-port-id - * + * + * @access admin * @throws Exception * @return array */ diff --git a/lib/classes/api/commands/class.Mysqls.php b/lib/classes/api/commands/class.Mysqls.php index e55c6651..b7faee12 100644 --- a/lib/classes/api/commands/class.Mysqls.php +++ b/lib/classes/api/commands/class.Mysqls.php @@ -31,6 +31,7 @@ class Mysqls extends ApiCommand implements ResourceEntity * @param int $dbserver * optional, specify database-server, default is none * + * @access admin, customer * @throws Exception * @return array */ @@ -130,6 +131,7 @@ class Mysqls extends ApiCommand implements ResourceEntity * @param string $loginname * optional, admin-only, select dbs of a specific customer by loginname * + * @access admin, customer * @return array count|list */ public function list() @@ -220,6 +222,7 @@ class Mysqls extends ApiCommand implements ResourceEntity * @param int $dbserver * optional, specify database-server, default is none * + * @access admin, customer * @throws Exception * @return array */ diff --git a/lib/classes/api/commands/class.PhpSettings.php b/lib/classes/api/commands/class.PhpSettings.php index db10ac8d..6d26a560 100644 --- a/lib/classes/api/commands/class.PhpSettings.php +++ b/lib/classes/api/commands/class.PhpSettings.php @@ -21,6 +21,8 @@ class PhpSettings extends ApiCommand implements ResourceEntity /** * lists all php-setting entries * + * @access admin + * @throws Exception * @return array count|list */ public function list() @@ -106,6 +108,8 @@ class PhpSettings extends ApiCommand implements ResourceEntity * * @param int $id php-settings-id * + * @access admin + * @throws Exception * @return array */ public function get() @@ -127,6 +131,13 @@ class PhpSettings extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * add new php-settings entry + * + * @access admin + * @throws Exception + * @return array + */ public function add() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -226,6 +237,15 @@ class PhpSettings extends ApiCommand implements ResourceEntity throw new Exception("Not allowed to execute given command.", 403); } + /** + * update a php-setting entry by given id + * + * @param int $id + * + * @access admin + * @throws Exception:: + * @return array + */ public function update() { if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) { @@ -333,6 +353,7 @@ class PhpSettings extends ApiCommand implements ResourceEntity * * @param int $id php-settings-id * + * @access admin * @throws Exception * @return array */