sage/check_bricks_perms.py

20 lines
701 B
Python

import asyncio
from sqlor.dbpools import DBPools
from appPublic.jsonConfig import getConfig
async def main():
config = getConfig('.')
db = DBPools(config.databases)
async with db.sqlorContext('sage') as sor:
perms = await sor.sqlExe(
"select p.path from permission p inner join rolepermission rp on p.id=rp.permid where rp.roleid='any' and p.path like ${path}$",
{'path': '/bricks/%'}
)
print(f'Found {len(perms)} bricks paths with any role:')
for p in perms[:15]:
print(f' {p.path}')
if len(perms) > 15:
print(f' ... and {len(perms)-15} more')
asyncio.get_event_loop().run_until_complete(main())