You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
756 B
35 lines
756 B
<?php
|
|
|
|
namespace model;
|
|
|
|
use gateway\UserGateway;
|
|
|
|
class MdlUser extends AbsModel
|
|
{
|
|
|
|
public function modifyNickname(int $id, string $newNickname): void
|
|
{
|
|
$gtw = new UserGateway();
|
|
$gtw->modifyNickname($id, $newNickname);
|
|
}
|
|
|
|
public function modifyPassword(int $id, string $newPassword): void
|
|
{
|
|
$gtw = new UserGateway();
|
|
$gtw->modifyPassword($id, $newPassword);
|
|
}
|
|
|
|
public function is(string $login, array $roles): ?User
|
|
{
|
|
$gtw = new UserGateway();
|
|
$user = $gtw->findUserByEmail($login);
|
|
return !empty($user->getRoles()) ? $user : null;
|
|
}
|
|
|
|
public function getUserById($id): User
|
|
{
|
|
$gtw = new UserGateway();
|
|
return $gtw->findById($id);
|
|
}
|
|
}
|