list() is a reserved php keyword, changed ApiCommand::list() to ApiCommand::listing()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -30,7 +30,7 @@ if ($page == 'overview') {
|
||||
if ($action == '') {
|
||||
|
||||
try {
|
||||
$json_result = PhpSettings::getLocal($userinfo)->list();
|
||||
$json_result = PhpSettings::getLocal($userinfo)->listing();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
}
|
||||
@@ -173,7 +173,7 @@ if ($page == 'overview') {
|
||||
if ($action == '') {
|
||||
|
||||
try {
|
||||
$json_result = FpmDaemons::getLocal($userinfo)->list();
|
||||
$json_result = FpmDaemons::getLocal($userinfo)->listing();
|
||||
} catch (Exception $e) {
|
||||
dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class Admins extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin() && $this->getUserDetail('change_serversettings') == 1) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list admins");
|
||||
|
||||
@@ -24,7 +24,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
* @access admin
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list customers");
|
||||
|
||||
@@ -25,7 +25,7 @@ class Domains extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list domains");
|
||||
|
||||
@@ -25,7 +25,7 @@ class FpmDaemons extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list fpm-daemons");
|
||||
|
||||
@@ -289,7 +289,7 @@ class Ftps extends ApiCommand implements ResourceEntity
|
||||
if ($this->getUserDetail('customers_see_all') == false) {
|
||||
// if it's a reseller or an admin who cannot see all customers, we need to check
|
||||
// whether the database belongs to one of his customers
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
$customer_ids = array();
|
||||
foreach ($custom_list_result as $customer) {
|
||||
@@ -453,7 +453,7 @@ class Ftps extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
// if we're an admin, list all ftp-users of all the admins customers
|
||||
@@ -470,7 +470,7 @@ class Ftps extends ApiCommand implements ResourceEntity
|
||||
json_decode($json_result, true)['data']
|
||||
);
|
||||
} else {
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
}
|
||||
$customer_ids = array();
|
||||
|
||||
@@ -25,7 +25,7 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin() && ($this->getUserDetail('change_serversettings') || ! empty($this->getUserDetail('ip')))) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list ips and ports");
|
||||
|
||||
@@ -230,7 +230,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
|
||||
if ($this->getUserDetail('customers_see_all') != 1) {
|
||||
// if it's a reseller or an admin who cannot see all customers, we need to check
|
||||
// whether the database belongs to one of his customers
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
$customer_ids = array();
|
||||
foreach ($custom_list_result as $customer) {
|
||||
@@ -425,7 +425,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
$result = array();
|
||||
$dbserver = $this->getParam('mysql_server', true, - 1);
|
||||
@@ -444,7 +444,7 @@ class Mysqls extends ApiCommand implements ResourceEntity
|
||||
json_decode($json_result, true)['data']
|
||||
);
|
||||
} else {
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
}
|
||||
$customer_ids = array();
|
||||
|
||||
@@ -25,7 +25,7 @@ class PhpSettings extends ApiCommand implements ResourceEntity
|
||||
* @throws Exception
|
||||
* @return array count|list
|
||||
*/
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_NOTICE, "[API] list php-configs");
|
||||
|
||||
@@ -367,7 +367,7 @@ class SubDomains extends ApiCommand implements ResourceEntity
|
||||
if ($this->getUserDetail('customers_see_all') != 1) {
|
||||
// if it's a reseller or an admin who cannot see all customers, we need to check
|
||||
// whether the database belongs to one of his customers
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
$customer_ids = array();
|
||||
foreach ($custom_list_result as $customer) {
|
||||
@@ -419,7 +419,7 @@ class SubDomains extends ApiCommand implements ResourceEntity
|
||||
throw new Exception("Not available yet.", 501);
|
||||
}
|
||||
|
||||
public function list()
|
||||
public function listing()
|
||||
{
|
||||
if ($this->isAdmin()) {
|
||||
// if we're an admin, list all databases of all the admins customers
|
||||
@@ -436,7 +436,7 @@ class SubDomains extends ApiCommand implements ResourceEntity
|
||||
json_decode($json_result, true)['data']
|
||||
);
|
||||
} else {
|
||||
$json_result = Customers::getLocal($this->getUserData())->list();
|
||||
$json_result = Customers::getLocal($this->getUserData())->listing();
|
||||
$custom_list_result = json_decode($json_result, true)['data']['list'];
|
||||
}
|
||||
$customer_ids = array();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
interface ResourceEntity
|
||||
{
|
||||
|
||||
public function list();
|
||||
public function listing();
|
||||
|
||||
public function get();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<phpdox xmlns="http://xml.phpdox.net/config">
|
||||
<project name="froxlor" source="api" workdir="build/phpdox">
|
||||
<collector publiconly="false">
|
||||
<project name="froxlor" source="." workdir="build/phpdox">
|
||||
<collector publiconly="true">
|
||||
<include mask="*.php" />
|
||||
</collector>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class AdminsTest extends TestCase
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
$json_result = Admins::getLocal($admin_userdata)->list();
|
||||
$json_result = Admins::getLocal($admin_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(2, $result['count']);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class AdminsTest extends TestCase
|
||||
$this->expectExceptionCode(403);
|
||||
$this->expectExceptionMessage("Not allowed to execute given command.");
|
||||
|
||||
Admins::getLocal($reseller_userdata)->list();
|
||||
Admins::getLocal($reseller_userdata)->listing();
|
||||
}
|
||||
|
||||
public function testAdminAdminsUnlock()
|
||||
|
||||
@@ -88,7 +88,7 @@ class CustomersTest extends TestCase
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
$json_result = Customers::getLocal($admin_userdata)->list();
|
||||
$json_result = Customers::getLocal($admin_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class CustomersTest extends TestCase
|
||||
))->get();
|
||||
$reseller_userdata = json_decode($json_result, true)['data'];
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$json_result = Customers::getLocal($reseller_userdata)->list();
|
||||
$json_result = Customers::getLocal($reseller_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(0, $result['count']);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ class CustomersTest extends TestCase
|
||||
$this->expectExceptionCode(403);
|
||||
$this->expectExceptionMessage("Not allowed to execute given command.");
|
||||
|
||||
$json_result = Customers::getLocal($customer_userdata)->list();
|
||||
$json_result = Customers::getLocal($customer_userdata)->listing();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ class DomainsTest extends TestCase
|
||||
public function testAdminDomainsList()
|
||||
{
|
||||
global $admin_userdata;
|
||||
$json_result = Domains::getLocal($admin_userdata)->list();
|
||||
$json_result = Domains::getLocal($admin_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('test.local', $result['list'][0]['domain']);
|
||||
@@ -49,7 +49,7 @@ class DomainsTest extends TestCase
|
||||
))->get();
|
||||
$reseller_userdata = json_decode($json_result, true)['data'];
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$json_result = Domains::getLocal($reseller_userdata)->list();
|
||||
$json_result = Domains::getLocal($reseller_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(0, $result['count']);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class FtpsTest extends TestCase
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
$json_result = Ftps::getLocal($admin_userdata)->list();
|
||||
$json_result = Ftps::getLocal($admin_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class FtpsTest extends TestCase
|
||||
{
|
||||
global $admin_userdata;
|
||||
|
||||
$json_result = Ftps::getLocal($admin_userdata, array('loginname' => 'test1'))->list();
|
||||
$json_result = Ftps::getLocal($admin_userdata, array('loginname' => 'test1'))->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('test1', $result['list'][0]['username']);
|
||||
@@ -101,7 +101,7 @@ class FtpsTest extends TestCase
|
||||
))->get();
|
||||
$reseller_userdata = json_decode($json_result, true)['data'];
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$json_result = Ftps::getLocal($reseller_userdata)->list();
|
||||
$json_result = Ftps::getLocal($reseller_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('test1', $result['list'][0]['username']);
|
||||
@@ -115,7 +115,7 @@ class FtpsTest extends TestCase
|
||||
'loginname' => 'test1'
|
||||
))->get();
|
||||
$customer_userdata = json_decode($json_result, true)['data'];
|
||||
$json_result = Ftps::getLocal($customer_userdata)->list();
|
||||
$json_result = Ftps::getLocal($customer_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('test1', $result['list'][0]['username']);
|
||||
|
||||
@@ -11,7 +11,7 @@ class IpsAndPortsTest extends TestCase
|
||||
public function testAdminIpsAndPortsList()
|
||||
{
|
||||
global $admin_userdata;
|
||||
$json_result = IpsAndPorts::getLocal($admin_userdata)->list();
|
||||
$json_result = IpsAndPorts::getLocal($admin_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('82.149.225.46', $result['list'][0]['ip']);
|
||||
@@ -29,7 +29,7 @@ class IpsAndPortsTest extends TestCase
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$this->expectExceptionCode(403);
|
||||
$this->expectExceptionMessage("Not allowed to execute given command.");
|
||||
$json_result = IpsAndPorts::getLocal($reseller_userdata)->list();
|
||||
$json_result = IpsAndPorts::getLocal($reseller_userdata)->listing();
|
||||
}
|
||||
|
||||
public function testAdminIpsAndPortsAdd()
|
||||
@@ -91,7 +91,7 @@ class IpsAndPortsTest extends TestCase
|
||||
))->update();
|
||||
$reseller_userdata = json_decode($json_result, true)['data'];
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$json_result = IpsAndPorts::getLocal($reseller_userdata)->list();
|
||||
$json_result = IpsAndPorts::getLocal($reseller_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(1, $result['count']);
|
||||
$this->assertEquals('82.149.225.47', $result['list'][0]['ip']);
|
||||
|
||||
@@ -132,7 +132,7 @@ class SubDomainsTest extends TestCase
|
||||
'loginname' => 'test1'
|
||||
))->get();
|
||||
$customer_userdata = json_decode($json_result, true)['data'];
|
||||
$json_result = SubDomains::getLocal($customer_userdata)->list();
|
||||
$json_result = SubDomains::getLocal($customer_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(3, $result['count']);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class SubDomainsTest extends TestCase
|
||||
))->get();
|
||||
$reseller_userdata = json_decode($json_result, true)['data'];
|
||||
$reseller_userdata['adminsession'] = 1;
|
||||
$json_result = SubDomains::getLocal($reseller_userdata)->list();
|
||||
$json_result = SubDomains::getLocal($reseller_userdata)->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(3, $result['count']);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class SubDomainsTest extends TestCase
|
||||
public function testAdminSubDomainsListWithCustomer()
|
||||
{
|
||||
global $admin_userdata;
|
||||
$json_result = SubDomains::getLocal($admin_userdata, ['loginname' => 'test1'])->list();
|
||||
$json_result = SubDomains::getLocal($admin_userdata, ['loginname' => 'test1'])->listing();
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$this->assertEquals(3, $result['count']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user