Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 20, 2024
1 parent 3a40414 commit 9be3690
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 9 additions & 1 deletion backend/ee/onyx/server/tenants/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,19 @@ async def impersonate_user(
@router.post("/leave-organization")
async def leave_organization(
user_email: UserByEmail,
_: User = Depends(current_admin_user),
current_user: User | None = Depends(current_admin_user),
db_session: Session = Depends(get_session),
tenant_id: str = Depends(get_current_tenant_id),
) -> None:
if current_user is None or current_user.email != user_email.user_email:
raise HTTPException(
status_code=403, detail="You can only leave the organization as yourself"
)

user_to_delete = get_user_by_email(user_email.user_email, db_session)
if user_to_delete is None:
raise HTTPException(status_code=404, detail="User not found")

num_admin_users = await get_user_count(only_admin_users=True)

should_delete_tenant = num_admin_users == 1
Expand Down
1 change: 0 additions & 1 deletion backend/ee/onyx/server/tenants/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def register_tenant_users(tenant_id: str, number_of_users: int) -> stripe.Subscr
"""
Send a request to the control service to register the number of users for a tenant.
"""
return None
if not STRIPE_PRICE_ID:
raise Exception("STRIPE_PRICE_ID is not set")

Expand Down

0 comments on commit 9be3690

Please sign in to comment.