phase2/oa_core — pull request #76 by dsnopek (2014-09-15 19:29:24+00:00)
Title: Added oa_core_get_inherited_users_for_space() function.

I was working on something that needed to get all the users for a Space, including the inherited users. Rather than copying the code I already wrote to do this from oa_worktracker, I decided to add a ``oa_core_get_inherited_users_for_space()`` function to oa_core.util.inc, which is what this PR does.

I also changed the signature for ``oa_core_get_users_for_space()`` slightly, by keying the array with the UID (just like ``user_load_multiple()`` does). To do this I rewrote the implementation of that function too, replacing the ``entity_metadata_wrapper()`` voodoo with straight database queries which should actually be marginally faster.

Anyway, this change in signature shouldn't hurt anything! Pre-existing callers to this function will just loop over the values and not care what the array key was. And it makes that function a little more useful.

(FYI, I changed the signature so that my new ``oa_core_get_inherited_users_for_space()`` function could call it, and easily avoid putting duplicate users on the array -- otherwise I would have had to create a map in my new function. And, anyway, returning arrays of entities keyed by the entity ID is super common pattern in D7.)