diff --git a/app/Libraries/AuthContext.php b/app/Libraries/AuthContext.php index 890900d..219a772 100644 --- a/app/Libraries/AuthContext.php +++ b/app/Libraries/AuthContext.php @@ -53,11 +53,15 @@ class AuthContext return $this->getAuthInfo('name'); } - public function getRole(): array|null + public function getRole(): string|null { return $this->getAuthInfo('role'); } + public function getRoles(): array|null + { + return explode(DEFAULTS['DELIMITER_COMMA'], $this->getRole()); + } public function isLoggedIn(): bool { return $this->session->has(self::SESSION_IS_LOGIN); @@ -65,7 +69,7 @@ class AuthContext public function isAccessRole(array $roles): bool { - $userRoles = $this->getRole(); + $userRoles = $this->getRoles(); if (empty($userRoles) || !is_array($userRoles)) { return false; }