Skip to content

Commit

Permalink
Merge pull request #2838 from yunlong098/feat/approver_up
Browse files Browse the repository at this point in the history
feat:申请加入用户组时,二级资源拥有者离职,上升到一级管理员审批
  • Loading branch information
nannan00 authored Jan 2, 2025
2 parents ec19e6e + 8299956 commit 9c3d409
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions saas/backend/biz/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,17 @@ def get_system_manager_members(self, system_id: str) -> str:
return Role.objects.get(type=RoleType.SYSTEM_MANAGER.value, code=system_id).members

@cachedmethod(timeout=60) # 缓存1分钟
def get_grade_manager_members_by_group_id(self, group_id: int) -> str:
"""获取分级管理员"""
return self.svc.get_role_by_group_id(group_id).members
def get_grade_manager_members_by_group_id(
self, group_id: int, fallback_to_parent_if_empty: bool = True
) -> List[str]:
"""获取分级管理员,如果为空,获取父级管理员"""
current_role = self.svc.get_role_by_group_id(group_id)

if fallback_to_parent_if_empty and not current_role.members:
parent_id = self.svc.get_parent_id(current_role.id)
return self.svc.list_members_by_role_id(parent_id)

return current_role.members


class ApprovedPassApplicationBiz:
Expand Down

0 comments on commit 9c3d409

Please sign in to comment.