From 5239b2dd7dfffb489ddf840c3d61b3da2e3b7d21 Mon Sep 17 00:00:00 2001 From: Tomanhez Date: Tue, 18 May 2021 09:28:49 +0200 Subject: [PATCH] Add last fixes --- ...tom-model-accessible-for-channel-admin.rst | 41 ++++--------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/docs/cookbook/entities/custom-model-accessible-for-channel-admin.rst b/docs/cookbook/entities/custom-model-accessible-for-channel-admin.rst index 7e5580bed06b..7d8bd84bd7b1 100644 --- a/docs/cookbook/entities/custom-model-accessible-for-channel-admin.rst +++ b/docs/cookbook/entities/custom-model-accessible-for-channel-admin.rst @@ -12,6 +12,11 @@ channel-based entity to it, you will need to enable this entity to be viewed onl In order to prepare a simple Entity follow :doc:`this guide `. +1. Add your entity to admin menu: +---------------------------------- + +Adding a new entity to the admin menu is described in the section ``How to customize Admin Menu`` of :doc:`this guide `. + * Having your Supplier entity created, add a channel field with relation to the ``Channel`` entity: .. code-block:: php @@ -78,7 +83,7 @@ In order to prepare a simple Entity follow :doc:`this guide `. - 1. Restrict access to the entity for the respective channel administrator roles (using ACL/RBAC): ------------------------------------------------------------------------------------------------- -* Add access to all resource sections: ``index, create, update, delete, show, bulk_delete`` - -.. code-block:: yaml - - sylius_plus: - permissions: - app_admin_supplier_index: - parent: suppliers - label: action.index - app_admin_supplier_create: - parent: suppliers - label: action.create - app_admin_supplier_update: - parent: suppliers - label: action.update - app_admin_supplier_delete: - parent: suppliers - label: action.delete - app_admin_supplier_show: - parent: suppliers - label: action.show - app_admin_supplier_bulk_delete: - parent: suppliers - label: action.bulk_delete - .. note:: More information about using administrator roles (ACL/RBAC) can be found :doc:`here `. @@ -200,7 +175,7 @@ Adding a new entity to the admin menu is described in the section ``How to custo public function isFromChannel(object $resource, ChannelInterface $channel): bool { if ( - $resource instanceof Supplier && ($resource->getChannel() === $channel || $resource->getChannel() === null) + $resource instanceof Supplier && in_array($resource->getChannel(), [$channel, null], true) ) { return true; } @@ -272,7 +247,7 @@ After that, access to the resource should work properly with all restrictions. class: App\Doctrine\ORM\RestrictingSupplierListQueryBuilder arguments: ['@Sylius\Plus\ChannelAdmin\Application\Provider\AdminChannelProviderInterface', '@app.repository.supplier'] -* Add method to Suppliers grid: +* Add method to the Suppliers grid: .. code-block:: yaml