clean up function getUserGroupIds

clean up of function getUserGroupIds and improved caching mechanism of cachedUserGroupIds