Using Craft::Pro Edition, I want to add a specific UserGroup to an existing User in my module. I tried it this way, but the group is not saved.
$userGroup = Craft::$app->userGroups->getGroupByHandle('partner');
$user->setGroups([$userGroup]);
$success = Craft::$app->elements->saveElement($user);
After (successful) saveElement(), $user->getGroups() still returns an empty array.
When I add the group in the Admin CP, it works, but it needs a password confirmation.