Skip to content

Commit

Permalink
fix: prevent empty string pushed into the accessGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
Junjiequan committed May 1, 2024
1 parent 7fad4b5 commit 857530a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ export class AccessGroupFromMultipleProvidersService extends AccessGroupService
for (const accessGroupProvider of this.accessGroupProviders) {
const accessGroupsFromProvider =
await accessGroupProvider.getAccessGroups(userPayload);
accessGroups.push(...accessGroupsFromProvider);

accessGroups.push(
...accessGroupsFromProvider.filter((group) => group.trim() !== ""),
);
}

return accessGroups;
}
}
5 changes: 1 addition & 4 deletions src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ const configuration = () => {
},
accessGroupsStaticConfig: {
enabled: boolean(process.env?.ACCESS_GROUPS_STATIC_ENABLED || true),
value:
(accessGroupsStaticValues &&
accessGroupsStaticValues.split(",").map((v) => v.trim())) ??
[],
value: accessGroupsStaticValues.split(",").map((v) => v.trim()) ?? [],
},
accessGroupsOIDCPayloadConfig: {
enabled: boolean(process.env?.ACCESS_GROUPS_OIDCPAYLOAD_ENABLED || false),
Expand Down

0 comments on commit 857530a

Please sign in to comment.