From a2fbe7deac014976ab942918a9ee71ede1604292 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 26 Nov 2024 15:24:01 +0800 Subject: [PATCH] bugfix --- script/init.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/init.py b/script/init.py index fa200f6..b363020 100644 --- a/script/init.py +++ b/script/init.py @@ -75,7 +75,7 @@ role_perms = { '/rbac/role/index.ui', '/rbac/role/get_role.dspy', '/rbac/role/update_role.dspy', - '/rbac/role/delete_role.dspy' + '/rbac/role/delete_role.dspy', '/rbac/role/add_role.dspy', '/rbac/permission/add_permission.dspy', '/rbac/permission/delete_permission.dspy', @@ -108,13 +108,17 @@ async def init_perms(): for rn, pths in role_perms.items(): roles = await sor.sqlExe('select * from role where name=${rn}$', {'rn':rn}) if len(roles) == 0: + print(f'{rn=} not exists') continue for p in pths: + print(f'{rn=} set {p=}') perms = await sor.sqlExe('select * from permission where path=${p}$', {'p':p}) if len(perms): await sor.C('rolepermission', {'id':getID(), 'roleid':roles[0].id, 'permid':perms[0].id}) + else: + print(f'{p} is not exists') async def init_rbac(passwd): db = DBPools()