[+] новая структура ролей

This commit is contained in:
rsgrinko committed 2023-03-01 23:16:08 +03:00
1 parent 52005a6299
commit d1236ae1ef
6 files changed
+71 -115

No files matched your search

@@ -105,7 +105,7 @@
*
* @return $this
*/
public function setChat(int $chatId): self
public function setChat(string $chatId): self
{
$this->chatId = $chatId;
return $this;
+11 -1
View File
@@ -42,10 +42,20 @@
*/
const ADMIN_ROLE_ID = 1;
/**
* Роль "система"
*/
const SYSTEM_ROLE_ID = 2;
/**
* Роль "доступ в панель администратора"
*/
const ADMIN_PANEL_ROLE_ID = 3;
/**
* Роль "пользователь"
*/
const USER_ROLE_ID = 2;
const USER_ROLE_ID = 5;
/**
* @var User $user
+11
View File
@@ -641,6 +641,17 @@
return in_array(Roles::ADMIN_ROLE_ID, $this->getRolesObject()->getRoles(), true);
}
/**
* Проверка на админа
*
* @return bool
* @throws CoreException
*/
public function haveAccessToAdminPanel(): bool
{
return in_array(Roles::ADMIN_PANEL_ROLE_ID, $this->getRolesObject()->getRoles(), true);
}
/**
* Метод выхода из системы
*/