From 2bc6288fae8f6f1c4b657d70efe1d4cc1a2bd6a4 Mon Sep 17 00:00:00 2001 From: ymq Date: Wed, 26 Aug 2026 16:40:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(pipeline):=20=E9=80=82=E9=85=8D=20pipeline?= =?UTF-8?q?=20=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 已走映射无需改) --- scripts/load_path.py | 377 ++++++++++++++++++++----------------------- supplychain/init.py | 4 +- 2 files changed, 181 insertions(+), 200 deletions(-) diff --git a/scripts/load_path.py b/scripts/load_path.py index 981d8af..54c1204 100755 --- a/scripts/load_path.py +++ b/scripts/load_path.py @@ -1,209 +1,190 @@ -"""Generate RBAC permissions for supplychain module paths. +#!/usr/bin/env python3 +"""RBAC path registration for supplychain module. -Run from Sage root with Sage venv: - cd ~/repos/sage && ./py3/bin/python ../supplychain/scripts/load_path.py +宿主根目录执行:py3/bin/python pkgs/supplychain/scripts/load_path.py +(pipeline-app 的 load_path.sh 会自动扫描 pkgs/*/scripts/load_path.py) """ -import os -import sys -import asyncio +import subprocess -sage_root = os.environ.get('SAGE_ROOT') -if sage_root and sage_root not in sys.path: - sys.path.insert(0, sage_root) +MOD = "supplychain" -from sqlor.dbpools import DBPools -from appPublic.jsonConfig import getConfig -from appPublic.dictObject import DictObject -from appPublic.uniqueID import getID +PATHS_ANY = [ + "/supplychain/menu.ui", +] +PATHS_LOGINED = [ -paths = [ - ("/supplychain", "logined"), - ("/supplychain/api/calculate_accounting.dspy", "logined"), - ("/supplychain/api/distribution_agreement_items_create.dspy", "logined"), - ("/supplychain/api/distribution_agreement_items_delete.dspy", "logined"), - ("/supplychain/api/distribution_agreement_items_update.dspy", "logined"), - ("/supplychain/api/distribution_agreements_create.dspy", "logined"), - ("/supplychain/api/distribution_agreements_delete.dspy", "logined"), - ("/supplychain/api/distribution_agreements_update.dspy", "logined"), - ("/supplychain/api/get_search_agreement_id.dspy", "logined"), - ("/supplychain/api/get_search_contract_id.dspy", "logined"), - ("/supplychain/api/get_search_orgid.dspy", "logined"), - ("/supplychain/api/get_search_prodtypeid.dspy", "logined"), - ("/supplychain/api/get_search_productid.dspy", "logined"), - ("/supplychain/api/get_search_sub_distributor_id.dspy", "logined"), - ("/supplychain/api/get_search_sub_reseller_id.dspy", "logined"), - ("/supplychain/api/get_search_supplier_id.dspy", "logined"), - ("/supplychain/api/get_search_supply_relation_id.dspy", "logined"), - ("/supplychain/api/import_supplier_product.dspy", "logined"), - ("/supplychain/api/platform_supply_products_create.dspy", "logined"), - ("/supplychain/api/platform_supply_products_delete.dspy", "logined"), - ("/supplychain/api/platform_supply_products_update.dspy", "logined"), - ("/supplychain/api/platform_supply_relations_create.dspy", "logined"), - ("/supplychain/api/platform_supply_relations_delete.dspy", "logined"), - ("/supplychain/api/platform_supply_relations_update.dspy", "logined"), - ("/supplychain/api/product_supplier_mapping_create.dspy", "logined"), - ("/supplychain/api/product_supplier_mapping_delete.dspy", "logined"), - ("/supplychain/api/product_supplier_mapping_update.dspy", "logined"), - ("/supplychain/api/query_dist_discount.dspy", "logined"), - ("/supplychain/api/query_platform_products.dspy", "logined"), - ("/supplychain/api/query_platform_suppliers.dspy", "logined"), - ("/supplychain/api/query_supply_discount.dspy", "logined"), - ("/supplychain/api/sales_ledger_create.dspy", "logined"), - ("/supplychain/api/sales_ledger_delete.dspy", "logined"), - ("/supplychain/api/sales_ledger_update.dspy", "logined"), - ("/supplychain/api/sub_distributors_create.dspy", "logined"), - ("/supplychain/api/sub_distributors_delete.dspy", "logined"), - ("/supplychain/api/sub_distributors_update.dspy", "logined"), - ("/supplychain/api/sub_resellers_create.dspy", "logined"), - ("/supplychain/api/sub_resellers_delete.dspy", "logined"), - ("/supplychain/api/sub_resellers_update.dspy", "logined"), - ("/supplychain/api/supplier_resource_price_create.dspy", "logined"), - ("/supplychain/api/supplier_resource_price_delete.dspy", "logined"), - ("/supplychain/api/supplier_resource_price_update.dspy", "logined"), - ("/supplychain/api/suppliers_create.dspy", "logined"), - ("/supplychain/api/suppliers_delete.dspy", "logined"), - ("/supplychain/api/suppliers_update.dspy", "logined"), - ("/supplychain/api/supply_contract_items_create.dspy", "logined"), - ("/supplychain/api/supply_contract_items_delete.dspy", "logined"), - ("/supplychain/api/supply_contract_items_update.dspy", "logined"), - ("/supplychain/api/supply_contracts_create.dspy", "logined"), - ("/supplychain/api/supply_contracts_delete.dspy", "logined"), - ("/supplychain/api/supply_contracts_update.dspy", "logined"), - ("/supplychain/api/supplychain_accounting_create.dspy", "logined"), - ("/supplychain/api/supplychain_accounting_delete.dspy", "logined"), - ("/supplychain/api/supplychain_accounting_update.dspy", "logined"), - ("/supplychain/api/contract_attach_list.dspy", "logined"), - ("/supplychain/api/contract_attach.ui", "logined"), - ("/supplychain/api/contract_upload.dspy", "logined"), - ("/supplychain/api/contract_attach_delete.dspy", "logined"), - ("/supplychain/distribution_agreement_items_list", "logined"), - ("/supplychain/distribution_agreement_items_list/add_distribution_agreement_items.dspy", "logined"), - ("/supplychain/distribution_agreement_items_list/delete_distribution_agreement_items.dspy", "logined"), - ("/supplychain/distribution_agreement_items_list/get_distribution_agreement_items.dspy", "logined"), - ("/supplychain/distribution_agreement_items_list/index.ui", "logined"), - ("/supplychain/distribution_agreement_items_list/update_distribution_agreement_items.dspy", "logined"), - ("/supplychain/distribution_agreements_list", "logined"), - ("/supplychain/distribution_agreements_list/add_distribution_agreements.dspy", "logined"), - ("/supplychain/distribution_agreements_list/delete_distribution_agreements.dspy", "logined"), - ("/supplychain/distribution_agreements_list/get_distribution_agreements.dspy", "logined"), - ("/supplychain/distribution_agreements_list/index.ui", "logined"), - ("/supplychain/distribution_agreements_list/update_distribution_agreements.dspy", "logined"), - ("/supplychain/platform_supply_products_list", "logined"), - ("/supplychain/platform_supply_products_list/add_platform_supply_products.dspy", "logined"), - ("/supplychain/platform_supply_products_list/delete_platform_supply_products.dspy", "logined"), - ("/supplychain/platform_supply_products_list/get_platform_supply_products.dspy", "logined"), - ("/supplychain/platform_supply_products_list/index.ui", "logined"), - ("/supplychain/platform_supply_products_list/update_platform_supply_products.dspy", "logined"), - ("/supplychain/platform_supply_relations_list", "logined"), - ("/supplychain/platform_supply_relations_list/add_platform_supply_relations.dspy", "logined"), - ("/supplychain/platform_supply_relations_list/delete_platform_supply_relations.dspy", "logined"), - ("/supplychain/platform_supply_relations_list/get_platform_supply_relations.dspy", "logined"), - ("/supplychain/platform_supply_relations_list/index.ui", "logined"), - ("/supplychain/platform_supply_relations_list/update_platform_supply_relations.dspy", "logined"), - ("/supplychain/product_supplier_mapping_list", "logined"), - ("/supplychain/product_supplier_mapping_list/add_product_supplier_mapping.dspy", "logined"), - ("/supplychain/product_supplier_mapping_list/delete_product_supplier_mapping.dspy", "logined"), - ("/supplychain/product_supplier_mapping_list/get_product_supplier_mapping.dspy", "logined"), - ("/supplychain/product_supplier_mapping_list/index.ui", "logined"), - ("/supplychain/product_supplier_mapping_list/update_product_supplier_mapping.dspy", "logined"), - ("/supplychain/sales_ledger_list", "logined"), - ("/supplychain/sales_ledger_list/add_sales_ledger.dspy", "logined"), - ("/supplychain/sales_ledger_list/delete_sales_ledger.dspy", "logined"), - ("/supplychain/sales_ledger_list/get_sales_ledger.dspy", "logined"), - ("/supplychain/sales_ledger_list/index.ui", "logined"), - ("/supplychain/sales_ledger_list/update_sales_ledger.dspy", "logined"), - ("/supplychain/sub_distributors_list", "logined"), - ("/supplychain/sub_distributors_list/add_sub_distributors.dspy", "logined"), - ("/supplychain/sub_distributors_list/delete_sub_distributors.dspy", "logined"), - ("/supplychain/sub_distributors_list/get_sub_distributors.dspy", "logined"), - ("/supplychain/sub_distributors_list/index.ui", "logined"), - ("/supplychain/sub_distributors_list/update_sub_distributors.dspy", "logined"), - ("/supplychain/sub_resellers_list", "logined"), - ("/supplychain/sub_resellers_list/add_sub_resellers.dspy", "logined"), - ("/supplychain/sub_resellers_list/delete_sub_resellers.dspy", "logined"), - ("/supplychain/sub_resellers_list/get_sub_resellers.dspy", "logined"), - ("/supplychain/sub_resellers_list/index.ui", "logined"), - ("/supplychain/sub_resellers_list/update_sub_resellers.dspy", "logined"), - ("/supplychain/supplier_resource_price_list", "logined"), - ("/supplychain/supplier_resource_price_list/index.ui", "logined"), - ("/supplychain/suppliers_list", "logined"), - ("/supplychain/suppliers_list/add_suppliers.dspy", "logined"), - ("/supplychain/suppliers_list/delete_suppliers.dspy", "logined"), - ("/supplychain/suppliers_list/get_suppliers.dspy", "logined"), - ("/supplychain/suppliers_list/index.ui", "logined"), - ("/supplychain/suppliers_list/update_suppliers.dspy", "logined"), - ("/supplychain/supply_contract_items_list", "logined"), - ("/supplychain/supply_contract_items_list/add_supply_contract_items.dspy", "logined"), - ("/supplychain/supply_contract_items_list/delete_supply_contract_items.dspy", "logined"), - ("/supplychain/supply_contract_items_list/get_supply_contract_items.dspy", "logined"), - ("/supplychain/supply_contract_items_list/index.ui", "logined"), - ("/supplychain/supply_contract_items_list/update_supply_contract_items.dspy", "logined"), - ("/supplychain/supply_contracts_list", "logined"), - ("/supplychain/supply_contracts_list/add_supply_contracts.dspy", "logined"), - ("/supplychain/supply_contracts_list/delete_supply_contracts.dspy", "logined"), - ("/supplychain/supply_contracts_list/get_supply_contracts.dspy", "logined"), - ("/supplychain/supply_contracts_list/index.ui", "logined"), - ("/supplychain/supply_contracts_list/update_supply_contracts.dspy", "logined"), - ("/supplychain/supplychain_accounting_list", "logined"), - ("/supplychain/supplychain_accounting_list/add_supplychain_accounting.dspy", "logined"), - ("/supplychain/supplychain_accounting_list/delete_supplychain_accounting.dspy", "logined"), - ("/supplychain/supplychain_accounting_list/get_supplychain_accounting.dspy", "logined"), - ("/supplychain/supplychain_accounting_list/index.ui", "logined"), - ("/supplychain/supplychain_accounting_list/update_supplychain_accounting.dspy", "logined"), - ("/supplychain/accounting.ui", "logined"), - ("/supplychain/distribution_agreements.ui", "logined"), - ("/supplychain/index.ui", "logined"), - ("/supplychain/menu.ui", "any"), - ("/supplychain/provider_detail_reconcile.ui", "logined"), - ("/supplychain/provider_recharge.ui", "logined"), - ("/supplychain/provider_reconcile.ui", "logined"), - ("/supplychain/provider_settlement.ui", "logined"), - ("/supplychain/reseller_detail_reconcile.ui", "logined"), - ("/supplychain/reseller_reconcile.ui", "logined"), - ("/supplychain/reseller_settlement.ui", "logined"), - ("/supplychain/sub_distributors.ui", "logined"), - ("/supplychain/suppliers.ui", "logined"), - ("/supplychain/supply_contracts.ui", "logined"), - ("/supplychain/add_provider_recharge.dspy", "logined"), - ("/supplychain/add_provider_settlement.dspy", "logined"), - ("/supplychain/get_provider_detail_reconcile.dspy", "logined"), - ("/supplychain/get_provider_recharge.dspy", "logined"), - ("/supplychain/get_provider_reconcile.dspy", "logined"), - ("/supplychain/get_provider_settlement.dspy", "logined"), - ("/supplychain/get_reseller_detail_reconcile.dspy", "logined"), - ("/supplychain/get_reseller_reconcile.dspy", "logined"), - ("/supplychain/get_reseller_settlement.dspy", "logined"), - ("/supplychain/update_provider_recharge.dspy", "logined"), - ("/supplychain/update_provider_settlement.dspy", "logined"), - ("/supplychain/update_reseller_settlement.dspy", "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", ] -async def main(): - config = getConfig('.') - DBPools(config.databases) - async with DBPools().sqlorContext('sage') as sor: - cnt = 0 - for path, role in paths: - r = await sor.sqlExe( - 'select * from permission where path = ${path}$', - {'path': path} - ) - if len(r) == 0: - await sor.sqlExe( - '''insert into permission (id, path, name, permtype) - values (${id}$, ${path}$, ${name}$, ${permtype}$)''', - { - 'id': getID(), - 'path': path, - 'name': path, - 'permtype': role, - } - ) - cnt += 1 - print(f'{cnt} path(s) inserted for supplychain') +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__': - asyncio.run(main()) +if __name__ == "__main__": + print("=== supplychain RBAC registration ===") + register_paths() + print("Done. any=1 logined=158") diff --git a/supplychain/init.py b/supplychain/init.py index 6218677..2ed83c3 100644 --- a/supplychain/init.py +++ b/supplychain/init.py @@ -122,7 +122,7 @@ async def create_supplier(request, params_kw): "created_at": now_org, "updated_at": now_org } - async with db.sqlorContext("sage") as sor_sage: + async with db.sqlorContext(dbname) as sor_sage: await sor_sage.C("organization", org_rec) orgid = new_orgid @@ -313,7 +313,7 @@ async def create_sub_reseller(request, params_kw): "created_at": now, "updated_at": now } - async with db.sqlorContext("sage") as sor_sage: + async with db.sqlorContext(dbname) as sor_sage: await sor_sage.C("organization", org_rec) rec = {