-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[User Management] Add default key bindings Endpoint (#561)
* Add default Key Bindings * Add Translation * Add Tests * Apply php-cs-fixer changes * Add Docs. * Add Docs. * Update Link. --------- Co-authored-by: martineiber <[email protected]>
- Loading branch information
1 parent
963d930
commit 04e5665
Showing
16 changed files
with
521 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
pimcore_studio_backend: | ||
user: | ||
default_key_bindings: | ||
save: | ||
key: 'S' | ||
action: save | ||
ctrl: true | ||
publish: | ||
key: 'P' | ||
action: publish | ||
ctrl: true | ||
shift: true | ||
unpublish: | ||
key: 'U' | ||
action: unpublish | ||
ctrl: true | ||
shift: true | ||
rename: | ||
key: 'R' | ||
action: rename | ||
alt: true | ||
shift: true | ||
refresh: | ||
key: 't' | ||
action: refresh | ||
open_asset: | ||
key: 'A' | ||
action: openAsset | ||
ctrl: true | ||
shift: true | ||
open_object: | ||
key: 'O' | ||
action: openObject | ||
ctrl: true | ||
shift: true | ||
open_document: | ||
key: 'D' | ||
action: openDocument | ||
ctrl: true | ||
shift: true | ||
open_class_editor: | ||
key: 'C' | ||
action: openClassEditor | ||
ctrl: true | ||
shift: true | ||
open_in_tree: | ||
key: 'L' | ||
action: openInTree | ||
ctrl: true | ||
shift: true | ||
show_meta_info: | ||
key: 'I' | ||
action: showMetaInfo | ||
alt: true | ||
search_document: | ||
key: 'W' | ||
action: searchDocument | ||
alt: true | ||
search_asset: | ||
key: 'A' | ||
action: searchAsset | ||
alt: true | ||
search_object: | ||
key: 'O' | ||
action: searchObject | ||
alt: true | ||
show_element_history: | ||
key: 'H' | ||
action: showElementHistory | ||
alt: true | ||
close_all_tabs: | ||
key: 'T' | ||
action: closeAllTabs | ||
alt: true | ||
search_and_replace_assignments: | ||
key: 'S' | ||
action: searchAndReplaceAssignments | ||
alt: true | ||
redirects: | ||
key: 'R' | ||
action: redirects | ||
ctrl: false | ||
alt: true | ||
shared_translations: | ||
key: 'T' | ||
action: sharedTranslations | ||
ctrl: true | ||
alt: true | ||
recycle_bin: | ||
key: 'R' | ||
action: recycleBin | ||
ctrl: true | ||
alt: true | ||
notes_events: | ||
key: 'N' | ||
action: notesEvents | ||
ctrl: true | ||
alt: true | ||
tag_manager: | ||
key: 'H' | ||
action: tagManager | ||
ctrl: true | ||
alt: true | ||
tag_configuration: | ||
key: 'N' | ||
action: tagConfiguration | ||
ctrl: true | ||
alt: true | ||
users: | ||
key: 'U' | ||
action: users | ||
ctrl: true | ||
alt: true | ||
roles: | ||
key: 'P' | ||
action: roles | ||
ctrl: true | ||
alt: true | ||
clear_all_caches: | ||
key: 'Q' | ||
action: clearAllCaches | ||
ctrl: false | ||
alt: true | ||
clear_data_cache: | ||
key: 'C' | ||
action: clearDataCache | ||
ctrl: false | ||
alt: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Studio User | ||
## Default Key Bindings | ||
To change the default key bindings, you can add a synfony configuration file in your project. | ||
The structure of the file should be like this: | ||
```yaml | ||
pimcore_studio_backend: | ||
user: | ||
default_key_bindings: | ||
save: | ||
key: 'S' | ||
action: save | ||
ctrl: true | ||
``` | ||
You can find the predefined key bindings here `config/pimcore/user_key_binding.yaml` in the Studio Backend Bundle. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\User\Controller; | ||
|
||
use OpenApi\Attributes\Get; | ||
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Property\GenericCollection; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\Content\CollectionJson; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags; | ||
use Pimcore\Bundle\StudioBackendBundle\User\Schema\KeyBinding; | ||
use Pimcore\Bundle\StudioBackendBundle\User\Service\KeyBindingServiceInterface; | ||
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\UserPermissions; | ||
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\PaginatedResponseTrait; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\Routing\Attribute\Route; | ||
use Symfony\Component\Security\Http\Attribute\IsGranted; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
use function count; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class GetDefaultKeyBindingsController extends AbstractApiController | ||
{ | ||
use PaginatedResponseTrait; | ||
|
||
public function __construct( | ||
SerializerInterface $serializer, | ||
private KeyBindingServiceInterface $keyBindingService | ||
) { | ||
parent::__construct($serializer); | ||
} | ||
|
||
#[Route('/users/default-key-bindings', name: 'pimcore_studio_api_users_default_key_bindings', methods: ['GET'])] | ||
#[IsGranted(UserPermissions::USER_MANAGEMENT->value)] | ||
#[Get( | ||
path: self::PREFIX . '/users/default-key-bindings', | ||
operationId: 'user_default_key_bindings', | ||
description: 'user_default_key_bindings_description', | ||
summary: 'user_default_key_bindings_summary', | ||
tags: [Tags::User->value] | ||
)] | ||
#[SuccessResponse( | ||
description: 'user_default_key_bindings_response', | ||
content: new CollectionJson(new GenericCollection(KeyBinding::class)) | ||
)] | ||
#[DefaultResponses] | ||
public function getDefaultKeyBindings(): JsonResponse | ||
{ | ||
$bindings = $this->keyBindingService->getDefaultKeyBindings(); | ||
|
||
return $this->getPaginatedCollection($this->serializer, $bindings, count($bindings)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\User\Hydrator; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\User\Schema\KeyBinding; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class KeyBindingHydrator implements KeyBindingHydratorInterface | ||
{ | ||
public function hydrate(array $data): array | ||
{ | ||
$keyBindings = []; | ||
foreach ($data as $keyBinding) { | ||
$keyBindings[] = new KeyBinding( | ||
key: $keyBinding['key'], | ||
action: $keyBinding['action'], | ||
ctrl: $keyBinding['ctrl'], | ||
alt: $keyBinding['alt'], | ||
shift: $keyBinding['shift'], | ||
); | ||
} | ||
|
||
return $keyBindings; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\User\Hydrator; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\User\Schema\KeyBinding; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
interface KeyBindingHydratorInterface | ||
{ | ||
/** | ||
* @return KeyBinding[] | ||
*/ | ||
public function hydrate(array $data): array; | ||
} |
Oops, something went wrong.