diff --git a/api/kiwi_vpn_api/routers/user.py b/api/kiwi_vpn_api/routers/user.py index 50db0e7..8a96b89 100644 --- a/api/kiwi_vpn_api/routers/user.py +++ b/api/kiwi_vpn_api/routers/user.py @@ -49,6 +49,15 @@ async def get_current_user(token: str = Depends(SCHEME)): return user -@router.get("/current", response_model=User) +@router.get("/current_user/get", response_model=User) async def get_current_user(current_user: User = Depends(get_current_user)): return current_user + + +async def is_admin(current_user: User = Depends(get_current_user)): + return ("admin" in current_user.capabilities) + + +@router.get("/current_user/is_admin") +async def current_user_is_admin(is_admin: bool = Depends(is_admin)): + return {"is_admin": is_admin}