Prepare ERP source for Gitea deployment

This commit is contained in:
A R R R Associates
2026-06-20 15:01:44 +05:30
commit 5c75eb6bd9
450 changed files with 67698 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
"""Scope guard utilities for tenant/branch enforcement (v2.0.3.1)"""
from typing import Optional
class ScopeError(Exception):
pass
def ensure_same_tenant(actor_tenant_id: int, target_tenant_id: int):
if actor_tenant_id != target_tenant_id:
raise ScopeError("Cross-tenant operation is not allowed")
def ensure_same_branch(actor_branch_id: int, target_branch_id: int):
if actor_branch_id != target_branch_id:
raise ScopeError("Cross-branch operation is not allowed")
def validate_branch_belongs_to_tenant(branch_tenant_id: int, tenant_id: int):
if branch_tenant_id != tenant_id:
raise ScopeError("Branch does not belong to selected tenant")