backport of #9104

Update manager.php

add caching to getUserGroupIds

Update manager.php

added description and blank lines in getUserGroupIds

Update manager.php

defined $uid in getUserGroupIds

Update manager.php

Update manager.php

Update manager.php

clean up function getUserGroupIds

clean up of function getUserGroupIds and improved caching mechanism of cachedUserGroupIds

modified caching mechanism in getUserGroupIds

removed cachedUserGroupIds, instead changed indexing in getUserGroups to groupId

adapted tests for a groupId indexed group array