Aplicar lógica de validación de tenant y compañía a todos los endpoints relevantes en los módulos: client_and_provider, classes, country_rule_oct, exchange_rate, fraction_rule_octave, package, parts, permission_rule_oct, seal
This commit is contained in:
@@ -35,6 +35,13 @@ async def list_classes(
|
||||
"""
|
||||
List classes with optional filters and pagination
|
||||
"""
|
||||
# Validate access to the tenant and company
|
||||
tenant_id = current_user.get("tenant_id")
|
||||
company_id = current_user.get("company_id")
|
||||
|
||||
if not tenant_id or not company_id:
|
||||
raise HTTPException(status_code=403, detail="Access denied: Tenant or Company not found")
|
||||
|
||||
service = ClassService(db)
|
||||
search_params = ClassSearchDTO(
|
||||
client_id=client_id,
|
||||
@@ -58,6 +65,13 @@ async def get_classes_by_client(
|
||||
"""
|
||||
Get all classes for a specific client
|
||||
"""
|
||||
# Validate access to the tenant and company
|
||||
tenant_id = current_user.get("tenant_id")
|
||||
company_id = current_user.get("company_id")
|
||||
|
||||
if not tenant_id or not company_id:
|
||||
raise HTTPException(status_code=403, detail="Access denied: Tenant or Company not found")
|
||||
|
||||
service = ClassService(db)
|
||||
return service.search_by_client(client_id, skip, limit)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user