| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Auth extends Module |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * get the user type |
||
| 18 | * @return mixed |
||
| 19 | */ |
||
| 20 | public function getUser() |
||
| 21 | { |
||
| 22 | $session = $this->container->getSession(); |
||
| 23 | return $session->get('user_role_name'); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Gets the user level defined in the session (this is set on login and also stored in the DB). |
||
| 28 | * Returns an int for easier user control. |
||
| 29 | * @return int |
||
| 30 | */ |
||
| 31 | public function getUserLevel(): int |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getUserRole():string |
||
| 38 | { |
||
| 39 | $session = $this->container->getSession(); |
||
| 40 | return $session->get('user_role_name') ?? ''; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * is the connected user an Admin |
||
| 45 | * @return bool |
||
| 46 | */ |
||
| 47 | public function isAdmin() |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * is the user connected ? |
||
| 58 | * @return bool |
||
| 59 | */ |
||
| 60 | public function isUser() |
||
| 67 | } |
||
| 68 | } |