Elgg/Elgg — pull request #380 by mrclay (2012-09-07 05:55:23+00:00)
Title: Fixes #4789: group_gatekeeper() more reliable

Summary: group_gatekeeper() and the river no longer allow bypassing group content policy by making permissive access levels on the individual items.

Both group_gatekeeper() and elgg_view_river_item() now both check the page owner/object container in case this is a group (even if the user can't normally see the group). ElggGroupItemVisibility was introduced to remove duplicate code and isolate the decision-making.

Since this has to operate on each river item, I memoized the result during the request (should be particularly helpful for rivers within groups, or sites where most content is within a small number of groups).

All units pass.