Correctly use groups parameter only when its not empty

Fix #9745
Merge pull request #9750 from owncloud/issue/9745

Correctly use groups parameter only when its not empty