One way of achieving this would be to define the actor/group id of the task to variable and have other node (or on-entry/on-exit script) to evaluate the required logic and assign proper value to the variable that next will be used by the user task.
HTH