Kaynağa Gözat

fix: get billing info in self-hosted edition from current workspace (#1774)

tags/0.3.34
zxhlyh 1 yıl önce
ebeveyn
işleme
1a5279a3ef
No account linked to committer's email address
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6
    3
      api/services/workspace_service.py

+ 6
- 3
api/services/workspace_service.py Dosyayı Görüntüle

from flask import current_app
from flask_login import current_user from flask_login import current_user
from extensions.ext_database import db from extensions.ext_database import db
from models.account import Tenant, TenantAccountJoin, TenantAccountJoinRole from models.account import Tenant, TenantAccountJoin, TenantAccountJoinRole
).first() ).first()
tenant_info['role'] = tenant_account_join.role tenant_info['role'] = tenant_account_join.role


billing_info = BillingService.get_info(tenant_info['id'])
edition = current_app.config['EDITION']
if edition == 'CLOUD':
billing_info = BillingService.get_info(tenant_info['id'])


if billing_info['can_replace_logo'] and TenantService.has_roles(tenant, [TenantAccountJoinRole.OWNER, TenantAccountJoinRole.ADMIN]):
tenant_info['custom_config'] = tenant.custom_config_dict
if billing_info['can_replace_logo'] and TenantService.has_roles(tenant, [TenantAccountJoinRole.OWNER, TenantAccountJoinRole.ADMIN]):
tenant_info['custom_config'] = tenant.custom_config_dict


# Get providers # Get providers
providers = db.session.query(Provider).filter( providers = db.session.query(Provider).filter(

Loading…
İptal
Kaydet