diff --git a/set_role_perm.py b/set_role_perm.py index 6f1aa0c..5f3acd8 100644 --- a/set_role_perm.py +++ b/set_role_perm.py @@ -39,6 +39,13 @@ async def main(): perms = await sor.sqlExe("select * from permission where path like ${path}$", {'path': path}) else: perms = await sor.R('permission', {'path': path}) + if len(perms) < 1: + perms = [ DictObject(**{ + 'id': getID(), + 'path': path + }) ] + await sor.C('permission', perms[0].copy()) + if role in ['anonymous', 'logined']: for p in perms: await add_roleperm(sor, role, p.id)