Skip to content

Commit ab66abc

Browse files
authored
[flambeau] Messy allowlist for people without write permissions to use flambeau (#7355)
I was not kidding when I said messy...
1 parent e4903ba commit ab66abc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

torchci/lib/getAuthorizedUsername.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { NextApiRequest, NextApiResponse } from "next";
22
import { getServerSession } from "next-auth";
33
import { hasWritePermissionsUsingOctokit } from "./GeneralUtils";
44
import { getOctokitWithUserToken } from "./github";
5+
// Give access to people who do not have write permissions to pytorch/pytorch
6+
import allowList from "./torchagent/allowList.json";
57

68
/**
79
* Helper that implements the common auth logic shared by the TorchAgent
@@ -61,6 +63,13 @@ export async function getAuthorizedUsername(
6163
return null;
6264
}
6365

66+
if (allowList.includes(user.data.login)) {
67+
console.log(
68+
`Authorized: User ${user.data.login} is in the flambeau allow list`
69+
);
70+
return user.data.login;
71+
}
72+
6473
const hasWritePermissions = await hasWritePermissionsUsingOctokit(
6574
octokit,
6675
user.data.login,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["saienduri"]

0 commit comments

Comments
 (0)