mirror of
https://github.com/grocy/grocy.git
synced 2025-10-14 17:24:07 +00:00
Apikeys (#986)
* Add QR-Code for API-Url/Key * Show only API-Keys for current user * Allow only admin users to create custom API-Keys * Use a managed package of qrcode-generator instead of a copy of the JS file * Reuse existing localization string (API key) * Center QR-Code in popups Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
committed by
GitHub
parent
40f379b761
commit
85a95f1973
@@ -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()
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user