Bug 1103131: Remove authorize! check and let Team.accessible() limit which global teams a user can see
Console: Improve grouping of application types

Improve the algorithm Console::ModelHelper#in_groups_by_tag to consider
application types for grouping under a tag even for a type that has
previously matched a tag that had only one match.

in_groups_by_tag takes a list of application types and tags and returns two
arrays: One with the application types grouped tags that they match and one
with application types that have no tags that more than one application
type matches.

The algorithm iterates over the array of tags that is passed into it.  For
each tag in this array, the algorithm pulls out each type that matches the
tag.  After iterating over the array of types while matching them against
the iterator tag, the algorithm either creates a new grouping of all types
that matched the tag if there were more than one, or else the algorithm
puts any matching type in the "other" group.

The problem is that jbosseap-6 has the "xpaas" tag, which comes before the
"java" tag in the array of tags provided to in_groups_by_tag.  Thus the
jbosseap-6 cartridge is found to match the "xpaas" tag before the "java"
tag is considered.  However, jbosseap-6 is the only cartridge with the
"xpaas" tag, so it is placed on the "other" group before the "java" tag is
considered.  Thus by the time the "java" tag is considered, jbosseap-6 has
already been pulled into the "others" group and is not in the array
considered for consideration when matching types against the "java" tag.

This commit changes the algorithm instead to leave types in the array of
types for consideration for matching against tags until that type is found
to be one of multiple types that match some tag.

This commit fixes bug 1100508.
model_helper_tests.rb: Add test for bug 1100508
Comment test_in_groups_by_tag

Add comments to test_in_groups_by_tag in model_helper_test.rb.
Merge pull request #5442 from Miciah/bug-1100508-application-types-list-has-jbosseap-6-under-other

Merged by openshift-bot
Merge pull request #5468 from liggitt/bug_1103131_allow_searching_global_member_teams

Merged by openshift-bot