Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | protected function checkPermissions(string $modifier, mixed ...$params): bool |
||
31 | { |
||
32 | |||
33 | if($modifier == LoginRequired::class) { |
||
34 | |||
35 | $level = $params[0] ?? 1; |
||
36 | $authenticator = new \Lepton\Authenticator\UserAuthenticator(); |
||
37 | $loggedIn = $authenticator->isLoggedIn(); |
||
38 | if(! $loggedIn){ |
||
39 | return false; |
||
40 | } |
||
41 | $user = $authenticator->getLoggedUser(); |
||
42 | $splitted = explode("__", $this->level_field); |
||
43 | $user_level = $user; |
||
44 | foreach($splitted as $part){ |
||
45 | $user_level = $user_level->$part; |
||
46 | } |
||
47 | return ($user_level >= $level); |
||
48 | } |
||
49 | return true; |
||
50 | } |
||
52 |