update meilis
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user