Skip to content

Commit 15297e7

Browse files
fix
1 parent ea61441 commit 15297e7

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

packages/backend/src/ee/accountPermissionSyncer.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,15 @@ export class AccountPermissionSyncer {
247247
throw new Error(`OAuth token with scopes [${scopes.join(', ')}] is missing the 'read_api' scope required for permission syncing.`);
248248
}
249249

250-
// @note: we only care about the private and internal repos since we don't need to build a mapping
251-
// for public repos.
250+
// @note: we only care about the private repos since we don't need to build a
251+
// mapping for public or internal repos. Note that internal repos are _not_
252+
// enforced by permission syncing and therefore we don't need to fetch them
253+
// here.
254+
//
252255
// @see: packages/web/src/prisma.ts
253-
const privateGitLabProjects = await getProjectsForAuthenticatedUser('private', api);
254-
const internalGitLabProjects = await getProjectsForAuthenticatedUser('internal', api);
255-
256-
const gitLabProjectIds = [
257-
...privateGitLabProjects,
258-
...internalGitLabProjects,
259-
].map(project => project.id.toString());
256+
const gitLabProjectIds = (
257+
await getProjectsForAuthenticatedUser('private', api)
258+
).map(project => project.id.toString());
260259

261260
const repos = await this.db.repo.findMany({
262261
where: {

packages/backend/src/gitlab.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ export const getProjectMembers = async (projectId: string, api: InstanceType<typ
303303
export const getProjectsForAuthenticatedUser = async (visibility: 'private' | 'internal' | 'public' | 'all' = 'all', api: InstanceType<typeof Gitlab>) => {
304304
try {
305305
const fetchFn = () => api.Projects.all({
306-
membership: true,
307306
...(visibility !== 'all' ? {
308307
visibility,
309308
} : {}),

packages/backend/src/repoCompileUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ export const compileGitlabConfig = async (
170170
const cloneUrl = new URL(project.http_url_to_repo);
171171
cloneUrl.protocol = new URL(hostUrl).protocol;
172172
const isFork = project.forked_from_project !== undefined;
173-
const isPublic = project.visibility === 'public';
173+
// @note: we consider internal repos to be `public` s.t.,
174+
// we don't enforce permission filtering for them and they
175+
// are visible to all users.
176+
// @see: packages/web/src/prisma.ts
177+
const isPublic =
178+
project.visibility === 'public' ||
179+
project.visibility === 'internal';
174180
const repoDisplayName = project.path_with_namespace;
175181
const repoName = path.join(repoNameRoot, repoDisplayName);
176182
// project.avatar_url is not directly accessible with tokens; use the avatar API endpoint if available

0 commit comments

Comments
 (0)