bugfix
This commit is contained in:
parent
8d5af5cad2
commit
71e17ad494
@ -10,25 +10,18 @@ async def delete_anonymous_perm(sor, permid):
|
|||||||
'permid': permid
|
'permid': permid
|
||||||
})
|
})
|
||||||
|
|
||||||
async def add_roleperm(sor, roleid, path, permid=None):
|
async def add_roleperm(sor, roleid, permid):
|
||||||
if permid is None:
|
|
||||||
perms = await sor.R('permission', {'path': path})
|
|
||||||
if perms:
|
|
||||||
permid = perms[0].id
|
|
||||||
ns = {
|
ns = {
|
||||||
'roleid': roleid,
|
'roleid': roleid,
|
||||||
'permid': permid
|
'permid': permid
|
||||||
}
|
}
|
||||||
recs = await sor.R('rolepermission', ns)
|
recs = await sor.R('rolepermission', ns.copy())
|
||||||
if recs:
|
if recs:
|
||||||
print(f'{role}, {path} 已经存在')
|
print(f'{role}, {permid} 已经存在')
|
||||||
return
|
return
|
||||||
await sor.C('rolepermission', {
|
ns['id'] = getID()
|
||||||
'id': getID(),
|
await sor.C('rolepermission', ns)
|
||||||
'roleid': 'anonymous',
|
print(f'{role}, {permid} perm add')
|
||||||
'perid': p.id
|
|
||||||
})
|
|
||||||
print(f'{role}, {path} perm add')
|
|
||||||
return
|
return
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user