company flows
This commit is contained in:
parent
6541284a4c
commit
cc3f3f3de5
17 changed files with 1960 additions and 66 deletions
19
backend/app/deps/org_manager.py
Normal file
19
backend/app/deps/org_manager.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from fastapi import Depends, HTTPException, status
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database import get_postgres_session
|
||||
from app.models import Account
|
||||
from app.routers.auth import get_current_account
|
||||
from app.services.org_members import can_manage_org_members
|
||||
|
||||
|
||||
async def require_org_manager(
|
||||
account: Account = Depends(get_current_account),
|
||||
session: AsyncSession = Depends(get_postgres_session),
|
||||
) -> Account:
|
||||
if not await can_manage_org_members(session, account):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="Only company admins can manage organization settings.",
|
||||
)
|
||||
return account
|
||||
Loading…
Add table
Add a link
Reference in a new issue