23 lines
732 B
Plaintext
23 lines
732 B
Plaintext
async def getpermission():
|
|
"""展示权限"""
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
ns = {}
|
|
ns['del_flg'] ='0'
|
|
reacs = await sor.R('permission', ns)
|
|
list = []
|
|
dict = {}
|
|
if reacs:
|
|
for i in reacs:
|
|
dict[i['id']] = i
|
|
for j in reacs:
|
|
if j['parentid'] == None or j['parentid'] == '':
|
|
list.append(j)
|
|
else:
|
|
if 'son' not in dict[j['parentid']]:
|
|
dict[j['parentid']]['son'] = []
|
|
dict[j['parentid']]['son'].append(j)
|
|
return {'status': True, 'data': list}
|
|
|
|
ret = await getpermission()
|
|
return ret |