Fixes #5734 - External usergroups api

To be merged after #529