diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index b33b5e98c..38919ba49 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -7,6 +7,8 @@ > Users must be able to say: “Nice enhancement, I'm eager to test it” +- [REST API] Add `/groups` collection [Forum#70500](https://xcp-ng.org/forum/post/70500) + ### Bug fixes > Users must be able to say: “I had this issue, happy to know it's fixed” @@ -31,7 +33,7 @@ -- xo-server patch +- xo-server minor - xo-server-load-balancer patch - xo-web patch diff --git a/packages/xo-server/src/xo-mixins/rest-api.mjs b/packages/xo-server/src/xo-mixins/rest-api.mjs index e4848966b..dbd285b3f 100644 --- a/packages/xo-server/src/xo-mixins/rest-api.mjs +++ b/packages/xo-server/src/xo-mixins/rest-api.mjs @@ -319,6 +319,14 @@ export default class RestApi { } collections.backup = {} + collections.groups = { + getObject(id) { + return app.getGroup(id) + }, + async getObjects(filter, limit) { + return handleArray(await app.getAllGroups(), filter, limit) + }, + } collections.restore = {} collections.tasks = {} collections.users = {