Applied formatting rules for by #986 changed files

This commit is contained in:
Bernd Bestel
2020-09-06 10:10:30 +02:00
parent d0a7756a67
commit 7498d8f13d
3 changed files with 17 additions and 7 deletions

View File

@@ -14,7 +14,9 @@ class GenericEntityApiController extends BaseApiController
if ($this->IsValidEntity($args['entity']))
{
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$requestBody = $request->getParsedBody();
@@ -51,7 +53,9 @@ class GenericEntityApiController extends BaseApiController
if ($this->IsValidEntity($args['entity']))
{
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$row = $this->getDatabase()->{$args['entity']}
($args['objectId']);
$row->delete();
@@ -71,7 +75,9 @@ class GenericEntityApiController extends BaseApiController
if ($this->IsValidEntity($args['entity']))
{
if ($this->IsEntityWithEditRequiresAdmin($args['entity']))
{
User::checkPermission($request, User::PERMISSION_ADMIN);
}
$requestBody = $request->getParsedBody();
try
@@ -218,6 +224,7 @@ class GenericEntityApiController extends BaseApiController
{
parent::__construct($container);
}
private function IsEntityWithEditRequiresAdmin($entity)
{
return !in_array($entity, $this->getOpenApiSpec()->components->internalSchemas->EntityEditRequiresAdmin->enum);

View File

@@ -10,7 +10,9 @@ class OpenApiController extends BaseApiController
{
$apiKeys = $this->getDatabase()->api_keys();
if (!User::hasPermissions(User::PERMISSION_ADMIN))
{
$apiKeys = $apiKeys->where('user_id', GROCY_USER_ID);
}
return $this->renderPage($response, 'manageapikeys', [
'apiKeys' => $apiKeys,
'users' => $this->getDatabase()->users()

View File

@@ -172,7 +172,8 @@ function animateCSS(selector, animationName, callback, speed = "faster")
nodes.on('animationend', handleAnimationEnd);
}
function RandomString() {
function RandomString()
{
return Math.random().toString(36).substring(2, 100) + Math.random().toString(36).substring(2, 100);
}
function getQRCodeForContent(url)