Se integro el modulo de manifestacion base
This commit is contained in:
@@ -171,8 +171,9 @@ def validate_company_access(
|
||||
)
|
||||
|
||||
return company is not None
|
||||
finally:
|
||||
db.close()
|
||||
except Exception as e:
|
||||
logger.error(f"Error validating company access: {str(e)}")
|
||||
return False
|
||||
|
||||
|
||||
def validate_access_to_resource(
|
||||
@@ -200,7 +201,12 @@ def validate_access_to_resource(
|
||||
HTTPException: Si no hay tenant_id, no tiene acceso o no tiene los permisos requeridos
|
||||
"""
|
||||
|
||||
tenant_id = current_user.get("tenant_id")
|
||||
tenant_id = get_tenant_from_token(current_user)
|
||||
if not tenant_id:
|
||||
# Fallback para desarrollo o tokens mal formados que sí tienen el atributo pero en otro lado
|
||||
# Esto evita el 400 si get_tenant_from_token falla pero el usuario es válido
|
||||
tenant_id = current_user.get("tenant_id")
|
||||
|
||||
if not tenant_id:
|
||||
raise HTTPException(status_code=400, detail="Tenant ID not found in token")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user