optimize getUserGroups to work with multiple user ids