Merge pull request #3932 from bluewave-labs/fix/test-all-admin-guard
fix: add admin guard to test all button, fix tests
This commit is contained in:
2 files changed
+19
-17
No files matched your search
@@ -60,20 +60,22 @@ export const HeaderMonitorControls = ({
|
||||
direction={{ xs: "column", md: "row" }}
|
||||
gap={theme.spacing(2)}
|
||||
>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
loading={isPosting}
|
||||
startIcon={<Icon icon={Mail} />}
|
||||
onClick={async () => {
|
||||
await post(`/notifications/test/all`, { monitorId: monitor.id });
|
||||
}}
|
||||
sx={{
|
||||
whiteSpace: "nowrap",
|
||||
}}
|
||||
>
|
||||
{t("common.buttons.testNotifications")}
|
||||
</Button>
|
||||
{isAdmin && (
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
loading={isPosting}
|
||||
startIcon={<Icon icon={Mail} />}
|
||||
onClick={async () => {
|
||||
await post(`/notifications/test/all`, { monitorId: monitor.id });
|
||||
}}
|
||||
sx={{
|
||||
whiteSpace: "nowrap",
|
||||
}}
|
||||
>
|
||||
{t("common.buttons.testNotifications")}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
|
||||
@@ -8,7 +8,7 @@ describe("isAllowed middleware", () => {
|
||||
const middleware = isAllowed(["admin", "superadmin"]);
|
||||
const req = {
|
||||
user: {
|
||||
userId: "user-1",
|
||||
id: "user-1",
|
||||
teamId: "team-1",
|
||||
email: "admin@example.com",
|
||||
role: ["admin"],
|
||||
@@ -26,7 +26,7 @@ describe("isAllowed middleware", () => {
|
||||
const middleware = isAllowed(["admin", "superadmin"]);
|
||||
const req = {
|
||||
user: {
|
||||
userId: "user-2",
|
||||
id: "user-2",
|
||||
teamId: "team-1",
|
||||
email: "user@example.com",
|
||||
role: ["user"],
|
||||
@@ -63,7 +63,7 @@ describe("isAllowed middleware", () => {
|
||||
const middleware = isAllowed(["admin", "superadmin"]);
|
||||
const req = {
|
||||
user: {
|
||||
userId: "user-3",
|
||||
id: "user-3",
|
||||
teamId: "team-1",
|
||||
email: "multi@example.com",
|
||||
role: ["user", "admin"],
|
||||
|
||||
Reference in new issue
Block a user