feat(users): add authorization management APIs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user