Skip to content

Commit

Permalink
Revert "Feat/compliance" (#13798)
Browse files Browse the repository at this point in the history
  • Loading branch information
GareArc authored Feb 17, 2025
1 parent 7f9eb35 commit 4229d0f
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 71 deletions.
2 changes: 1 addition & 1 deletion api/controllers/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
from .auth import activate, data_source_bearer_auth, data_source_oauth, forgot_password, login, oauth

# Import billing controllers
from .billing import billing, compliance
from .billing import billing

# Import datasets controllers
from .datasets import (
Expand Down
35 changes: 0 additions & 35 deletions api/controllers/console/billing/compliance.py

This file was deleted.

6 changes: 0 additions & 6 deletions api/controllers/console/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,3 @@ class AccountInFreezeError(BaseHTTPException):
"This email account has been deleted within the past 30 days"
"and is temporarily unavailable for new account registration."
)


class CompilanceRateLimitError(BaseHTTPException):
error_code = "compilance_rate_limit"
description = "Rate limit exceeded for downloading compliance report."
code = 429
29 changes: 0 additions & 29 deletions api/services/billing_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
from tenacity import retry, retry_if_exception_type, stop_before_delay, wait_fixed

from extensions.ext_database import db
from libs.helper import RateLimiter
from models.account import TenantAccountJoin, TenantAccountRole


class BillingService:
base_url = os.environ.get("BILLING_API_URL", "BILLING_API_URL")
secret_key = os.environ.get("BILLING_API_SECRET_KEY", "BILLING_API_SECRET_KEY")

compliance_download_rate_limiter = RateLimiter("compliance_download_rate_limiter", 4, 60)

@classmethod
def get_info(cls, tenant_id: str):
params = {"tenant_id": tenant_id}
Expand Down Expand Up @@ -94,29 +91,3 @@ def update_account_deletion_feedback(cls, email: str, feedback: str):
"""Update account deletion feedback."""
json = {"email": email, "feedback": feedback}
return cls._send_request("POST", "/account/delete-feedback", json=json)

@classmethod
def get_compliance_download_link(
cls,
doc_name: str,
account_id: str,
tenant_id: str,
ip: str,
device_info: str,
):
limiter_key = f"{account_id}:{tenant_id}"
if cls.compliance_download_rate_limiter.is_rate_limited(limiter_key):
from controllers.console.error import CompilanceRateLimitError

raise CompilanceRateLimitError()

json = {
"doc_name": doc_name,
"account_id": account_id,
"tenant_id": tenant_id,
"ip_address": ip,
"device_info": device_info,
}
res = cls._send_request("POST", "/compliance/download", json=json)
cls.compliance_download_rate_limiter.increment_rate_limit(limiter_key)
return res

0 comments on commit 4229d0f

Please sign in to comment.