mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: various improvements
wip: frontend feat: enable cascade on foreign keys wip1 wip2 fix chapters issues wip4
This commit is contained in:
parent
2bf80030d7
commit
187f75e583
71 changed files with 879 additions and 568 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from typing import Literal
|
||||
from fastapi import APIRouter, Depends, Request
|
||||
from sqlmodel import Session
|
||||
from src.security.auth import get_current_user
|
||||
|
|
@ -12,6 +13,7 @@ from src.db.users import (
|
|||
UserUpdatePassword,
|
||||
)
|
||||
from src.services.users.users import (
|
||||
authorize_user_action,
|
||||
create_user,
|
||||
create_user_without_org,
|
||||
delete_user_by_id,
|
||||
|
|
@ -33,6 +35,22 @@ async def api_get_current_user(current_user: User = Depends(get_current_user)):
|
|||
return current_user.dict()
|
||||
|
||||
|
||||
@router.get("/authorize/ressource/{ressource_uuid}/action/{action}")
|
||||
async def api_get_authorization_status(
|
||||
request: Request,
|
||||
ressource_uuid: str,
|
||||
action: Literal["create", "read", "update", "delete"],
|
||||
db_session: Session = Depends(get_db_session),
|
||||
current_user: PublicUser = Depends(get_current_user),
|
||||
):
|
||||
"""
|
||||
Get current user authorization status
|
||||
"""
|
||||
return await authorize_user_action(
|
||||
request, db_session, current_user, ressource_uuid, action
|
||||
)
|
||||
|
||||
|
||||
@router.post("/{org_id}", response_model=UserRead, tags=["users"])
|
||||
async def api_create_user_with_orgid(
|
||||
*,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue