Files
service-finder/backend/check_user_scope.py
2026-06-04 07:26:22 +00:00

27 lines
1010 B
Python

import asyncio
from app.db.session import AsyncSessionLocal
from app.models.identity import User
from app.core.security import create_tokens
from sqlalchemy import select
async def main():
async with AsyncSessionLocal() as db:
result = await db.execute(select(User).where(User.id == 28))
user = result.scalar_one_or_none()
if not user:
print("User 28 not found")
return
print(f"User found: {user.email}, Scope ID: {user.scope_id}, Scope Level: {user.scope_level}")
# Check organization membership
from app.models.marketplace.organization import OrganizationMember
org_result = await db.execute(
select(OrganizationMember).where(OrganizationMember.user_id == 28)
)
memberships = org_result.scalars().all()
for m in memberships:
print(f"Organization membership: org_id={m.organization_id}, role={m.role}")
if __name__ == "__main__":
asyncio.run(main())