Skip to content

fix: require permissions to view pages related to organization roles #16688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: require permissions to view org role related pages
  • Loading branch information
brettkolodny committed Feb 24, 2025
commit 00cf72920f12397c211e388ba01a1a60893b6ece
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { CustomRoleRequest } from "api/typesGenerated";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { displayError } from "components/GlobalSnackbar/utils";
import { Loader } from "components/Loader/Loader";
import { RequirePermission } from "contexts/auth/RequirePermission";
import { useOrganizationSettings } from "modules/management/OrganizationSettingsLayout";
import type { FC } from "react";
import { Helmet } from "react-helmet-async";
Expand Down Expand Up @@ -45,7 +46,12 @@ export const CreateEditRolePage: FC = () => {
}

return (
<>
<RequirePermission
isFeatureVisible={
organizationPermissions.assignOrgRoles ||
organizationPermissions.createOrgRoles
}
>
<Helmet>
<title>
{pageTitle(
Expand Down Expand Up @@ -83,7 +89,7 @@ export const CreateEditRolePage: FC = () => {
organizationName={organizationName}
canAssignOrgRole={organizationPermissions.assignOrgRoles}
/>
</>
</RequirePermission>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
import { Loader } from "components/Loader/Loader";
import { SettingsHeader } from "components/SettingsHeader/SettingsHeader";
import { Stack } from "components/Stack/Stack";
import { RequirePermission } from "contexts/auth/RequirePermission";
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
import { useOrganizationSettings } from "modules/management/OrganizationSettingsLayout";
import { type FC, useEffect, useState } from "react";
Expand Down Expand Up @@ -53,7 +54,12 @@ export const CustomRolesPage: FC = () => {
}

return (
<>
<RequirePermission
isFeatureVisible={
organizationPermissions.assignOrgRoles ||
organizationPermissions.createOrgRoles
}
>
<Helmet>
<title>{pageTitle("Custom Roles")}</title>
</Helmet>
Expand Down Expand Up @@ -100,7 +106,7 @@ export const CustomRolesPage: FC = () => {
}
}}
/>
</>
</RequirePermission>
);
};

Expand Down
Loading