permissions finito

This commit is contained in:
2023-10-18 01:54:24 +03:00
parent 632684f514
commit 91b68d9682
5 changed files with 125 additions and 109 deletions
+16 -1
View File
@@ -52,7 +52,7 @@ readonly class AuthService
$user = $this->userRepo->findByEmail(new Email($email));
if ($user->isEmpty()) {
throw new LucentException("You account was not found");
throw new LucentException("Your account was not found");
}
if ($user->get()->isRemoved()) {
@@ -74,6 +74,21 @@ readonly class AuthService
$this->session->put(["user" => $user->get()->safe()]);
}
public function refreshSession(){
$user = $this->userRepo->findById($this->currentUserId());
if ($user->isEmpty()) {
throw new LucentException("Your account was not found");
}
if ($user->get()->isRemoved()) {
throw new LucentException("Your account is not active");
}
$newUser = $user->get();
$this->session->put(["user" => $user->get()->safe()]);
}
public function create(string $name, string $email, array $roles): User
{