Skip to content

Commit eef58e5

Browse files
authored
Fix hiding tobira tab in series create modal (#1122)
In the series create modal, we query ´/admin-ng/series/new/tobira/page` to check if Tobira is available. However, if the user does not have the role required for that endpoint (ROLE_UI_SERIES_DETAILS_TOBIRA_EDIT), the endpoint will return an error html page which we are not expecting, causing the ui to crash. This fixes the problem by checking if the user has the required role to make the request to the endpoint. If the user does not have the role, the tobira tab is then not shown.
1 parent 1f39761 commit eef58e5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/components/events/partials/wizards/NewSeriesWizard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { UserInfoState } from "../../../../slices/userInfoSlice";
2323
import { TransformedAcl } from "../../../../slices/aclDetailsSlice";
2424
import { removeNotificationWizardForm } from "../../../../slices/notificationSlice";
2525
import NewMetadataCommonPage from "../ModalTabsAndPages/NewMetadataCommonPage";
26+
import { hasAccess } from "../../../../utils/utils";
2627

2728
/**
2829
* This component manages the pages of the new series wizard and the submission of values
@@ -87,7 +88,7 @@ const NewSeriesWizard: React.FC<{
8788
{
8889
translation: "EVENTS.SERIES.NEW.TOBIRA.CAPTION",
8990
name: "tobira",
90-
hidden: !!(tobiraStatus === "failed" && tobiraError?.message?.includes("503")),
91+
hidden: !hasAccess("ROLE_UI_SERIES_DETAILS_TOBIRA_EDIT", user) || !!(tobiraStatus === "failed" && tobiraError?.message?.includes("503")),
9192
},
9293
{
9394
translation: "EVENTS.SERIES.NEW.SUMMARY.CAPTION",

0 commit comments

Comments
 (0)