This commit is contained in:
yumoqing 2026-03-20 15:57:23 +08:00
parent 8d5af5cad2
commit 71e17ad494

View File

@ -10,25 +10,18 @@ async def delete_anonymous_perm(sor, permid):
'permid': permid
})
async def add_roleperm(sor, roleid, path, permid=None):
if permid is None:
perms = await sor.R('permission', {'path': path})
if perms:
permid = perms[0].id
async def add_roleperm(sor, roleid, permid):
ns = {
'roleid': roleid,
'permid': permid
}
recs = await sor.R('rolepermission', ns)
recs = await sor.R('rolepermission', ns.copy())
if recs:
print(f'{role}, {path} 已经存在')
print(f'{role}, {permid} 已经存在')
return
await sor.C('rolepermission', {
'id': getID(),
'roleid': 'anonymous',
'perid': p.id
})
print(f'{role}, {path} perm add')
ns['id'] = getID()
await sor.C('rolepermission', ns)
print(f'{role}, {permid} perm add')
return
async def main():