dbmsv4 init...5

This commit is contained in:
최준흠 2026-03-02 13:32:02 +09:00
parent e8e43405f5
commit 47cafc947b

View File

@ -40,30 +40,28 @@ class AuthContext
public function getUID(): int public function getUID(): int
{ {
$uid = $this->getAuthInfo('uid'); return $this->getAuthInfo('uid');
if ($uid === null || $uid === '') {
throw new \RuntimeException('Not logged in');
}
return (int) $uid;
} }
public function getID(): string|null public function getID(): string
{ {
return $this->getAuthInfo('id'); return $this->getAuthInfo('id');
} }
public function getName(): string|null public function getName(): string
{ {
return $this->getAuthInfo('name'); return $this->getAuthInfo('name');
} }
public function getRole(): array|null public function getRole(): string
{ {
return $this->getAuthInfo('role'); return $this->getAuthInfo('role');
} }
public function getRoles(): array
{
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);
@ -104,7 +102,7 @@ class AuthContext
{ {
$this->session->set(self::SESSION_IS_LOGIN, true); $this->session->set(self::SESSION_IS_LOGIN, true);
$this->session->set(self::SESSION_AUTH_INFO, [ $this->session->set(self::SESSION_AUTH_INFO, [
'uid' => $entity->getPK(), 'uid' => (int) $entity->getPK(),
'id' => $entity->getID(), 'id' => $entity->getID(),
'name' => $entity->getTitle(), 'name' => $entity->getTitle(),
'role' => $entity->getRole() 'role' => $entity->getRole()