MAPG-69 add menu with user info to header
This commit is contained in:
1 parent
01db72796b
commit
334df3462b
3 files changed
+43
-7
No files matched your search
+18
-1
@@ -6,7 +6,7 @@ class User extends BaseModel implements IUser
|
||||
{
|
||||
private static array $types = ['user', 'admin'];
|
||||
|
||||
protected static array $fields = ['email', 'password', 'type'];
|
||||
protected static array $fields = ['email', 'password', 'type', 'active'];
|
||||
|
||||
private string $email;
|
||||
|
||||
@@ -14,6 +14,8 @@ class User extends BaseModel implements IUser
|
||||
|
||||
private string $type = 'user';
|
||||
|
||||
private bool $active = false;
|
||||
|
||||
public function setEmail(string $email): void
|
||||
{
|
||||
$this->email = $email;
|
||||
@@ -36,6 +38,11 @@ class User extends BaseModel implements IUser
|
||||
}
|
||||
}
|
||||
|
||||
public function setActive($active): void
|
||||
{
|
||||
$this->active = (bool) $active;
|
||||
}
|
||||
|
||||
public function getEmail(): string
|
||||
{
|
||||
return $this->email;
|
||||
@@ -51,6 +58,11 @@ class User extends BaseModel implements IUser
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
public function hasPermission(int $permission): bool
|
||||
{
|
||||
switch ($permission) {
|
||||
@@ -63,6 +75,11 @@ class User extends BaseModel implements IUser
|
||||
}
|
||||
}
|
||||
|
||||
public function getDisplayName(): string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function checkPassword(string $password): bool
|
||||
{
|
||||
return password_verify($password, $this->password);
|
||||
|
||||
Reference in new issue
Block a user