bluzphp /
skeleton
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @author Anton Shevchuk |
||
| 4 | * @created 10.10.11 16:48 |
||
| 5 | */ |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @namespace |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Application; |
||
| 12 | |||
| 13 | use Bluz\Controller\Controller; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use Bluz\Http\Exception\RedirectException; |
||
|
0 ignored issues
–
show
The type
Bluz\Http\Exception\RedirectException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use Bluz\Proxy\Cache; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Cache was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | use Bluz\Proxy\Db; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Db was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 17 | use Bluz\Proxy\Messages; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Messages was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 18 | use Bluz\Proxy\Response; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 19 | use Psr\Cache\InvalidArgumentException; |
||
|
0 ignored issues
–
show
The type
Psr\Cache\InvalidArgumentException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 20 | |||
| 21 | /** |
||
| 22 | * @privilege Management |
||
| 23 | * |
||
| 24 | * @param array $acl |
||
| 25 | * |
||
| 26 | * @return void |
||
| 27 | * @throws RedirectException |
||
| 28 | * @throws InvalidArgumentException |
||
| 29 | */ |
||
| 30 | return function ($acl) { |
||
| 31 | /** |
||
| 32 | * @var Controller $this |
||
| 33 | */ |
||
| 34 | $callback = function () use ($acl) { |
||
| 35 | /** |
||
| 36 | * @var Controller $this |
||
| 37 | */ |
||
| 38 | Db::query('DELETE FROM acl_privileges'); |
||
| 39 | |||
| 40 | foreach ($acl as $roleId => $modules) { |
||
| 41 | foreach ($modules as $module => $privileges) { |
||
| 42 | foreach ($privileges as $privilege => $flag) { |
||
| 43 | Db::query( |
||
| 44 | 'INSERT INTO acl_privileges SET roleId = ?, module = ?, privilege = ?', |
||
| 45 | 1 | [$roleId, $module, $privilege] |
|
| 46 | ); |
||
| 47 | 1 | } |
|
| 48 | 1 | } |
|
| 49 | } |
||
| 50 | }; |
||
| 51 | |||
| 52 | if (empty($acl)) { |
||
| 53 | Messages::addError('Privileges set is empty. You can\'t remove all of them'); |
||
| 54 | } elseif (Db::transaction($callback)) { |
||
| 55 | if (!Cache::clearTags(['privileges'])) { |
||
| 56 | Cache::clear(); |
||
| 57 | } |
||
| 58 | 1 | Messages::addSuccess('All data was saved'); |
|
| 59 | 40 | } else { |
|
| 60 | Messages::addError('Internal Server Error'); |
||
| 61 | } |
||
| 62 | |||
| 63 | Response::redirectTo('acl', 'index'); |
||
| 64 | }; |
||
| 65 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths