17724 respect group assignment condition

https://community.openproject.org/work_packages/17724
@ulferts Thanks for the hint! :+1: I amended it to https://github.com/opf/openproject/commit/415f0a1afb7ed4983c4c5850c02003e286fe9580.