bugfix
This commit is contained in:
parent
4ced8ef727
commit
a2fbe7deac
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user