From 191e5bfae47e0d62328bcfa4727179ffaae05301 Mon Sep 17 00:00:00 2001 From: Casper Thygesen Date: Fri, 29 Nov 2024 21:09:13 +0000 Subject: [PATCH] restrictUsersToGroup should use the entire groupPath Signed-off-by: Casper Thygesen --- .changeset/blue-dragons-shout.md | 5 +++++ .../src/providers/GitlabOrgDiscoveryEntityProvider.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/blue-dragons-shout.md diff --git a/.changeset/blue-dragons-shout.md b/.changeset/blue-dragons-shout.md new file mode 100644 index 0000000000..c74d469bad --- /dev/null +++ b/.changeset/blue-dragons-shout.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-gitlab': patch +--- + +restrictUsersToGroup should use the entire groupPath diff --git a/plugins/catalog-backend-module-gitlab/src/providers/GitlabOrgDiscoveryEntityProvider.ts b/plugins/catalog-backend-module-gitlab/src/providers/GitlabOrgDiscoveryEntityProvider.ts index 277a5a8c51..bbd926ab93 100644 --- a/plugins/catalog-backend-module-gitlab/src/providers/GitlabOrgDiscoveryEntityProvider.ts +++ b/plugins/catalog-backend-module-gitlab/src/providers/GitlabOrgDiscoveryEntityProvider.ts @@ -396,13 +396,13 @@ export class GitlabOrgDiscoveryEntityProvider implements EntityProvider { groups = (await this.gitLabClient.listDescendantGroups(this.config.group)) .items; const rootGroupSplit = this.config.group.split('/'); - const rootGroup = this.config.restrictUsersToGroup - ? rootGroupSplit[rootGroupSplit.length - 1] + const groupPath = this.config.restrictUsersToGroup + ? this.config.group : rootGroupSplit[0]; users = paginated( options => this.gitLabClient.listSaaSUsers( - rootGroup, + groupPath, options, this.config.includeUsersWithoutSeat, ),