bt-trader init
This commit is contained in:
parent
5b7bdfc424
commit
490b443e82
@ -53,11 +53,15 @@ class AuthContext
|
|||||||
return $this->getAuthInfo('name');
|
return $this->getAuthInfo('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRole(): array|null
|
public function getRole(): string|null
|
||||||
{
|
{
|
||||||
return $this->getAuthInfo('role');
|
return $this->getAuthInfo('role');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRoles(): array|null
|
||||||
|
{
|
||||||
|
return explode(DEFAULTS['DELIMITER_COMMA'], $this->getRole());
|
||||||
|
}
|
||||||
public function isLoggedIn(): bool
|
public function isLoggedIn(): bool
|
||||||
{
|
{
|
||||||
return $this->session->has(self::SESSION_IS_LOGIN);
|
return $this->session->has(self::SESSION_IS_LOGIN);
|
||||||
@ -65,7 +69,7 @@ class AuthContext
|
|||||||
|
|
||||||
public function isAccessRole(array $roles): bool
|
public function isAccessRole(array $roles): bool
|
||||||
{
|
{
|
||||||
$userRoles = $this->getRole();
|
$userRoles = $this->getRoles();
|
||||||
if (empty($userRoles) || !is_array($userRoles)) {
|
if (empty($userRoles) || !is_array($userRoles)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user