bakaphp /
phalcon-api
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace Gewaer\Providers; |
||
| 4 | |||
| 5 | use Phalcon\Di\ServiceProviderInterface; |
||
| 6 | use Phalcon\DiInterface; |
||
| 7 | use Gewaer\Acl\Manager as AclManager; |
||
| 8 | use Phalcon\Acl; |
||
| 9 | |||
| 10 | class AclProvider implements ServiceProviderInterface |
||
| 11 | {
|
||
| 12 | /** |
||
| 13 | * @param DiInterface $container |
||
| 14 | */ |
||
| 15 | 11 | public function register(DiInterface $container) |
|
| 16 | {
|
||
| 17 | 11 | $config = $container->getShared('config');
|
|
|
0 ignored issues
–
show
|
|||
| 18 | 11 | $db = $container->getShared('db');
|
|
| 19 | |||
| 20 | 11 | $container->setShared( |
|
| 21 | 11 | 'acl', |
|
| 22 | function () use ($db) {
|
||
| 23 | 7 | $acl = new AclManager( |
|
| 24 | [ |
||
| 25 | 7 | 'db' => $db, |
|
| 26 | 7 | 'roles' => 'roles', |
|
| 27 | 7 | 'rolesInherits' => 'roles_inherits', |
|
| 28 | 7 | 'resources' => 'resources', |
|
| 29 | 7 | 'resourcesAccesses' => 'resources_accesses', |
|
| 30 | 7 | 'accessList' => 'access_list' |
|
| 31 | ] |
||
| 32 | ); |
||
| 33 | |||
| 34 | //default behavior |
||
| 35 | 7 | $acl->setDefaultAction(Acl::ALLOW); |
|
| 36 | |||
| 37 | 7 | return $acl; |
|
| 38 | 11 | } |
|
| 39 | ); |
||
| 40 | 11 | } |
|
| 41 | } |
||
| 42 |