Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions torchci/lib/getAuthorizedUsername.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { NextApiRequest, NextApiResponse } from "next";
import { getServerSession } from "next-auth";
import { hasWritePermissionsUsingOctokit } from "./GeneralUtils";
import { getOctokitWithUserToken } from "./github";
// Give access to people who do not have write permissions to pytorch/pytorch
import allowList from "./torchagent/allowList.json";

/**
* Helper that implements the common auth logic shared by the TorchAgent
Expand Down Expand Up @@ -61,6 +63,13 @@ export async function getAuthorizedUsername(
return null;
}

if (allowList.includes(user.data.login)) {
console.log(
`Authorized: User ${user.data.login} is in the flambeau allow list`
);
return user.data.login;
}

const hasWritePermissions = await hasWritePermissionsUsingOctokit(
octokit,
user.data.login,
Expand Down
1 change: 1 addition & 0 deletions torchci/lib/torchagent/allowList.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["saienduri"]