update meilis

This commit is contained in:
2025-07-05 15:08:06 -03:00
parent 0df4d7aa71
commit d002828afa
17 changed files with 430 additions and 45 deletions

View File

@@ -13,7 +13,13 @@ from aws_lambda_powertools.event_handler.middlewares import (
BaseMiddlewareHandler,
NextMiddleware,
)
from layercake.dynamodb import ComposeKey, DynamoDBCollection, KeyPair
from layercake.dynamodb import (
ComposeKey,
DynamoDBCollection,
KeyPair,
SortKey,
TransactKey,
)
from pydantic import UUID4, BaseModel
from auth import AuthFlowType
@@ -117,11 +123,16 @@ def _tenant(
raise BadRequestError('Missing tenant')
# Ensure user has ACL
collection.get_item(
KeyPair(user.id, ComposeKey(tenant_id, prefix='acls')),
exc_cls=ForbiddenError,
acls = collection.get_items(
TransactKey(user.id)
+ SortKey(ComposeKey('*', prefix='acls'))
+ SortKey(ComposeKey(tenant_id, prefix='acls')),
flatten_top=False,
)
if not acls:
raise ForbiddenError
# For root tenant, provide the default Tenant
if tenant_id == '*':
return Tenant(id=tenant_id, name='default')