fix: solución de bloqueos y estandarización de permisos

This commit is contained in:
2026-04-27 10:47:30 -05:00
parent fa3cbb4d0a
commit 5c2a84e95d
312 changed files with 13889 additions and 7911 deletions

View File

@@ -29,6 +29,9 @@ async def get_creation_data(
Get all catalogs needed for creating a new pedimento.
Consolidates multiple catalog calls into a single endpoint.
"""
from core.security import validate_access_to_resource
validate_access_to_resource(db, company_id, current_user, ["pedimentos_mgmt.view"])
tenant_id = current_user["tenant_id"]
try:
@@ -51,6 +54,9 @@ async def get_edition_data(
Get all catalogs and pedimento data needed for editing an existing pedimento.
Consolidates multiple catalog calls + pedimento fetch into a single endpoint.
"""
from core.security import validate_access_to_resource
validate_access_to_resource(db, company_id, current_user, ["pedimentos_mgmt.view"])
tenant_id = current_user["tenant_id"]
try:
@@ -84,6 +90,11 @@ crud_router = TenantCRUDRoutes(
enable_filters=True, # Enable status, client_id, year filters
default_page_size=50,
max_page_size=1000,
list_permissions=["pedimentos_mgmt.view"],
get_permissions=["pedimentos_mgmt.view"],
create_permissions=["pedimentos_mgmt.create"],
update_permissions=["pedimentos_mgmt.edit"],
delete_permissions=["pedimentos_mgmt.delete"],
).router
# Include the CRUD routes into our main router