fix: Improve docs clarity, move filterRegex out of pagedRequest loop

Signed-off-by: Hghtwr <johannes.sonner@outlook.com>
This commit is contained in:
Hghtwr
2024-09-16 18:57:57 +02:00
parent 2c810e221f
commit 77bfb298cd
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -242,7 +242,7 @@ catalog:
orgEnabled: true
group: org/teams # Required for gitlab.com when `orgEnabled: true`. Optional for self managed. Must not end with slash. Accepts only groups under the provided path (which will be stripped)
restrictUsersToGroup: true # Optional: Backstage will ingest only users directly assigned to org/teams.
includeUsersWithoutSeat: true # Optional: Include users without paid seat, only valid for SaaS
includeUsersWithoutSeat: false # Optional: Set to true to include users without paid seat, only applicable for SaaS
```
### Limiting `User` and `Group` entity ingestion in the provider
@@ -139,6 +139,8 @@ export class GitLabClient {
options?: CommonListOptions,
includeUsersWithoutSeat?: boolean,
): Promise<PagedResponse<GitLabUser>> {
const botFilterRegex = /^(?:project|group)_(\w+)_bot_(\w+)$/;
return this.listGroupMembers(groupPath, {
...options,
active: true, // Users with seat are always active but for users without seat we need to filter
@@ -148,9 +150,8 @@ export class GitLabClient {
// https://github.com/backstage/backstage/issues/26438
// Filter out API tokens https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html#bot-users-for-projects
if (includeUsersWithoutSeat) {
const regex = /^(?:project|group)_(\w+)_bot_(\w+)$/;
resp.items = resp.items.filter(user => {
return !regex.test(user.username);
return !botFilterRegex.test(user.username);
});
} else {
resp.items = resp.items.filter(user => user.is_using_seat);