Skip to content

Commit

Permalink
kill: fix admin detection
Browse files Browse the repository at this point in the history
  • Loading branch information
zmc committed Oct 3, 2024
1 parent 14b90d4 commit ccbb5ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/KillButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/lib/teuthologyAPI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export type Session = {
session: {
id: int,
username: string,
isUserAdmin: boolean,
isUserAdmin?: boolean,
role: string,
state: string,
}
}

Expand Down

0 comments on commit ccbb5ef

Please sign in to comment.