prodigious/sonata-permission-bundle

This bundle provides a friendly view to display roles administration.

1.0.2 2019-01-11 13:22 UTC

This package is auto-updated.

Last update: 2024-10-12 04:29:59 UTC


README

This bundle provides a friendly view to display roles administration.

Prerequisites

  • SonataAdminBundle
  • SonataUserBundle

Screenshots

screenshot

screenshot

screenshot

screenshot

Installation

composer require prodigious/sonata-permission-bundle

Configuration

// app/AppKernel.php
new Prodigious\Sonata\PermissionBundle\ProdigiousSonataPermissionBundle(),

config.yml

sonata_admin:
    security:
        handler: sonata.admin.security.handler.role

twig:
    form_themes:
        - '@ProdigiousSonataPermission/Form/prodigious_sonata_security_roles_widget.html.twig'

sonata_acl.yml

Configuration:

There are two types of view for items:

  • Type role: display all permission in a list of checkbox, the parameter 'name' should be a role.
  • Type entity: display all permission in a table with the permissions you have difine, the parameter 'name' should be a service admin of sonata, by defaut, the parameter permissions are { 'Create': 'CREATE', 'Edit': 'EDIT', 'List': 'LIST', 'View': 'VIEW', 'Delete': 'DELETE', 'Export': 'EXPORT' }

Configuration example

prodigious_sonata_permission:
    default_roles: []
    auto_replace_roles_field: true
    groups:
        admin:
            label:              Admin Roles
            translation_domain: ProdigiousSonataPermissionBundle
            multiple_choice: false # radio
            items:
                - { type: role, name: ROLE_SUPER_ADMIN, label: ROLE_SUPER_ADMIN }
                - { type: role, name: ROLE_ADMIN, label: ROLE_ADMIN }
        content:
            label:              Content
            translation_domain: ProdigiousSonataPermissionBundle
            multiple_choice: true  # checkbox
            items:
                - { type: entity, name: sonata.admin.news }
                - { type: entity, name: sonata.admin.product, permissions: { 'Edit': 'EDIT', 'Delete': 'DELETE' } } // permissions est optionnal
        classification:
            label:              Classification
            translation_domain: ProdigiousSonataPermissionBundle
            items:
                - { type: entity, name: sonata.admin.category }
                - { type: entity, name: sonata.admin.tag }
        media:
            label:              Media
            translation_domain: ProdigiousSonataPermissionBundle
            items:
                - { type: entity, name: sonata.media.admin.media }
                - { type: entity, name: sonata.media.admin.gallery }
        user:
            label:              User
            translation_domain: ProdigiousSonataPermissionBundle
            items:
                  - { type: entity, name: sonata.user.admin.user }
                  - { type: entity, name: sonata.user.admin.group }

Changelog

Additional info

Author: Nan GUO

Company : Prodigious