Слияние ui -> main #1

Merged
sasheg merged 145 commits from ui into main 2026-08-20 13:54:02 +00:00
2 changed files with 15 additions and 1 deletions
Showing only changes of commit 6f53002266 - Show all commits
+2 -1
View File
@@ -383,7 +383,8 @@ async def get_current_user(
}
def require_role(min_role: int):
"""Декоратор для проверки роли"""
"""Dependency for checking minimum required role"""
from roles import UserRole
async def dependency(current_user: dict = Depends(get_current_user)):
if current_user["role"] < min_role:
from roles import ROLE_NAMES
+13
View File
@@ -9,6 +9,19 @@ class UserRole(IntEnum):
ELDER = 3 # Elder Moderator
CREATOR = 4 # Создатель
# Aliases for backwards compatibility with admin_router.py
ROLE_USER = UserRole.USER
ROLE_PASS_HOLDER = UserRole.PASS_HOLDER
ROLE_MODERATOR = UserRole.MODERATOR
ROLE_ELDER = UserRole.ELDER
ROLE_CREATOR = UserRole.CREATOR
__all__ = [
"UserRole", "ROLE_USER", "ROLE_PASS_HOLDER", "ROLE_MODERATOR",
"ROLE_ELDER", "ROLE_CREATOR", "ROLE_NAMES", "Permissions",
"ROLE_PERMISSIONS", "has_permission", "require_permission",
]
ROLE_NAMES: Dict[int, str] = {
UserRole.USER: "Игрок",
UserRole.PASS_HOLDER: "Игрок [Проходка]",