forked from sr2/cloud-api
feat: soft deleted users access blocked
This commit is contained in:
parent
a9e059bf0a
commit
bee0dcd4fe
2 changed files with 8 additions and 3 deletions
|
|
@ -10,12 +10,13 @@ Exports:
|
|||
from typing import Annotated
|
||||
from fastapi import Depends, Query
|
||||
|
||||
from src.user.exceptions import UserNotFoundException
|
||||
from src.user.models import User
|
||||
|
||||
from src.auth.service import claims_dependency
|
||||
from src.database import DbSession
|
||||
from src.schemas import UserIDMixin
|
||||
from src.exceptions import ForbiddenException
|
||||
|
||||
from src.user.exceptions import UserNotFoundException
|
||||
from src.user.models import User
|
||||
|
||||
|
||||
async def get_user_model_claims(claims: claims_dependency, db: DbSession):
|
||||
|
|
@ -27,6 +28,9 @@ async def get_user_model_claims(claims: claims_dependency, db: DbSession):
|
|||
if user_model is None:
|
||||
raise UserNotFoundException(user_id=user_id)
|
||||
|
||||
if not user_model.active:
|
||||
raise ForbiddenException("User account is not active")
|
||||
|
||||
return user_model
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Endpoints:
|
|||
- [GET](/user/): [super admin]: Returns user(id) details.
|
||||
- [DELETE](/user/): [super admin]: Removes a User(id) from the hub database.
|
||||
"""
|
||||
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from fastapi import APIRouter, status, BackgroundTasks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue