1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* MikoPBX - free phone system for small business |
4
|
|
|
* Copyright (C) 2017-2020 Alexey Portnov and Nikolay Beketov |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
declare(strict_types=1); |
20
|
|
|
|
21
|
|
|
namespace MikoPBX\AdminCabinet\Providers; |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
use MikoPBX\AdminCabinet\Plugins\SecurityPlugin; |
25
|
|
|
use Phalcon\Di\DiInterface; |
26
|
|
|
use Phalcon\Di\ServiceProviderInterface; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* |
30
|
|
|
*/ |
31
|
|
|
class SecurityPluginProvider implements ServiceProviderInterface |
32
|
|
|
{ |
33
|
|
|
public const SERVICE_NAME = 'securityPlugin'; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Register security plugin provider |
37
|
|
|
* |
38
|
|
|
* @param \Phalcon\Di\DiInterface $di |
39
|
|
|
*/ |
40
|
|
|
public function register(DiInterface $di): void |
41
|
|
|
{ |
42
|
|
|
$di->set( |
43
|
|
|
self::SERVICE_NAME, |
44
|
|
|
function ($controller, $action='index') { |
45
|
|
|
$aclManager = new SecurityPlugin(); |
46
|
|
|
return $aclManager->isAllowedAction($controller, $action); |
47
|
|
|
} |
48
|
|
|
); |
49
|
|
|
} |
50
|
|
|
} |