refactor getting user groups, include public group