Skip to content

Commit 61ceea8

Browse files
committed
:)
1 parent 159cbed commit 61ceea8

File tree

18 files changed

+53
-69
lines changed

18 files changed

+53
-69
lines changed

site/src/modules/dashboard/DashboardLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { useUpdateCheck } from "./useUpdateCheck";
1616

1717
export const DashboardLayout: FC = () => {
1818
const { permissions } = useAuthenticated();
19-
const updateCheck = useUpdateCheck(permissions.viewUpdateCheck);
20-
const canViewDeployment = Boolean(permissions.viewDeploymentValues);
19+
const updateCheck = useUpdateCheck(permissions.viewDeploymentConfig);
20+
const canViewDeployment = Boolean(permissions.viewDeploymentConfig);
2121

2222
return (
2323
<>

site/src/modules/dashboard/DeploymentBanner/DeploymentBanner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export const DeploymentBanner: FC = () => {
1010
const deploymentStatsQuery = useQuery(deploymentStats());
1111
const healthQuery = useQuery({
1212
...health(),
13-
enabled: permissions.viewDeploymentValues,
13+
enabled: permissions.viewDeploymentConfig,
1414
});
1515

16-
if (!permissions.viewDeploymentValues || !deploymentStatsQuery.data) {
16+
if (!permissions.viewDeploymentConfig || !deploymentStatsQuery.data) {
1717
return null;
1818
}
1919

site/src/modules/management/DeploymentSettingsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const DeploymentSettingsLayout: FC = () => {
2121
return (
2222
<Navigate
2323
to={
24-
permissions.viewDeploymentValues
24+
permissions.viewDeploymentConfig
2525
? "/deployment/general"
2626
: "/deployment/users"
2727
}

site/src/modules/management/DeploymentSidebarView.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export const NoDeploymentValues: Story = {
4747
args: {
4848
permissions: {
4949
...MockPermissions,
50-
viewDeploymentValues: false,
51-
editDeploymentValues: false,
50+
viewDeploymentConfig: false,
51+
editDeploymentConfig: false,
5252
},
5353
},
5454
};

site/src/modules/management/DeploymentSidebarView.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,62 +27,62 @@ export const DeploymentSidebarView: FC<DeploymentSidebarViewProps> = ({
2727
return (
2828
<BaseSidebar>
2929
<div className="flex flex-col gap-1">
30-
{permissions.viewAllUsers && (
31-
<SidebarNavItem href="/deployment/users">Users</SidebarNavItem>
32-
)}
33-
{permissions.viewAnyGroup && (
34-
<SidebarNavItem href="/deployment/groups">
35-
<Stack direction="row" alignItems="center" spacing={0.5}>
36-
Groups {showOrganizations && <ArrowUpRight size={16} />}
37-
</Stack>
38-
</SidebarNavItem>
39-
)}
40-
{permissions.viewDeploymentValues && (
41-
<SidebarNavItem href="/deployment/overview">Overview</SidebarNavItem>
30+
{permissions.viewDeploymentConfig && (
31+
<SidebarNavItem href="/deployment/general">General</SidebarNavItem>
4232
)}
4333
{permissions.viewAllLicenses && (
4434
<SidebarNavItem href="/deployment/licenses">Licenses</SidebarNavItem>
4535
)}
46-
{permissions.editDeploymentValues && (
36+
{permissions.editDeploymentConfig && (
4737
<SidebarNavItem href="/deployment/appearance">
4838
Appearance
4939
</SidebarNavItem>
5040
)}
51-
{permissions.viewDeploymentValues && (
41+
{permissions.viewDeploymentConfig && (
5242
<SidebarNavItem href="/deployment/userauth">
5343
User Authentication
5444
</SidebarNavItem>
5545
)}
56-
{permissions.viewDeploymentValues && (
46+
{permissions.viewDeploymentConfig && (
5747
<SidebarNavItem href="/deployment/external-auth">
5848
External Authentication
5949
</SidebarNavItem>
6050
)}
61-
{permissions.viewOrganizationIDPSyncSettings && (
62-
<SidebarNavItem href="/deployment/idp-org-sync">
63-
IdP Organization Sync
64-
</SidebarNavItem>
65-
)}
6651
{/* Not exposing this yet since token exchange is not finished yet.
6752
<SidebarNavItem href="oauth2-provider/apps">
6853
OAuth2 Applications
6954
</SidebarNavItem>*/}
70-
{permissions.viewDeploymentValues && (
55+
{permissions.viewDeploymentConfig && (
7156
<SidebarNavItem href="/deployment/network">Network</SidebarNavItem>
7257
)}
7358
{permissions.readWorkspaceProxies && (
7459
<SidebarNavItem href="/deployment/workspace-proxies">
7560
Workspace Proxies
7661
</SidebarNavItem>
7762
)}
78-
{permissions.viewDeploymentValues && (
63+
{permissions.viewDeploymentConfig && (
7964
<SidebarNavItem href="/deployment/security">Security</SidebarNavItem>
8065
)}
81-
{permissions.viewDeploymentValues && (
66+
{permissions.viewDeploymentConfig && (
8267
<SidebarNavItem href="/deployment/observability">
8368
Observability
8469
</SidebarNavItem>
8570
)}
71+
{permissions.viewAllUsers && (
72+
<SidebarNavItem href="/deployment/users">Users</SidebarNavItem>
73+
)}
74+
{permissions.viewAnyGroup && (
75+
<SidebarNavItem href="/deployment/groups">
76+
<Stack direction="row" alignItems="center" spacing={0.5}>
77+
Groups {showOrganizations && <ArrowUpRight size={16} />}
78+
</Stack>
79+
</SidebarNavItem>
80+
)}
81+
{permissions.viewOrganizationIDPSyncSettings && (
82+
<SidebarNavItem href="/deployment/idp-org-sync">
83+
IdP Organization Sync
84+
</SidebarNavItem>
85+
)}
8686
{permissions.viewNotificationTemplate && (
8787
<SidebarNavItem href="/deployment/notifications">
8888
<div className="flex flex-row items-center gap-2">

site/src/modules/permissions/index.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const permissionChecks = {
3030
resource_type: "template",
3131
any_org: true,
3232
},
33-
action: "update",
33+
action: "create",
3434
},
3535
updateTemplates: {
3636
object: {
@@ -44,30 +44,18 @@ export const permissionChecks = {
4444
},
4545
action: "delete",
4646
},
47-
viewDeploymentValues: {
47+
viewDeploymentConfig: {
4848
object: {
4949
resource_type: "deployment_config",
5050
},
5151
action: "read",
5252
},
53-
editDeploymentValues: {
53+
editDeploymentConfig: {
5454
object: {
5555
resource_type: "deployment_config",
5656
},
5757
action: "update",
5858
},
59-
viewUpdateCheck: {
60-
object: {
61-
resource_type: "deployment_config",
62-
},
63-
action: "read",
64-
},
65-
viewExternalAuthConfig: {
66-
object: {
67-
resource_type: "deployment_config",
68-
},
69-
action: "read",
70-
},
7159
viewDeploymentStats: {
7260
object: {
7361
resource_type: "deployment_stats",
@@ -178,9 +166,9 @@ export const canViewDeploymentSettings = (
178166
): permissions is Permissions => {
179167
return (
180168
permissions !== undefined &&
181-
(permissions.viewDeploymentValues ||
169+
(permissions.viewDeploymentConfig ||
182170
permissions.viewAllLicenses ||
183-
permissions.viewDeploymentValues ||
171+
permissions.viewDeploymentConfig ||
184172
permissions.viewAllUsers ||
185173
permissions.viewAnyGroup ||
186174
permissions.viewNotificationTemplate ||

site/src/pages/DeploymentSettingsPage/NotificationsPage/storybookUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export const baseMeta = {
194194
},
195195
],
196196
user: MockUser,
197-
permissions: { viewDeploymentValues: true },
197+
permissions: { viewDeploymentConfig: true },
198198
deploymentOptions: mockNotificationsDeploymentOptions,
199199
deploymentValues: {
200200
notifications: {

site/src/pages/ExternalAuthPage/ExternalAuthPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const ExternalAuthPage: FC = () => {
104104
authenticated: false,
105105
});
106106
}}
107-
viewExternalAuthConfig={permissions.viewExternalAuthConfig}
107+
viewExternalAuthConfig={permissions.viewDeploymentConfig}
108108
deviceExchangeError={deviceExchangeError}
109109
externalAuthDevice={externalAuthDeviceQuery.data}
110110
/>

site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const meta = {
4141
},
4242
],
4343
user: MockUser,
44-
permissions: { viewDeploymentValues: true },
44+
permissions: { viewDeploymentConfig: true },
4545
},
4646
decorators: [withGlobalSnackbar, withAuthProvider, withDashboardProvider],
4747
} satisfies Meta<typeof NotificationsPage>;
@@ -75,7 +75,7 @@ export const ToggleNotification: Story = {
7575

7676
export const NonAdmin: Story = {
7777
parameters: {
78-
permissions: { viewDeploymentValues: false },
78+
permissions: { viewDeploymentConfig: false },
7979
},
8080
};
8181

site/src/pages/UserSettingsPage/NotificationsPage/NotificationsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const NotificationsPage: FC = () => {
4848
...systemNotificationTemplates(),
4949
select: (data: NotificationTemplate[]) => {
5050
const groups = selectTemplatesByGroup(data);
51-
return permissions.viewDeploymentValues
51+
return permissions.viewDeploymentConfig
5252
? groups
5353
: {
5454
// Members only have access to the "Workspace Notifications" group

site/src/pages/UsersPage/UsersPage.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const parameters = {
6363
permissions: {
6464
createUser: true,
6565
updateUsers: true,
66-
viewDeploymentValues: true,
66+
viewDeploymentConfig: true,
6767
},
6868
};
6969

site/src/pages/UsersPage/UsersPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ const UsersPage: FC<UserPageProps> = ({ defaultNewPassword }) => {
5656
const {
5757
createUser: canCreateUser,
5858
updateUsers: canEditUsers,
59-
viewDeploymentValues,
59+
viewDeploymentConfig,
6060
} = permissions;
6161
const rolesQuery = useQuery(roles());
6262
const { data: deploymentValues } = useQuery({
6363
...deploymentConfig(),
64-
enabled: viewDeploymentValues,
64+
enabled: viewDeploymentConfig,
6565
});
6666

6767
const usersQuery = usePaginatedQuery(paginatedUsers(searchParamsResult[0]));
@@ -99,7 +99,7 @@ const UsersPage: FC<UserPageProps> = ({ defaultNewPassword }) => {
9999
// Indicates if oidc roles are synced from the oidc idp.
100100
// Assign 'false' if unknown.
101101
const oidcRoleSyncEnabled =
102-
viewDeploymentValues &&
102+
viewDeploymentConfig &&
103103
deploymentValues?.config.oidc?.user_role_field !== "";
104104

105105
const isLoading =

site/src/pages/WorkspacePage/Workspace.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const permissions: WorkspacePermissions = {
1212
readWorkspace: true,
1313
updateWorkspace: true,
1414
updateTemplate: true,
15-
viewDeploymentValues: true,
15+
viewDeploymentConfig: true,
1616
};
1717

1818
const meta: Meta<typeof Workspace> = {

site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const defaultPermissions = {
1515
readWorkspace: true,
1616
updateTemplate: true,
1717
updateWorkspace: true,
18-
viewDeploymentValues: true,
18+
viewDeploymentConfig: true,
1919
};
2020

2121
const meta: Meta<typeof WorkspaceNotifications> = {

site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const WorkspaceReadyPage: FC<WorkspaceReadyPageProps> = ({
6666
// Debug mode
6767
const { data: deploymentValues } = useQuery({
6868
...deploymentConfig(),
69-
enabled: permissions.viewDeploymentValues,
69+
enabled: permissions.viewDeploymentConfig,
7070
});
7171

7272
// Build logs

site/src/pages/WorkspacePage/permissions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const workspaceChecks = (workspace: Workspace, template: Template) =>
2525
},
2626
action: "update",
2727
},
28-
viewDeploymentValues: {
28+
viewDeploymentConfig: {
2929
object: {
3030
resource_type: "deployment_config",
3131
},

site/src/pages/WorkspacesPage/WorkspacesPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const useWorkspacesFilter = ({
156156
});
157157

158158
const { permissions } = useAuthenticated();
159-
const canFilterByUser = permissions.viewDeploymentValues;
159+
const canFilterByUser = permissions.viewDeploymentConfig;
160160
const userMenu = useUserFilterMenu({
161161
value: filter.values.owner,
162162
onChange: (option) =>

site/src/testHelpers/entities.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,11 +2843,9 @@ export const MockPermissions: Permissions = {
28432843
viewAllUsers: true,
28442844
updateUsers: true,
28452845
viewAnyAuditLog: true,
2846-
viewDeploymentValues: true,
2847-
editDeploymentValues: true,
2848-
viewUpdateCheck: true,
2846+
viewDeploymentConfig: true,
2847+
editDeploymentConfig: true,
28492848
viewDeploymentStats: true,
2850-
viewExternalAuthConfig: true,
28512849
readWorkspaceProxies: true,
28522850
editWorkspaceProxies: true,
28532851
createOrganization: true,
@@ -2872,11 +2870,9 @@ export const MockNoPermissions: Permissions = {
28722870
viewAllUsers: false,
28732871
updateUsers: false,
28742872
viewAnyAuditLog: false,
2875-
viewDeploymentValues: false,
2876-
editDeploymentValues: false,
2877-
viewUpdateCheck: false,
2873+
viewDeploymentConfig: false,
2874+
editDeploymentConfig: false,
28782875
viewDeploymentStats: false,
2879-
viewExternalAuthConfig: false,
28802876
readWorkspaceProxies: false,
28812877
editWorkspaceProxies: false,
28822878
createOrganization: false,

0 commit comments

Comments
 (0)