refactor: filter out search results
This commit is contained in:
parent
ea675f29d6
commit
9d771acc24
1 changed files with 9 additions and 6 deletions
|
|
@ -26,13 +26,16 @@ async def get_all_user_permission_datasets(user: User, permission_type: str) ->
|
||||||
tenants = await user.awaitable_attrs.tenants
|
tenants = await user.awaitable_attrs.tenants
|
||||||
|
|
||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
# Get all datasets all tenant members have access to
|
# If tenant is the user's selected tenant add datasets that users roles in the tenant and the tenant itself
|
||||||
datasets.extend(await get_principal_datasets(tenant, permission_type))
|
# have access for
|
||||||
|
if tenant.id == user.tenant_id:
|
||||||
|
# Get all datasets all tenant members have access to
|
||||||
|
datasets.extend(await get_principal_datasets(tenant, permission_type))
|
||||||
|
|
||||||
# Get all datasets accessible by roles user is a part of
|
# Get all datasets accessible by roles user is a part of
|
||||||
roles = await user.awaitable_attrs.roles
|
roles = await user.awaitable_attrs.roles
|
||||||
for role in roles:
|
for role in roles:
|
||||||
datasets.extend(await get_principal_datasets(role, permission_type))
|
datasets.extend(await get_principal_datasets(role, permission_type))
|
||||||
|
|
||||||
# Deduplicate datasets with same ID
|
# Deduplicate datasets with same ID
|
||||||
unique = {}
|
unique = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue