diff --git a/README.md b/README.md index f94fb8b..94610f8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,20 @@ Simple serverless Slack bot for DTI Coffee Chats and Birthday messages! Should pair up people in the `#coffee-chats` channel every week. +## Functionality + +If you're a regular member, you should only be able to login, edit your own birthday, or report on whether the bot is up or down. + +If you're an admin, you should be able to login, edit your own birthday, edit other people's birthdays, toggle the bot on or off, and also manually initiate a new semester, or trigger a round of coffee chats or birthday wishes as needed. + +## New to Internbot? + +If you're a new Lead, make a PR to add yourself to the array of admins in `lib/data/admins.ts` and merge it in. Then, login with Google and you should have access to the admin panel! + +If you're a regular member, just login with Google. + +For **everyone**, please login with your Cornell email. + ## Technology Built with Vercel, PostgreSQL, Prisma, Next.js, Jest, and TypeScript. diff --git a/app/(controls)/@gated/page.tsx b/app/(controls)/@gated/page.tsx index f8e17fb..189b8e7 100644 --- a/app/(controls)/@gated/page.tsx +++ b/app/(controls)/@gated/page.tsx @@ -5,6 +5,7 @@ import ToggleBot from "@/components/actions/toggle-bot"; import InitSem from "@/components/actions/init-sem"; import ManualTriggers from "@/components/actions/manual-triggers"; import SetSomeonesBday from "@/components/actions/set-someones-bday"; +import admins from "@/lib/data/admins"; const GatedActions = async () => { const hasAccess = await getHasDashboardAccess(); @@ -32,13 +33,7 @@ const GatedActions = async () => { const getHasDashboardAccess = async () => { const checkIfUserHasAccess = async (email: string) => - (await prisma.user.findFirst({ - where: { - email: email, - }, - })) - ? true - : false; + admins.some((admin) => admin.email === email); const emails = (await currentUser())?.emailAddresses; diff --git a/lib/data/admins.ts b/lib/data/admins.ts new file mode 100644 index 0000000..4edc01e --- /dev/null +++ b/lib/data/admins.ts @@ -0,0 +1,33 @@ +type admin = { + name?: string; + email: string; +}; + +const admins: admin[] = [ + { + name: "Daniel Wei", + email: "dlw266@cornell.edu", + }, + { + name: "Justin Kong", + email: "jk2338@cornell.edu", + }, + { + name: "Julie Jeong", + email: "sj598@cornell.edu", + }, + { + name: "Rohan Maheshwari", + email: "rm697@cornell.edu", + }, + { + name: "Sarah Young", + email: "sy398@cornell.edu", + }, + { + name: "Michelle Li", + email: "myl39@cornell.edu", + }, +]; + +export default admins;