1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
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 | 16 | public function register(DiInterface $container) |
|
16 | { |
||
17 | 16 | $config = $container->getShared('config'); |
|
18 | 16 | $db = $container->getShared('db'); |
|
19 | |||
20 | 16 | $container->setShared( |
|
21 | 16 | 'acl', |
|
22 | function () use ($db) { |
||
23 | 12 | $acl = new AclManager( |
|
24 | [ |
||
25 | 12 | 'db' => $db, |
|
26 | 12 | 'roles' => 'roles', |
|
27 | 12 | 'rolesInherits' => 'roles_inherits', |
|
28 | 12 | 'resources' => 'resources', |
|
29 | 12 | 'resourcesAccesses' => 'resources_accesses', |
|
30 | 12 | 'accessList' => 'access_list' |
|
31 | ] |
||
32 | ); |
||
33 | |||
34 | //default behavior |
||
35 | 12 | $acl->setDefaultAction(Acl::ALLOW); |
|
36 | |||
37 | 12 | return $acl; |
|
38 | 16 | } |
|
39 | ); |
||
40 | 16 | } |
|
41 | } |
||
42 |