Skip to content

Commit

Permalink
fix(backend): 修复人员管理过滤问题 #8053
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Nov 19, 2024
1 parent e215e4e commit a4786fe
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def create_log(cls, account_id, rule_id, operator, action):
def get_notifiers(cls, rule_id):
"""获取通知人列表,目前只过滤有授权记录的人"""
users = cls.objects.filter(rule_id=rule_id, action_type=RuleActionType.AUTH).values_list("operator", flat=True)
if not users:
return []
# 过滤离职的和虚拟账户
virtual_users = SystemSettings.get_setting_value(key=SystemSettingsEnum.VIRTUAL_USERS, default=[])
real_users = UserManagerApi.list_users({"fields": "username", "exact_lookups": ",".join(users)})["results"]
real_users = UserManagerApi.list_users(
{"fields": "username", "exact_lookups": ",".join(users), "no_page": True}
)
real_users = [user["username"] for user in real_users]
return list(set(real_users) - set(virtual_users))

0 comments on commit a4786fe

Please sign in to comment.