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

当前审批节点用户列表显示异常 #2831

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sql/templates/workflow_display.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- 当前节点 -->
<u class="text-danger">
{{ n.group.name }}(
{% for u in n.group.user_set.all %}
{% for u in n.filtered_user_set %}
<span class="text-primary">{{ u.username }}</span>
{% endfor %})
</u>
Expand Down
15 changes: 15 additions & 0 deletions sql/utils/workflow_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ReviewNodeType(Enum):
@dataclass
class ReviewNode:
group: Optional[Group] = None
filtered_user_set: Optional[Users] = None
node_type: ReviewNodeType = ReviewNodeType.GROUP
is_current_node: bool = False
is_passed_node: bool = False
Expand Down Expand Up @@ -597,12 +598,23 @@ def get_review_info(self) -> ReviewInfo:
)
)
continue
# 获取指定权限组名称
group_in_db = Group.objects.get(id=g)
# 获取资源组内关联指定权限组的用户
current_audit_users = auth_group_users(
[group_in_db.name], self.resource_group_id
)
current_audit_user_ids = current_audit_users.values_list("id", flat=True)
# 过滤Group对象的user_set,只保留当前审核用户
group_filtered_user_set = group_in_db.user_set.filter(
id__in=current_audit_user_ids
)
if self.audit.current_status != WorkflowStatus.WAITING:
# 总体状态不是待审核, 不设置详细的属性
review_nodes.append(
ReviewNode(
group=group_in_db,
filtered_user_set=group_filtered_user_set,
)
)
continue
Expand All @@ -612,6 +624,7 @@ def get_review_info(self) -> ReviewInfo:
review_nodes.append(
ReviewNode(
group=group_in_db,
filtered_user_set=group_filtered_user_set,
is_current_node=True,
is_passed_node=False,
)
Expand All @@ -622,6 +635,7 @@ def get_review_info(self) -> ReviewInfo:
review_nodes.append(
ReviewNode(
group=group_in_db,
filtered_user_set=group_filtered_user_set,
is_passed_node=False,
)
)
Expand All @@ -630,6 +644,7 @@ def get_review_info(self) -> ReviewInfo:
review_nodes.append(
ReviewNode(
group=group_in_db,
filtered_user_set=group_filtered_user_set,
is_passed_node=True,
)
)
Expand Down
Loading