test: Resolve issue permission example

This commit is contained in:
Igor Ilic 2025-11-04 19:17:02 +01:00
parent fb102f29a8
commit db2a32dd17
2 changed files with 2 additions and 9 deletions

View file

@ -79,18 +79,11 @@ def upgrade() -> None:
if not tenant_id_column:
op.add_column("datasets", sa.Column("tenant_id", sa.UUID(), nullable=True))
# Build correlated subquery: select users.tenant_id for each dataset.owner_id
# Build subquery, select users.tenant_id for each dataset.owner_id
tenant_id_from_dataset_owner = (
sa.select(user.c.tenant_id).where(user.c.id == dataset.c.owner_id).scalar_subquery()
)
# Update statement; restrict to rows where tenant_id is currently NULL
# update_stmt = (
# sa.update(dataset)
# .values(tenant_id=subq)
# )
user = _define_user_table()
if op.get_context().dialect.name == "sqlite":
# If column doesn't exist create new original_extension column and update from values of extension column
with op.batch_alter_table("datasets") as batch_op:

View file

@ -151,7 +151,7 @@ async def main():
# To add a user to a role he must be part of the same tenant/organization
print("\nOperation started as user_2 to add user_3 to CogneeLab tenant/organization")
await add_user_to_tenant(
user_id=user_3.id, tenant_id=tenant_id, owner_id=user_2.id, set_active_tenant=True
user_id=user_3.id, tenant_id=tenant_id, owner_id=user_2.id, set_as_active_tenant=True
)
print(