fix: solución de bloqueos y estandarización de permisos
This commit is contained in:
@@ -32,7 +32,7 @@ async def list_manifests(
|
||||
"""
|
||||
List all manifests for a company with pagination and filters
|
||||
"""
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, required_permissions=["export_manifest.view"])
|
||||
filters = {
|
||||
"search": search,
|
||||
"manifest_number": manifest_number,
|
||||
@@ -57,7 +57,7 @@ async def create_manifest(
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, required_permissions=["export_manifest.view"])
|
||||
return ManifestService.create(db, manifest_data, tenant_id, company_id)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ async def get_manifest(
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, required_permissions=["export_manifest.view"])
|
||||
manifest = ManifestService.get_by_id(db, manifest_id, tenant_id, company_id)
|
||||
if not manifest:
|
||||
raise HTTPException(status_code=404, detail="Manifest not found")
|
||||
@@ -83,7 +83,7 @@ async def update_manifest(
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, required_permissions=["export_manifest.view"])
|
||||
manifest = ManifestService.update(
|
||||
db, manifest_id, tenant_id, company_id, manifest_data
|
||||
)
|
||||
@@ -99,7 +99,7 @@ async def delete_manifest(
|
||||
db: Session = Depends(get_core_db),
|
||||
current_user: dict = Depends(get_current_user),
|
||||
):
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user)
|
||||
tenant_id = validate_access_to_resource(db, company_id, current_user, required_permissions=["export_manifest.view"])
|
||||
success = ManifestService.delete(db, manifest_id, tenant_id, company_id)
|
||||
if not success:
|
||||
raise HTTPException(status_code=404, detail="Manifest not found")
|
||||
|
||||
Reference in New Issue
Block a user