【问题标题】:Sylius Resource 403 access deniedSylius 资源 403 访问被拒绝
【发布时间】:2016-03-31 08:03:52
【问题描述】:

我创建了一个新捆绑包,用于为某些区域添加一些交货期。

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

我也将此添加到我的路由中:

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

创建了我的实体、Configuration.php、ShopDeliveryExtension.php 和所有,但是当我现在想要打开列表或编辑交货期时,我在这些页面上收到 403 Access Denied?

【问题讨论】:

  • 快速定义路由自动检查权限。您可以将它们添加到数据库中,以获得角色。可能最好的方法是将它们写入配置中,如sylius.yml(搜索rbac),然后运行php app/console sylius:rbac:initialize——但不确定。如果您单独编写路线,您可以使用 config: permission: false

标签: php sylius


【解决方案1】:

我确实必须将所有新路由添加到 Sylius 中的权限。直到现在才知道,谢谢!

【讨论】:

    【解决方案2】:

    您应该配置 RBAC。

    请参阅 Sylius 专用文档:http://docs.sylius.org/en/latest/bundles/SyliusRbacBundle/setup.html

    【讨论】:

      猜你喜欢
      • 2015-09-07
      • 1970-01-01
      • 2021-02-10
      • 2017-06-18
      • 2019-02-04
      • 2017-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多