Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:申请加入用户组时,二级资源拥有者离职,上升到一级管理员审批 #2838

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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