Skip to content

Commit beed489

Browse files
authored
Apply permission check for create accesskey button (#2822)
1 parent 629dd66 commit beed489

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

portal-ui/src/screens/Console/Account/Account.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,22 @@ const Account = () => {
247247
disabled={userIDP}
248248
/>
249249
</SecureComponent>
250-
<Button
251-
id={"create-service-account"}
252-
onClick={() => {
253-
navigate(`${IAM_PAGES.ACCOUNT_ADD}`);
254-
}}
255-
label={`Create access key`}
256-
icon={<AddIcon />}
257-
variant={"callAction"}
258-
/>
250+
<SecureComponent
251+
scopes={[IAM_SCOPES.ADMIN_CREATE_SERVICEACCOUNT]}
252+
resource={CONSOLE_UI_RESOURCE}
253+
matchAll
254+
errorProps={{ disabled: true }}
255+
>
256+
<Button
257+
id={"create-service-account"}
258+
onClick={() => {
259+
navigate(`${IAM_PAGES.ACCOUNT_ADD}`);
260+
}}
261+
label={`Create access key`}
262+
icon={<AddIcon />}
263+
variant={"callAction"}
264+
/>
265+
</SecureComponent>
259266
</Box>
260267
</Grid>
261268

0 commit comments

Comments
 (0)