15 lines
791 B
Python
15 lines
791 B
Python
from fastapi import APIRouter, Depends
|
|
from ..dependencies import users_active, permissions_checker
|
|
from ..models import users
|
|
from typing import Annotated
|
|
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/users/", tags=["users"], response_model=list[users.User])
|
|
async def read_users(current_user: Annotated[users.User, Depends(users_active.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin"]))]):
|
|
return users_active.fake_users
|
|
|
|
@router.get("/users/me",tags=["users"], response_model=users.User)
|
|
async def read_users_me(current_user: Annotated[users.User, Depends(users_active.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))]):
|
|
return current_user |