Feature/exclude user from group assignment (#332)
* check if user in group also has the task assigned to them when returning process instances w/ burnettk * only check if user is assigned task if querying for active tasks w/ burnettk --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
0848c64299
commit
d15289ffc2
|
@ -3,7 +3,7 @@ groups:
|
|||
admin:
|
||||
users: [admin@spiffworkflow.org]
|
||||
group1:
|
||||
users: [jason@sartography.com, kb@sartography.com]
|
||||
users: [jason@sartography.com, kevin@sartography.com]
|
||||
group2:
|
||||
users: [dan@sartography.com]
|
||||
|
||||
|
|
|
@ -790,7 +790,9 @@ class ProcessInstanceProcessor:
|
|||
)
|
||||
else:
|
||||
if group_model is None:
|
||||
raise (NoPotentialOwnersForTaskError(f"Could not find a group with name matching lane: {task_lane}"))
|
||||
raise (
|
||||
NoPotentialOwnersForTaskError(f"Could not find a group with name matching lane: {task_lane}")
|
||||
)
|
||||
potential_owner_ids = [i.user_id for i in group_model.user_group_assignments]
|
||||
self.raise_if_no_potential_owners(
|
||||
potential_owner_ids,
|
||||
|
|
|
@ -500,6 +500,17 @@ class ProcessInstanceReportService:
|
|||
HumanTaskModel.completed.is_(False) # type: ignore
|
||||
)
|
||||
|
||||
# Check to make sure the task is not only available for the group but the user as well
|
||||
if instances_with_tasks_waiting_for_me is not True:
|
||||
human_task_user_alias = aliased(HumanTaskUserModel)
|
||||
process_instance_query = process_instance_query.join(
|
||||
human_task_user_alias,
|
||||
and_(
|
||||
human_task_user_alias.human_task_id == HumanTaskModel.id,
|
||||
human_task_user_alias.user_id == user.id,
|
||||
),
|
||||
)
|
||||
|
||||
process_instance_query = process_instance_query.join(GroupModel, and_(*group_model_join_conditions))
|
||||
process_instance_query = process_instance_query.join(
|
||||
UserGroupAssignmentModel,
|
||||
|
|
Loading…
Reference in New Issue