forked from Wavyzz/dolibarr
Fixed some coding style issues
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
use \Luracast\Restler\iAuthenticate;
|
||||
use \Luracast\Restler\Resources;
|
||||
use \Luracast\Restler\Defaults;
|
||||
use Luracast\Restler\RestException;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,24 +44,14 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
*/
|
||||
public static $user = '';
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
/**
|
||||
* @return string string to be used with WWW-Authenticate header
|
||||
* @example Basic
|
||||
* @example Digest
|
||||
* @example OAuth
|
||||
*/
|
||||
public function __getWWWAuthenticateString();
|
||||
|
||||
/**
|
||||
* Check access
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
* @throws RestException
|
||||
*/
|
||||
public function _isAllowed()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
public function __isAllowed()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$stored_key = '';
|
||||
@@ -74,7 +64,8 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'";
|
||||
|
||||
if ($db->query($sql))
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
@@ -116,6 +107,12 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* @return string string to be used with WWW-Authenticate header
|
||||
* @example Basic
|
||||
* @example Digest
|
||||
* @example OAuth
|
||||
*/
|
||||
public function __getWWWAuthenticateString()
|
||||
{
|
||||
return '';
|
||||
@@ -123,12 +120,13 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
// @codingStandardsIgnoreEnd
|
||||
|
||||
/**
|
||||
* Verify access
|
||||
*
|
||||
* @param array $m Properties of method
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
* Verify access
|
||||
*
|
||||
* @param array $m Properties of method
|
||||
*
|
||||
* @access private
|
||||
* @return bool
|
||||
*/
|
||||
public static function verifyAccess(array $m)
|
||||
{
|
||||
$requires = isset($m['class']['DolibarrApiAccess']['properties']['requires'])
|
||||
|
||||
@@ -47,8 +47,8 @@ if (empty($conf->global->MAIN_MODULE_API))
|
||||
exit;
|
||||
}
|
||||
|
||||
use Luracast\Restler\Defaults;
|
||||
Defaults::setProperty('authenticationMethod','_isAllowed');
|
||||
use \Luracast\Restler\Defaults;
|
||||
Defaults::setProperty('authenticationMethod','__isAllowed');
|
||||
|
||||
$api = new DolibarrApi($db);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user