mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-20 23:36:50 +01:00
* [FIX] Fixes #640. Remove unnecesary auth check when runnig API method.Thanks to @cbrassel for the feedback.
This commit is contained in:
@@ -72,7 +72,20 @@ class ApiRequest
|
||||
*/
|
||||
public function formatJsonError($e)
|
||||
{
|
||||
$class = get_class($e);
|
||||
$data = function () use ($e) {
|
||||
$class = get_class($e);
|
||||
|
||||
if ($class === SPException::class
|
||||
|| $class === InvalidArgumentException::class
|
||||
) {
|
||||
$hint = $e->getHint();
|
||||
|
||||
return is_array($hint) ? $hint : __($hint);
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
$code = $e->getCode();
|
||||
|
||||
$error = [
|
||||
@@ -80,7 +93,7 @@ class ApiRequest
|
||||
'error' => [
|
||||
'code' => $code,
|
||||
'message' => __($e->getMessage()),
|
||||
'data' => $class === SPException::class || $class === InvalidArgumentException::class ? __($e->getHint()) : ''
|
||||
'data' => $data()
|
||||
],
|
||||
'id' => ($code === -32700 || $code === -32600) ? null : $this->getId()
|
||||
];
|
||||
@@ -192,7 +205,9 @@ class ApiRequest
|
||||
|
||||
if (!is_object($data) || json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new SPException(SPException::SP_WARNING, __('Datos inválidos', false), '', -32700);
|
||||
} elseif (!isset($data->jsonrpc, $data->method, $data->params, $data->id)) {
|
||||
}
|
||||
|
||||
if (!isset($data->jsonrpc, $data->method, $data->params, $data->id)) {
|
||||
throw new SPException(SPException::SP_WARNING, __('Formato incorrecto', false), '', -32600);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,6 @@ class SyspassApi extends ApiBase
|
||||
*/
|
||||
public function addAccount()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$this->checkActionAccess(ActionsInterface::ACTION_ACC_NEW);
|
||||
|
||||
$AccountData = new AccountExtData();
|
||||
|
||||
@@ -407,7 +407,7 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17061302;
|
||||
$build = 17061501;
|
||||
$version = [2, 1, 11];
|
||||
|
||||
if ($normalized === true) {
|
||||
|
||||
Reference in New Issue
Block a user