feat: auth requirements to user endpoints
This commit is contained in:
parent
7e8ec08283
commit
789d7d9f7a
1 changed files with 3 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ from starlette import status
|
||||||
from src.user.schemas import UserResponse, OIDCClaims, UserDeleteUserRequest
|
from src.user.schemas import UserResponse, OIDCClaims, UserDeleteUserRequest
|
||||||
from src.user.dependencies import user_model_claims_dependency, user_model_query_dependency, user_model_body_dependency
|
from src.user.dependencies import user_model_claims_dependency, user_model_query_dependency, user_model_body_dependency
|
||||||
|
|
||||||
|
from src.auth.dependencies import super_admin_dependency
|
||||||
from src.auth.service import claims_dependency
|
from src.auth.service import claims_dependency
|
||||||
from src.database import db_dependency
|
from src.database import db_dependency
|
||||||
|
|
||||||
|
|
@ -52,7 +53,7 @@ async def current_user(user_model: user_model_claims_dependency):
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||||
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
status.HTTP_200_OK: {"description": "Successful retrieval from database"},
|
||||||
})
|
})
|
||||||
async def get_user_by_id(user_model: user_model_query_dependency):
|
async def get_user_by_id(user_model: user_model_query_dependency, su: super_admin_dependency):
|
||||||
"""
|
"""
|
||||||
Returns the database details associated with the provided user ID.
|
Returns the database details associated with the provided user ID.
|
||||||
"""
|
"""
|
||||||
|
|
@ -63,7 +64,7 @@ async def get_user_by_id(user_model: user_model_query_dependency):
|
||||||
status.HTTP_204_NO_CONTENT: {"description": "User deleted"},
|
status.HTTP_204_NO_CONTENT: {"description": "User deleted"},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "User not found"},
|
||||||
})
|
})
|
||||||
async def delete_user_by_id(db: db_dependency, user_model: user_model_body_dependency, request_model: UserDeleteUserRequest):
|
async def delete_user_by_id(db: db_dependency, user_model: user_model_body_dependency, su: super_admin_dependency, request_model: UserDeleteUserRequest):
|
||||||
"""
|
"""
|
||||||
Deletes the user with the provided ID from the database. This will not remove them from OIDC, and they will be automatically readded on next login.
|
Deletes the user with the provided ID from the database. This will not remove them from OIDC, and they will be automatically readded on next login.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue