From bfa069f61d7c46afaa3745e893b7fdbc00a7b2c5 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Fri, 22 Mar 2024 13:37:10 +1100 Subject: [PATCH 1/2] fix: only set the subgroups of a parentgroup to the users group --- services/api/src/models/user.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/api/src/models/user.ts b/services/api/src/models/user.ts index 3340b08285..af121a9df2 100644 --- a/services/api/src/models/user.ts +++ b/services/api/src/models/user.ts @@ -336,6 +336,8 @@ export const User = (clients: { continue } } + // only set the users role-group as the subgroup, this is because `loadGroupByName` retrieves all the subgroups not just the one the user is in + parentGroup.subGroups = [ug] userGroups.push(parentGroup); } } From 4833e6bb70a6883c1d9cbb76ce5c35809fc48b95 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Mon, 25 Mar 2024 10:24:34 +1100 Subject: [PATCH 2/2] fix: order groups alphabetically --- services/api/src/resources/group/helpers.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/api/src/resources/group/helpers.ts b/services/api/src/resources/group/helpers.ts index 6fd80568e6..0307a75383 100644 --- a/services/api/src/resources/group/helpers.ts +++ b/services/api/src/resources/group/helpers.ts @@ -41,6 +41,9 @@ export const Helpers = (sqlClientPool: Pool) => { for (const o in groups) { projectGroups.push(await models.GroupModel.loadGroupById(groups[o])) } + projectGroups.sort(function(a, b) { + return a.name.localeCompare(b.name); + }); return projectGroups } return [] @@ -57,6 +60,9 @@ export const Helpers = (sqlClientPool: Pool) => { for (const o in groups) { orgGroups.push(await models.GroupModel.loadGroupById(groups[o])) } + orgGroups.sort(function(a, b) { + return a.name.localeCompare(b.name); + }); return orgGroups } return []