refac
This commit is contained in:
@@ -253,6 +253,23 @@ async def filter_allowed_access_grants(
|
||||
):
|
||||
access_grants = strip_user_access_grants(access_grants)
|
||||
|
||||
if any(
|
||||
(grant.get('principal_type') if isinstance(grant, dict) else getattr(grant, 'principal_type', None))
|
||||
== 'group'
|
||||
for grant in access_grants
|
||||
) and not await has_permission(
|
||||
user_id,
|
||||
'access_grants.allow_groups',
|
||||
default_permissions,
|
||||
db=db,
|
||||
):
|
||||
access_grants = [
|
||||
grant
|
||||
for grant in access_grants
|
||||
if (grant.get('principal_type') if isinstance(grant, dict) else getattr(grant, 'principal_type', None))
|
||||
!= 'group'
|
||||
]
|
||||
|
||||
return access_grants
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user