mirror of
https://github.com/grocy/grocy.git
synced 2026-04-06 21:06:15 +02:00
Show only API-Keys for current user
This commit is contained in:
parent
308f10f738
commit
1546a823c5
|
|
@ -2,12 +2,17 @@
|
|||
|
||||
namespace Grocy\Controllers;
|
||||
|
||||
use Grocy\Controllers\Users\User;
|
||||
|
||||
class OpenApiController extends BaseApiController
|
||||
{
|
||||
public function ApiKeysList(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$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' => $this->getDatabase()->api_keys(),
|
||||
'apiKeys' =>$apiKeys,
|
||||
'users' => $this->getDatabase()->users()
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user