sprint12+13: zentrale rechte settings page + ABAC engine backend (model, migration 0055, service, routes)

This commit is contained in:
Agent Zero
2026-07-29 02:42:16 +02:00
parent 2c14368b90
commit e0003b9384
13 changed files with 1075 additions and 0 deletions
+15
View File
@@ -700,6 +700,21 @@ async def check_entity_access(
return _rank(access) >= _rank(required_level)
async def list_all_permissions(
db: AsyncSession, tenant_id: uuid.UUID
) -> list[dict]:
"""List ALL permission entries for a tenant (global view)."""
result = await db.execute(
select(EntityPermission)
.where(EntityPermission.tenant_id == tenant_id)
.order_by(EntityPermission.entity_type, EntityPermission.created_at)
)
perms = result.scalars().all()
names = await _load_principal_names(db, perms)
return [_serialize_permission(p, names.get(p.principal_id)) for p in perms]
async def cleanup_expired_permissions(db: AsyncSession) -> int:
"""Delete all expired permission entries. Returns count deleted."""
now = datetime.now(UTC)