From 7e2872257403adffa3a3125a890a4510f45d36a7 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 25 Dec 2019 15:43:43 +0100 Subject: [PATCH] Create the get_settings method --- src/controllers/GroupsController.ts | 15 +++++++++++++++ src/controllers/Routes.ts | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/controllers/GroupsController.ts b/src/controllers/GroupsController.ts index 4f9b93e..f8f3961 100644 --- a/src/controllers/GroupsController.ts +++ b/src/controllers/GroupsController.ts @@ -129,6 +129,21 @@ export class GroupsController { h.send(await this.GroupInfoToAPI(group, h, true)); } + /** + * Get group settings + * + * @param h Request handler + */ + public static async GetSettings(h: RequestHandler) { + const groupID = await h.postGroupIDWithAccess("id", GroupsAccessLevel.ADMIN_ACCESS); + + // For now, this method is the same as the get advanced info methods, + // but this might change in the future... + const group = await GroupsHelper.GetInfo(groupID); + + h.send(await this.GroupInfoToAPI(group, h, true)); + } + /** * Turn a GroupInfo object into a valid API object * diff --git a/src/controllers/Routes.ts b/src/controllers/Routes.ts index 61174a2..4f2a66e 100644 --- a/src/controllers/Routes.ts +++ b/src/controllers/Routes.ts @@ -94,4 +94,6 @@ export const Routes : Route[] = [ {path: "/groups/get_multiple_info", cb: (h) => GroupsController.GetInfoMultiple(h)}, {path: "/groups/get_advanced_info", cb: (h) => GroupsController.GetAdvancedInfo(h), needLogin: false}, + + {path: "/groups/get_settings", cb: (h) => GroupsController.GetSettings(h)}, ] \ No newline at end of file