PHPackages                             mrgreenstuff/acl-sonata-admin-extension-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mrgreenstuff/acl-sonata-admin-extension-bundle

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

mrgreenstuff/acl-sonata-admin-extension-bundle
==============================================

ACL list filtering for SonataAdmin with MASTER ACL

477PHP

Since Jan 11Pushed 12y ago2 watchersCompare

[ Source](https://github.com/MrGreenStuff/MrGreenStuffAclSonataAdminExtensionBundle)[ Packagist](https://packagist.org/packages/mrgreenstuff/acl-sonata-admin-extension-bundle)[ RSS](/packages/mrgreenstuff-acl-sonata-admin-extension-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

ACL extension for Sonata Admin
==============================

[](#acl-extension-for-sonata-admin)

### This bundle is a fork of [CoopTilleulsAclSonataAdminExtensionBundle](https://github.com/coopTilleuls/CoopTilleulsAclSonataAdminExtensionBundle)

[](#this-bundle-is-a-fork-of-cooptilleulsaclsonataadminextensionbundle)

This bundle provides ACL list filtering for [SonataAdminBundle](https://github.com/sonata-project/SonataAdminBundle). When enabled, list screens only display data the logged in user has right to view.

This bundle is a good complementary of the SonataAdminBundle [ACL editor](http://sonata-project.org/bundles/admin/master/doc/reference/security.html#acl-editor).

[![SensioLabsInsight](https://camo.githubusercontent.com/03f9f5f8c4f3da8223f57f586c4128d8c217c5cf3466cedd83ad4dd1e79039fe/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64376437303434322d623532632d343037322d386530332d3435653661343765316361322f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d7d70442-b52c-4072-8e03-45e6a47e1ca2)

Install
-------

[](#install)

Be sure that SonataAdminBundle is working and has [ACL enabled](http://sonata-project.org/bundles/admin/master/doc/reference/security.html#acl-and-friendsofsymfony-userbundle).

Install this bundle using composer:

```
composer require mrgreenstuff/acl-sonata-admin-extension-bundle

```

Register the bundle in your AppKernel:

```
// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new MrGreenStuff\Bundle\AclSonataAdminExtensionBundle\MrGreenStuffAclSonataAdminExtensionBundle(),
        // ...
    );
}
```

Enable
------

[](#enable)

This extension is automatically enabled for all admins.

Special case (Master ACL Entity)
--------------------------------

[](#special-case-master-acl-entity)

#### Enhancement By JUILLARD YOANN

[](#enhancement-by-juillard-yoann)

### Application example :

[](#application-example-)

#### 3 Tables : Shop, Product and Country

[](#3-tables--shop-product-and-country)

- Between this tables relation ManyToOne (1 Country have N Shop) (1 Shop have N products). It should be work on all relation types but it's not tested.

#### 4 Users :

[](#4-users-)

- Admin (SUPER\_ADMIN)
- MainManager (NOT SUPER ADMIN !)
- EnglandManager
- FranceManager

#### Behavior expected :

[](#behavior-expected-)

- MainManager have OPERATOR ACL on all Countries so he can access to all shop and products of the matching country (even if ACL record for him not exists but because they have ACL access to the parent or the grand parent in this case all countries)
- EnglandManager or FranceManager can acces to all shop and products of the matching coutry (even if the products or shop has been created by MainManager or the SUPER\_ADMIN without ACLs for this users but because they have ACL acces to the parent or the grand parent in this case only one country)
- Admin keep SUPER\_ADMIN role (normal behavior)

### Configuration :

[](#configuration-)

- Create method : getMasterAclClass() on your sonata admin classes (only classes where you want to enabled the behavior). This method must return a string of master entity ACL like :

```
/*In Shop and Product admin classes*/
public function getMasterAclClass(){
    return 'Acme\DemoBundle\Entity\Country';
}
```

- Create method getMasterAclPath() on your sonata admin classes (only classes where you want to enabled the behavior). This method must return a array like :

```
/*In Shop admin class*/
public function getMasterAclPath(){
    return  array(
                array('coutry','c')
                );
}
//Where 'country' is the property name of the Shop entity who made the relation with Country Entity and 'c' a unique identifier (IMPORTANT the unique shortcut identifier CANNOT BE 'o' because 'o' is the default identifier of Sonata Admin)

/*In Product admin class*/
public function getMasterAclPath(){
    return  array(
                 array('shop','s'),
                 array('coutry','c')
                );
}
```

#### BE CAREFULL WHITH ORDER IN ARRAY IT MUST BE parent-&gt;grandParent-&gt;grandGrandParent... untill the MASTER ACL CLASS DEFINED ABOVE

[](#be-carefull-whith-order-in-array-it-must-be-parent-grandparent-grandgrandparent-untill-the-master-acl-class-defined-above)

### DISABLED STRICT MODE (Enabled by default)

[](#disabled-strict-mode-enabled-by-default)

When an child object of master ACL is created by an user the ACL is still added like without the bundle. When you delete the ACL acces to one record of the master class the users still can't acces to record created by him before the ACL master update (Even if ACL record defined him as owner). If you want that users still can access to child record created by him before the ACL master update you have to disabled the stict mode :

To do this write the method getMasterAclStrict() in the admin class.

```
public function getMasterAclStrict(){
    return false;
}
```

Credits
-------

[](#credits)

Created by [Kévin Dunglas](http://dunglas.fr) for [La Coopérative des Tilleuls](http://les-tilleuls.coop).

Enhanced by JUILLARD Yoann

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/039f48a0e23c841f806f6c2ca6ac2be4455dd50df8ad58b1efe43f0546360134?d=identicon)[MrGreenStuff](/maintainers/MrGreenStuff)

---

Top Contributors

[![MrGreenStuff](https://avatars.githubusercontent.com/u/6344571?v=4)](https://github.com/MrGreenStuff "MrGreenStuff (23 commits)")[![dunglas](https://avatars.githubusercontent.com/u/57224?v=4)](https://github.com/dunglas "dunglas (11 commits)")[![sroze](https://avatars.githubusercontent.com/u/804625?v=4)](https://github.com/sroze "sroze (2 commits)")[![aitboudad](https://avatars.githubusercontent.com/u/1753742?v=4)](https://github.com/aitboudad "aitboudad (1 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

### Embed Badge

![Health badge](/badges/mrgreenstuff-acl-sonata-admin-extension-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mrgreenstuff-acl-sonata-admin-extension-bundle/health.svg)](https://phpackages.com/packages/mrgreenstuff-acl-sonata-admin-extension-bundle)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
