| Total Complexity | 6 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Auth extends Module |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * get the user type |
||
| 17 | * @return mixed |
||
| 18 | */ |
||
| 19 | public function getUser() |
||
| 20 | { |
||
| 21 | $session = $this->container->getSession(); |
||
| 22 | return $session->get('user_role_name'); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Gets the user level defined in the session (this is set on login and also stored in the DB). |
||
| 27 | * Returns an int for easier user control. |
||
| 28 | * @return int |
||
| 29 | */ |
||
| 30 | public function getUserLevel(): int |
||
| 31 | { |
||
| 32 | $session = $this->container->getSession(); |
||
| 33 | return $session->get('user_role_level') ?? 0; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * is the connected user an Admin |
||
| 38 | * @return bool |
||
| 39 | */ |
||
| 40 | public function isAdmin() |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * is the user connected ? |
||
| 51 | * @return bool |
||
| 52 | */ |
||
| 53 | public function isUser() |
||
| 60 | } |
||
| 61 | } |