Sylius / RbacPlugin

Sylius roles and permissions management plugin
32 stars 38 forks source link

Custom sections permissions #31

Closed Zales0123 closed 5 years ago

Zales0123 commented 5 years ago

Fixes https://github.com/Sylius/RbacPlugin/issues/18

This PR gives the possibility to specify custom sections in RBAC plugin configuration. Without such a feature, a plugin is almost unusable if you use some other plugins or have some customizations in the application (which means - almost always :)).

With this changes, the whole RBAC functionality is extracted to a separate section (not included in "configuration" as before) and configured as a custom section to show plugin power even more :) New sections are added to administration role form automatically.

New configuration tree:

sylius_rbac:
    sylius_sections:
        catalog:
            - sylius_admin_inventory
            - sylius_admin_product
            - sylius_admin_product_association_type
            - sylius_admin_product_attribute
            - sylius_admin_product_option
            - sylius_admin_product_variant
            - sylius_admin_taxon
        configuration:
            - sylius_admin_admin_user
            - sylius_admin_channel
            - sylius_admin_country
            - sylius_admin_currency
            - sylius_admin_exchange_rate
            - sylius_admin_locale
            - sylius_admin_payment_method
            - sylius_admin_shipping_category
            - sylius_admin_shipping_method
            - sylius_admin_tax_category
            - sylius_admin_tax_rate
            - sylius_admin_zone
        customers:
            - sylius_admin_customer
            - sylius_admin_customer_group
            - sylius_admin_shop_user
        marketing:
            - sylius_admin_product_review
            - sylius_admin_promotion
        sales:
            - sylius_admin_order
    custom_sections:
        rbac:
            - sylius_rbac
        custom:
            - custom_route_prefix

Screenshots:

zrzut ekranu 2018-11-29 o 12 32 47 zrzut ekranu 2018-11-29 o 12 32 54

TO-DO:

bartoszpietrzak1994 commented 5 years ago

I know it's an MVP but WDYT about adding Fixes https://github.com/Sylius/RbacPlugin/issues/18 in the description?