4

I've created a new bundle for adding some delivery periods for certain zones.

sylius_resource:
  resources:
    shop.deliveryperiods:
      classes:
        model: Shop\Bundle\DeliveryBundle\Entity\DeliveryPeriod
        form:
          default: Shop\Bundle\DeliveryBundle\Form\Type\DeliveryPeriodType
        controller: Shop\Bundle\DeliveryBundle\Controller\Backend\DeliveryController

I've also added this to my routing:

shop_backend_deliveryperiods:
    resource: |
        alias: shop.deliveryperiods
        path: deliveryperiods
    type: sylius.resource
    prefix: /administration

Created my entity, Configuration.php, ShopDeliveryExtension.php and all, but when I now want to open the list or edit a deliveryperiod, I get a 403 Access Denied on those pages?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
pottink
  • 93
  • 4
  • Quick defining a route automatically check for permissions. You can add them to db, for the role. Probably the best way is to write them in config as in `sylius.yml` (search rbac), and then running `php app/console sylius:rbac:initialize` -- but don't know for sure. If you write your routes separatelly you can use config: permission: false – nakashu Mar 31 '16 at 08:27

2 Answers2

0

I indeed had to add all new routes to the permissions in Sylius. Didn't know that until now, thanks!

pottink
  • 93
  • 4
0

You should configure RBAC.

See Sylius dedicated documentation : http://docs.sylius.org/en/latest/bundles/SyliusRbacBundle/setup.html

Thomas Tourlourat
  • 137
  • 1
  • 1
  • 7