mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Fix API keys cannot be deleted (fixes #99)
This commit is contained in:
parent
b84e6da0dd
commit
cd7b6b686d
@ -6,7 +6,7 @@ class GenericEntityApiController extends BaseApiController
|
||||
{
|
||||
public function GetObjects(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
if ($this->IsValidEntity($args['entity']))
|
||||
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
|
||||
{
|
||||
return $this->ApiResponse($this->Database->{$args['entity']}());
|
||||
}
|
||||
@ -18,7 +18,7 @@ class GenericEntityApiController extends BaseApiController
|
||||
|
||||
public function GetObject(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
if ($this->IsValidEntity($args['entity']))
|
||||
if ($this->IsValidEntity($args['entity']) && !$this->IsEntityWithPreventedListing($args['entity']))
|
||||
{
|
||||
return $this->ApiResponse($this->Database->{$args['entity']}($args['objectId']));
|
||||
}
|
||||
@ -77,4 +77,9 @@ class GenericEntityApiController extends BaseApiController
|
||||
{
|
||||
return in_array($entity, $this->OpenApiSpec->components->internalSchemas->ExposedEntity->enum);
|
||||
}
|
||||
|
||||
private function IsEntityWithPreventedListing($entity)
|
||||
{
|
||||
return in_array($entity, $this->OpenApiSpec->components->internalSchemas->ExposedEntitiesPreventListing->enum);
|
||||
}
|
||||
}
|
||||
|
@ -1679,7 +1679,14 @@
|
||||
"tasks",
|
||||
"task_categories",
|
||||
"product_groups",
|
||||
"equipment"
|
||||
"equipment",
|
||||
"api_keys"
|
||||
]
|
||||
},
|
||||
"ExposedEntitiesPreventListing": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"api_keys"
|
||||
]
|
||||
},
|
||||
"StockTransactionType": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user