Imporve the role based forntend protected roles
This commit is contained in:
@@ -67,6 +67,32 @@ async def register_bakery_enhanced(
|
||||
detail="Bakery registration failed"
|
||||
)
|
||||
|
||||
@router.get("/tenants/{tenant_id}/my-access", response_model=TenantAccessResponse)
|
||||
async def get_current_user_tenant_access(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep)
|
||||
):
|
||||
"""Get current user's access to tenant with role and permissions"""
|
||||
|
||||
try:
|
||||
# Create tenant service directly
|
||||
from app.core.config import settings
|
||||
database_manager = create_database_manager(settings.DATABASE_URL, "tenant-service")
|
||||
tenant_service = EnhancedTenantService(database_manager)
|
||||
|
||||
access_info = await tenant_service.verify_user_access(current_user["user_id"], str(tenant_id))
|
||||
return access_info
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Current user access verification failed",
|
||||
user_id=current_user["user_id"],
|
||||
tenant_id=str(tenant_id),
|
||||
error=str(e))
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail="Access verification failed"
|
||||
)
|
||||
|
||||
@router.get("/tenants/{tenant_id}/access/{user_id}", response_model=TenantAccessResponse)
|
||||
async def verify_tenant_access_enhanced(
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
|
||||
Reference in New Issue
Block a user