From ccbb5ef70de1236784dcca2d33bf9cd6b359b935 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 3 Oct 2024 16:10:42 -0600 Subject: [PATCH] kill: fix admin detection --- src/components/KillButton/index.tsx | 2 +- src/lib/teuthologyAPI.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/KillButton/index.tsx b/src/components/KillButton/index.tsx index 10e9c78..26f822a 100644 --- a/src/components/KillButton/index.tsx +++ b/src/components/KillButton/index.tsx @@ -39,7 +39,7 @@ export default function KillButton({data}: KillButtonProps) { "--preserve-queue": true, } const loggedUser = sessionQuery.data?.session?.username; - const isUserAdmin = sessionQuery.data?.session?.isUserAdmin; + const isUserAdmin = sessionQuery.data?.session?.role === "admin"; const owner = killPayload["--owner"].toLowerCase() const isOwner = (loggedUser?.toLowerCase() == owner) || (`scheduled_${loggedUser?.toLowerCase()}@teuthology` == owner) const isButtonDisabled = (!isOwner && !isUserAdmin) diff --git a/src/lib/teuthologyAPI.d.ts b/src/lib/teuthologyAPI.d.ts index 937049d..2c58dcb 100644 --- a/src/lib/teuthologyAPI.d.ts +++ b/src/lib/teuthologyAPI.d.ts @@ -3,7 +3,9 @@ export type Session = { session: { id: int, username: string, - isUserAdmin: boolean, + isUserAdmin?: boolean, + role: string, + state: string, } }