supplychain/scripts/load_path.py
ymq 2bc6288fae feat(pipeline): 适配 pipeline 部署
- scripts/load_path.py: Sage 格式(硬编码 sage 库+旧 permission 表) → pipeline 格式(set_role_perm.py)
  159 路径(any=1 logined=158)
- init.py: 2 处 db.sqlorContext('sage') 直接连库名 → db.sqlorContext(dbname) 动态映射
  (pipeline 单库,organization/product 都在 pipeline 库;get_sor_context/get_module_dbname
  已走映射无需改)
2026-08-26 16:40:14 +08:00

191 lines
9.9 KiB
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""RBAC path registration for supplychain module.
宿主根目录执行py3/bin/python pkgs/supplychain/scripts/load_path.py
pipeline-app 的 load_path.sh 会自动扫描 pkgs/*/scripts/load_path.py
"""
import subprocess
MOD = "supplychain"
PATHS_ANY = [
"/supplychain/menu.ui",
]
PATHS_LOGINED = [
"/supplychain",
"/supplychain/accounting.ui",
"/supplychain/add_provider_recharge.dspy",
"/supplychain/add_provider_settlement.dspy",
"/supplychain/api/calculate_accounting.dspy",
"/supplychain/api/contract_attach.ui",
"/supplychain/api/contract_attach_delete.dspy",
"/supplychain/api/contract_attach_list.dspy",
"/supplychain/api/contract_upload.dspy",
"/supplychain/api/distribution_agreement_items_create.dspy",
"/supplychain/api/distribution_agreement_items_delete.dspy",
"/supplychain/api/distribution_agreement_items_update.dspy",
"/supplychain/api/distribution_agreements_create.dspy",
"/supplychain/api/distribution_agreements_delete.dspy",
"/supplychain/api/distribution_agreements_update.dspy",
"/supplychain/api/get_search_agreement_id.dspy",
"/supplychain/api/get_search_contract_id.dspy",
"/supplychain/api/get_search_orgid.dspy",
"/supplychain/api/get_search_prodtypeid.dspy",
"/supplychain/api/get_search_productid.dspy",
"/supplychain/api/get_search_sub_distributor_id.dspy",
"/supplychain/api/get_search_sub_reseller_id.dspy",
"/supplychain/api/get_search_supplier_id.dspy",
"/supplychain/api/get_search_supply_relation_id.dspy",
"/supplychain/api/import_supplier_product.dspy",
"/supplychain/api/platform_supply_products_create.dspy",
"/supplychain/api/platform_supply_products_delete.dspy",
"/supplychain/api/platform_supply_products_update.dspy",
"/supplychain/api/platform_supply_relations_create.dspy",
"/supplychain/api/platform_supply_relations_delete.dspy",
"/supplychain/api/platform_supply_relations_update.dspy",
"/supplychain/api/product_supplier_mapping_create.dspy",
"/supplychain/api/product_supplier_mapping_delete.dspy",
"/supplychain/api/product_supplier_mapping_update.dspy",
"/supplychain/api/query_dist_discount.dspy",
"/supplychain/api/query_platform_products.dspy",
"/supplychain/api/query_platform_suppliers.dspy",
"/supplychain/api/query_supply_discount.dspy",
"/supplychain/api/sales_ledger_create.dspy",
"/supplychain/api/sales_ledger_delete.dspy",
"/supplychain/api/sales_ledger_update.dspy",
"/supplychain/api/sub_distributors_create.dspy",
"/supplychain/api/sub_distributors_delete.dspy",
"/supplychain/api/sub_distributors_update.dspy",
"/supplychain/api/sub_resellers_create.dspy",
"/supplychain/api/sub_resellers_delete.dspy",
"/supplychain/api/sub_resellers_update.dspy",
"/supplychain/api/supplier_resource_price_create.dspy",
"/supplychain/api/supplier_resource_price_delete.dspy",
"/supplychain/api/supplier_resource_price_update.dspy",
"/supplychain/api/suppliers_create.dspy",
"/supplychain/api/suppliers_delete.dspy",
"/supplychain/api/suppliers_update.dspy",
"/supplychain/api/supply_contract_items_create.dspy",
"/supplychain/api/supply_contract_items_delete.dspy",
"/supplychain/api/supply_contract_items_update.dspy",
"/supplychain/api/supply_contracts_create.dspy",
"/supplychain/api/supply_contracts_delete.dspy",
"/supplychain/api/supply_contracts_update.dspy",
"/supplychain/api/supplychain_accounting_create.dspy",
"/supplychain/api/supplychain_accounting_delete.dspy",
"/supplychain/api/supplychain_accounting_update.dspy",
"/supplychain/distribution_agreement_items_list",
"/supplychain/distribution_agreement_items_list/add_distribution_agreement_items.dspy",
"/supplychain/distribution_agreement_items_list/delete_distribution_agreement_items.dspy",
"/supplychain/distribution_agreement_items_list/get_distribution_agreement_items.dspy",
"/supplychain/distribution_agreement_items_list/index.ui",
"/supplychain/distribution_agreement_items_list/update_distribution_agreement_items.dspy",
"/supplychain/distribution_agreements.ui",
"/supplychain/distribution_agreements_list",
"/supplychain/distribution_agreements_list/add_distribution_agreements.dspy",
"/supplychain/distribution_agreements_list/delete_distribution_agreements.dspy",
"/supplychain/distribution_agreements_list/get_distribution_agreements.dspy",
"/supplychain/distribution_agreements_list/index.ui",
"/supplychain/distribution_agreements_list/update_distribution_agreements.dspy",
"/supplychain/get_provider_detail_reconcile.dspy",
"/supplychain/get_provider_recharge.dspy",
"/supplychain/get_provider_reconcile.dspy",
"/supplychain/get_provider_settlement.dspy",
"/supplychain/get_reseller_detail_reconcile.dspy",
"/supplychain/get_reseller_reconcile.dspy",
"/supplychain/get_reseller_settlement.dspy",
"/supplychain/index.ui",
"/supplychain/platform_supply_products_list",
"/supplychain/platform_supply_products_list/add_platform_supply_products.dspy",
"/supplychain/platform_supply_products_list/delete_platform_supply_products.dspy",
"/supplychain/platform_supply_products_list/get_platform_supply_products.dspy",
"/supplychain/platform_supply_products_list/index.ui",
"/supplychain/platform_supply_products_list/update_platform_supply_products.dspy",
"/supplychain/platform_supply_relations_list",
"/supplychain/platform_supply_relations_list/add_platform_supply_relations.dspy",
"/supplychain/platform_supply_relations_list/delete_platform_supply_relations.dspy",
"/supplychain/platform_supply_relations_list/get_platform_supply_relations.dspy",
"/supplychain/platform_supply_relations_list/index.ui",
"/supplychain/platform_supply_relations_list/update_platform_supply_relations.dspy",
"/supplychain/product_supplier_mapping_list",
"/supplychain/product_supplier_mapping_list/add_product_supplier_mapping.dspy",
"/supplychain/product_supplier_mapping_list/delete_product_supplier_mapping.dspy",
"/supplychain/product_supplier_mapping_list/get_product_supplier_mapping.dspy",
"/supplychain/product_supplier_mapping_list/index.ui",
"/supplychain/product_supplier_mapping_list/update_product_supplier_mapping.dspy",
"/supplychain/provider_detail_reconcile.ui",
"/supplychain/provider_recharge.ui",
"/supplychain/provider_reconcile.ui",
"/supplychain/provider_settlement.ui",
"/supplychain/reseller_detail_reconcile.ui",
"/supplychain/reseller_reconcile.ui",
"/supplychain/reseller_settlement.ui",
"/supplychain/sales_ledger_list",
"/supplychain/sales_ledger_list/add_sales_ledger.dspy",
"/supplychain/sales_ledger_list/delete_sales_ledger.dspy",
"/supplychain/sales_ledger_list/get_sales_ledger.dspy",
"/supplychain/sales_ledger_list/index.ui",
"/supplychain/sales_ledger_list/update_sales_ledger.dspy",
"/supplychain/sub_distributors.ui",
"/supplychain/sub_distributors_list",
"/supplychain/sub_distributors_list/add_sub_distributors.dspy",
"/supplychain/sub_distributors_list/delete_sub_distributors.dspy",
"/supplychain/sub_distributors_list/get_sub_distributors.dspy",
"/supplychain/sub_distributors_list/index.ui",
"/supplychain/sub_distributors_list/update_sub_distributors.dspy",
"/supplychain/sub_resellers_list",
"/supplychain/sub_resellers_list/add_sub_resellers.dspy",
"/supplychain/sub_resellers_list/delete_sub_resellers.dspy",
"/supplychain/sub_resellers_list/get_sub_resellers.dspy",
"/supplychain/sub_resellers_list/index.ui",
"/supplychain/sub_resellers_list/update_sub_resellers.dspy",
"/supplychain/supplier_resource_price_list",
"/supplychain/supplier_resource_price_list/index.ui",
"/supplychain/suppliers.ui",
"/supplychain/suppliers_list",
"/supplychain/suppliers_list/add_suppliers.dspy",
"/supplychain/suppliers_list/delete_suppliers.dspy",
"/supplychain/suppliers_list/get_suppliers.dspy",
"/supplychain/suppliers_list/index.ui",
"/supplychain/suppliers_list/update_suppliers.dspy",
"/supplychain/supply_contract_items_list",
"/supplychain/supply_contract_items_list/add_supply_contract_items.dspy",
"/supplychain/supply_contract_items_list/delete_supply_contract_items.dspy",
"/supplychain/supply_contract_items_list/get_supply_contract_items.dspy",
"/supplychain/supply_contract_items_list/index.ui",
"/supplychain/supply_contract_items_list/update_supply_contract_items.dspy",
"/supplychain/supply_contracts.ui",
"/supplychain/supply_contracts_list",
"/supplychain/supply_contracts_list/add_supply_contracts.dspy",
"/supplychain/supply_contracts_list/delete_supply_contracts.dspy",
"/supplychain/supply_contracts_list/get_supply_contracts.dspy",
"/supplychain/supply_contracts_list/index.ui",
"/supplychain/supply_contracts_list/update_supply_contracts.dspy",
"/supplychain/supplychain_accounting_list",
"/supplychain/supplychain_accounting_list/add_supplychain_accounting.dspy",
"/supplychain/supplychain_accounting_list/delete_supplychain_accounting.dspy",
"/supplychain/supplychain_accounting_list/get_supplychain_accounting.dspy",
"/supplychain/supplychain_accounting_list/index.ui",
"/supplychain/supplychain_accounting_list/update_supplychain_accounting.dspy",
"/supplychain/update_provider_recharge.dspy",
"/supplychain/update_provider_settlement.dspy",
"/supplychain/update_reseller_settlement.dspy",
]
def register_paths():
for path in PATHS_ANY:
subprocess.run(["py3/bin/python", "set_role_perm.py", "any", path])
print(f" any: {path}")
for path in PATHS_LOGINED:
subprocess.run(["py3/bin/python", "set_role_perm.py", "logined", path])
print(f" logined: {path}")
if __name__ == "__main__":
print("=== supplychain RBAC registration ===")
register_paths()
print("Done. any=1 logined=158")