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\Db\Exception\DbException; |
||
|
0 ignored issues
–
show
The type
Bluz\Db\Exception\DbException 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\Db\Exception\InvalidPrimaryKeyException; |
||
|
0 ignored issues
–
show
The type
Bluz\Db\Exception\InvalidPrimaryKeyException 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\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...
|
|||
| 17 | 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...
|
|||
| 18 | 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...
|
|||
| 19 | use Bluz\Proxy\Request; |
||
|
0 ignored issues
–
show
The type
Bluz\Proxy\Request 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 | * @accept HTML |
||
| 23 | * @accept JSON |
||
| 24 | * @privilege Management |
||
| 25 | * |
||
| 26 | * @param int $id |
||
| 27 | * |
||
| 28 | * @return bool |
||
| 29 | * @throws Exception |
||
| 30 | * @throws DbException |
||
| 31 | 2 | * @throws InvalidPrimaryKeyException |
|
| 32 | */ |
||
| 33 | 1 | return function ($id) { |
|
| 34 | /** |
||
| 35 | * @var Controller $this |
||
| 36 | */ |
||
| 37 | 1 | $user = Users\Table::findRow($id); |
|
| 38 | |||
| 39 | if (!$user) { |
||
| 40 | throw new Exception('User ID is incorrect'); |
||
| 41 | } |
||
| 42 | |||
| 43 | if (Request::isPost()) { |
||
| 44 | $roles = Request::getParam('roles'); |
||
| 45 | |||
| 46 | // update roles |
||
| 47 | Db::delete('acl_users_roles') |
||
| 48 | ->where('userId = ?', $user->id) |
||
| 49 | ->execute(); |
||
| 50 | |||
| 51 | if (is_array($roles)) { |
||
| 52 | foreach ($roles as $role) { |
||
| 53 | Db::insert('acl_users_roles') |
||
| 54 | ->set('userId', $user->id) |
||
| 55 | ->set('roleId', $role) |
||
| 56 | ->execute(); |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | 1 | // clean cache |
|
| 61 | 1 | Cache::delete('users.roles.' . $user->id); |
|
| 62 | 40 | Messages::addSuccess('User roles was updated'); |
|
| 63 | return false; |
||
| 64 | } |
||
| 65 | |||
| 66 | $this->assign('user', $user); |
||
| 67 | $this->assign('roles', Roles\Table::getInstance()->getRoles()); |
||
| 68 | }; |
||
| 69 |
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