Conditions | 3 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
35 | public static function controllerPermissionCheck(string $permission): void |
||
36 | { |
||
37 | if (($currentUser = Craft::$app->getUser()->getIdentity()) === null) { |
||
38 | throw new ForbiddenHttpException('Your account has no identity.'); |
||
39 | } |
||
40 | |||
41 | if (!$currentUser->can($permission)) { |
||
42 | throw new ForbiddenHttpException("Your account doesn't have permission to assign access this resource."); |
||
43 | } |
||
49 |