Skip to content

fix: fix deployment settings navigation issues #16780

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
merged 3 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
feedback
  • Loading branch information
aslilac committed Mar 3, 2025
commit 88e3720aa62d4cc43f153270fce9eb8a3b0dbcf8
6 changes: 3 additions & 3 deletions site/e2e/tests/roles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const adminSettings = [

async function hasAccessToAdminSettings(page: Page, settings: AdminSetting[]) {
// Organizations and Audit Logs both require a license to be visible
const visibleSettings = settings.filter(
(it) => Boolean(license) || (it !== "Organizations" && it !== "Audit Logs"),
);
const visibleSettings = license
? settings
: settings.filter((it) => it !== "Organizations" && it !== "Audit Logs");
const adminSettingsButton = page.getByRole("button", {
name: "Admin settings",
});
Expand Down
1 change: 0 additions & 1 deletion site/src/contexts/auth/permissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export const canViewDeploymentSettings = (
permissions !== undefined &&
(permissions.viewDeploymentValues ||
permissions.viewAllLicenses ||
permissions.viewDeploymentValues ||
permissions.viewAllUsers ||
permissions.viewAnyGroup ||
permissions.viewNotificationTemplate ||
Expand Down
8 changes: 4 additions & 4 deletions site/src/modules/management/DeploymentSettingsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ const DeploymentSettingsLayout: FC = () => {
const { permissions } = useAuthenticated();
const location = useLocation();

// The deployment settings page also contains users and groups and more so
// this page must be visible if you can see any of these.
const canViewDeploymentSettingsPage = canViewDeploymentSettings(permissions);

if (location.pathname === "/deployment") {
return (
<Navigate
Expand All @@ -34,6 +30,10 @@ const DeploymentSettingsLayout: FC = () => {
);
}

// The deployment settings page also contains users and groups and more so
// this page must be visible if you can see any of these.
const canViewDeploymentSettingsPage = canViewDeploymentSettings(permissions);

return (
<RequirePermission isFeatureVisible={canViewDeploymentSettingsPage}>
<div>
Expand Down
Loading