From 662a511648853681bbab2fd1c7ba5cede722fa9d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Feb 2025 11:44:49 +0800 Subject: [PATCH] bugfix --- accounting/getaccount.py | 19 +++++++------------ accounting/init.py | 4 ++++ script/roleperm.sh | 8 ++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100755 script/roleperm.sh diff --git a/accounting/getaccount.py b/accounting/getaccount.py index 0412d0d..e0e4128 100644 --- a/accounting/getaccount.py +++ b/accounting/getaccount.py @@ -1,5 +1,6 @@ from appPublic.log import debug, exception from sqlor.dbpools import DBPools +from ahserver.serverenv import ServerEnv, get_serverenv from .const import * from accounting.accountingnode import get_parent_orgid @@ -77,19 +78,13 @@ where a.subjectid = b.id and async def getTransPayMode(): pass -async def getParentOrganization(sor, childid): - sql="select a.* from organization a, organization b where b.parentid=a.id and b.id = ${childid}$" - ns = { - "childid":childid - } - recs = await sor.sqlExe(sql, ns) - if len(recs) == 0: - return None - return recs[0] - async def getCustomerBalance(sor, customerid): - name = '业务账' - orgid = await get_parent_orgid(sor, customerid) + name = '客户资金账户' + get_owner_orgid = get_serverenv('get_owner_orgid') + if get_owner_orgid is None: + debug('get_owner_orgid function is not a serverenv function') + return None + orgid = await get_owner_orgid(sor, customerid) if orgid is None: print(f"{customerid=}'s parent organization not found") return None diff --git a/accounting/init.py b/accounting/init.py index 70d1977..76ed959 100644 --- a/accounting/init.py +++ b/accounting/init.py @@ -5,6 +5,7 @@ from ahserver.serverenv import ServerEnv from accounting.accounting_config import Accounting from accounting.bill import write_bill from accounting.openaccount import openOwnerAccounts, openProviderAccounts, openResellerAccounts, openCustomerAccounts +from getaccount import getAccountBalance, getCustomerBalance def load_accounting(): g = ServerEnv() @@ -14,3 +15,6 @@ def load_accounting(): g.openProviderAccounts = openProviderAccounts g.openResellerAccounts = openResellerAccounts g.openCustomerAccounts = openCustomerAccounts + g.getAccountBalance = getAccountBalance + g.getCustomerBalance = getCustomerBalance + diff --git a/script/roleperm.sh b/script/roleperm.sh new file mode 100755 index 0000000..1923f6e --- /dev/null +++ b/script/roleperm.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +python ~/py/rbac/script/roleperm.py sage accounting owner superuser account_config accounting_config subject +python ~/py/rbac/script/roleperm.py sage accounting reseller operator account acc_detail acc_balance accounting_log bill bill_detail ledger +python ~/py/rbac/script/roleperm.py sage accounting reseller sale account acc_detail acc_balance accounting_log bill bill_detail ledger +python ~/py/rbac/script/roleperm.py sage accounting reseller accountant account acc_detail acc_balance accounting_log bill bill_detail ledger +python ~/py/rbac/script/roleperm.py sage accounting customer customer account acc_detail acc_balance accounting_log bill bill_detail ledger +