This commit is contained in:
yumoqing 2026-03-21 16:03:09 +08:00
parent 5f805201ea
commit 73e4aac4be
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,13 @@
async with get_sor_context(request._run_ns, 'rbac') as sor:
recs = sor.R('role', {})
d = []
for r in recs:
if r.id in ['anonymous', 'any', 'logined']:
d.append(r.id)
else:
d.append(f'{r.orgtypeid}.{r.name}')
d.append(f'{r.orgtypeid}.*')
d.append(f'*.{r.name}')
d = sorted(list(set(d)))
return d
return []

View File

@ -0,0 +1,15 @@
async with get_sor_context(request._run_ns, 'rbac') as sor:
recs = sor.R('role', {})
d = []
for r in recs:
if r.id in ['anonymous', 'any', 'logined']:
continue
elif r.orgtypeid == '*' or r.orgtypeid is None:
continue
elif r.name == '*' or r.name is None:
continue
else:
d.append(f'{r.orgtypeid}.{r.name}')
d = sorted(list(set(d)))
return d
return []