Fixes #5734 - External usergroups api

To be merged after #529 .  Tests are expected to fail until then.