Skip to content

Commit add45fb

Browse files
committed
fix: update sidebar for roles
1 parent e40f0bf commit add45fb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

site/src/api/queries/organizations.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ export const organizationPermissions = (organizationId: string | undefined) => {
177177
},
178178
action: "read",
179179
},
180+
assignOrgRole: {
181+
object: {
182+
resource_type: "assign_org_role",
183+
organization_id: organizationId,
184+
},
185+
action: "create",
186+
},
180187
},
181188
}),
182189
};

site/src/pages/ManagementSettingsPage/SidebarView.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar";
1010
import { Stack } from "components/Stack/Stack";
1111
import { UserAvatar } from "components/UserAvatar/UserAvatar";
1212
import { type ClassName, useClassName } from "hooks/useClassName";
13+
import { useDashboard } from "modules/dashboard/useDashboard";
1314
import { linkToAuditing, linkToUsers, withFilter } from "modules/navigation";
1415

1516
interface SidebarProps {
@@ -184,6 +185,8 @@ interface OrganizationSettingsNavigationProps {
184185
const OrganizationSettingsNavigation: FC<
185186
OrganizationSettingsNavigationProps
186187
> = (props) => {
188+
const { experiments } = useDashboard();
189+
187190
return (
188191
<>
189192
<SidebarNavItem
@@ -225,6 +228,14 @@ const OrganizationSettingsNavigation: FC<
225228
Groups
226229
</SidebarNavSubItem>
227230
)}
231+
{props.permissions.assignOrgRole &&
232+
experiments.includes("custom-roles") && (
233+
<SidebarNavSubItem
234+
href={urlForSubpage(props.organization.name, "roles")}
235+
>
236+
Roles
237+
</SidebarNavSubItem>
238+
)}
228239
{/* For now redirect to the site-wide audit page with the organization
229240
pre-filled into the filter. Based on user feedback we might want
230241
to serve a copy of the audit page or even delete this link. */}

0 commit comments

Comments
 (0)