New enterprise feature

This commit is contained in:
Urtzi Alfaro
2025-11-30 09:12:40 +01:00
parent f9d0eec6ec
commit 972db02f6d
176 changed files with 19741 additions and 1361 deletions

View File

@@ -92,6 +92,12 @@ class QuotaLimits:
SubscriptionTier.ENTERPRISE: None, # Unlimited
}
MAX_CHILD_TENANTS = {
SubscriptionTier.STARTER: 0,
SubscriptionTier.PROFESSIONAL: 0,
SubscriptionTier.ENTERPRISE: 50, # Default limit for enterprise tier
}
# ===== ML & Analytics Quotas (Daily Limits) =====
TRAINING_JOBS_PER_DAY = {
SubscriptionTier.STARTER: 1,
@@ -296,6 +302,12 @@ class PlanFeatures:
'production_distribution', # NEW: Hero feature - Central production → multi-store distribution
'centralized_dashboard', # NEW: Hero feature - Single control panel for all operations
'multi_tenant_management',
'parent_child_tenants', # NEW: Enterprise tier feature - hierarchical tenant model
'internal_transfers', # NEW: Internal PO transfers between parent/child
'distribution_management', # NEW: Internal transfer management
'transfer_pricing', # NEW: Cost-based transfer pricing
'centralized_demand_aggregation', # NEW: Aggregate demand from all child tenants
'multi_location_dashboard', # NEW: Dashboard spanning multiple locations
# Advanced Integration
'full_api_access',
@@ -360,6 +372,40 @@ class PlanFeatures:
feature in PlanFeatures.ENTERPRISE_FEATURES
)
@staticmethod
def validate_tenant_access(tier: str, tenant_type: str) -> bool:
"""
Validate tenant type is allowed for subscription tier
Args:
tier: Subscription tier (starter, professional, enterprise)
tenant_type: Tenant type (standalone, parent, child)
Returns:
bool: True if tenant type is allowed for this tier
"""
tier_enum = SubscriptionTier(tier.lower())
# Only enterprise can have parent/child hierarchy
if tenant_type in ["parent", "child"]:
return tier_enum == SubscriptionTier.ENTERPRISE
# Standalone tenants allowed for all tiers
return tenant_type == "standalone"
@staticmethod
def validate_internal_transfers(tier: str) -> bool:
"""
Check if tier can use internal transfers
Args:
tier: Subscription tier
Returns:
bool: True if tier has access to internal transfers
"""
return PlanFeatures.has_feature(tier, "internal_transfers")
# ============================================================================
# FEATURE DISPLAY CONFIGURATION (User-Facing)