16 lines
352 B
Python
16 lines
352 B
Python
import typing
|
|
|
|
from apps.authorization.models import Role
|
|
|
|
|
|
def get_all_role_child(role: Role = None) -> typing.Any:
|
|
"""
|
|
get all child of an role
|
|
"""
|
|
descendants = []
|
|
children = role.child.all()
|
|
for child in children:
|
|
descendants.append(child)
|
|
descendants.extend(get_all_org_child(child))
|
|
return descendants
|