Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
jankeromnes committed Feb 19, 2022
1 parent 0e09d0a commit 580c136
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/server/src/auth/resource-access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { CommitContext, ContextURL, GitpodToken, Snapshot, Team, TeamMemberInfo, Token, User, UserEnvVar, Workspace, WorkspaceInstance } from "@gitpod/gitpod-protocol";
import { UnauthorizedError } from "../errors";
import { HostContextProvider } from "./host-context-provider";
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";

declare var resourceInstance: GuardedResource;
export type GuardedResourceKind = typeof resourceInstance.kind;
Expand Down Expand Up @@ -177,6 +178,7 @@ export class OwnerResourceGuard implements ResourceAccessGuard {
case "gitpodToken":
return resource.subject.user.id === this.userId;
case "snapshot":
log.warn(`DEBUG: OwnerResourceGuard ${resource.kind} ${resource.workspace.ownerId === this.userId} ${new Error().stack}`);
return resource.workspace.ownerId === this.userId;
case "token":
return resource.tokenOwnerID === this.userId;
Expand Down Expand Up @@ -477,6 +479,7 @@ export class RepositoryResourceGuard implements ResourceAccessGuard {

// Check if user has at least read access to the repository
const workspace = resource.kind === 'snapshot' ? resource.workspace : resource.subject;
log.warn(`DEBUG: RepositoryResourceGuard ${resource.kind} ${workspace.contextURL} ${new Error().stack}`);
const contextURL = ContextURL.getNormalizedURL(workspace);
if (!contextURL) {
throw new Error(`unable to parse ContextURL: ${contextURL}`);
Expand Down

0 comments on commit 580c136

Please sign in to comment.