Skip to content

Commit 5d445cf

Browse files
geroplroboquat
authored andcommitted
[server] Workaround for lagging prebuild permissions
1 parent 7c8f476 commit 5d445cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

components/server/src/workspace/gitpod-server-impl.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,10 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
22502250
return undefined;
22512251
}
22522252

2253-
await this.guardAccess({ kind: "prebuild", subject: pbws, workspace, teamMembers: undefined }, "get");
2253+
// TODO(gpl) Ideally, we should not need to query the project-team hierarchy here, but decide on a per-prebuild basis.
2254+
// For that we need to fix Prebuild-access semantics, which is out-of-scope for now.
2255+
const teamMembers = await this.getTeamMembersByProject(workspace.projectId);
2256+
await this.guardAccess({ kind: "prebuild", subject: pbws, workspace, teamMembers }, "get");
22542257
const result: PrebuildWithStatus = { info, status: pbws.state };
22552258
if (pbws.error) {
22562259
result.error = pbws.error;
@@ -2273,7 +2276,10 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
22732276
return undefined;
22742277
}
22752278

2276-
await this.guardAccess({ kind: "prebuild", subject: pbws, workspace, teamMembers: undefined }, "get");
2279+
// TODO(gpl) Ideally, we should not need to query the project-team hierarchy here, but decide on a per-prebuild basis.
2280+
// For that we need to fix Prebuild-access semantics, which is out-of-scope for now.
2281+
const teamMembers = await this.getTeamMembersByProject(workspace.projectId);
2282+
await this.guardAccess({ kind: "prebuild", subject: pbws, workspace, teamMembers }, "get");
22772283
return pbws;
22782284
}
22792285

0 commit comments

Comments
 (0)