feat(users): add authorization management APIs

This commit is contained in:
2026-06-12 15:08:19 +03:30
parent 7cbc99a82f
commit 9acab4af2c
2 changed files with 164 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
"""Authentication-related API schemas."""
from datetime import datetime
from typing import Optional
from typing import List, Optional
from ninja import ModelSchema, Schema
@@ -206,6 +206,33 @@ class UserListSchema(ModelSchema):
return obj.get_university_display()
class AuthorizationRoleSchema(Schema):
key: str
label: str
description: str
enabled: bool = False
locked: bool = False
class UserAuthorizationSchema(Schema):
id: int
username: str
email: Optional[str] = None
mobile: Optional[str] = None
first_name: str
last_name: str
is_active: bool
is_staff: bool
is_superuser: bool
groups: List[str]
roles: List[AuthorizationRoleSchema]
class UserAuthorizationUpdateSchema(Schema):
is_staff: bool = False
groups: List[str] = []
class UserUpdateSchema(Schema):
email: Optional[str] = None
first_name: Optional[str] = None