Implementation of API query for meta=siteinfo&siprop=usergroups
It should be possible to list all defined user groups and their associated user permissions (i.e. the contents of $wgGroupPermissions). I believe there is nothing secret in this definition.
This functionality should probably go to query/siteinfo (api.php?action=query&meta=siteinfo&siprop=usergroups).