Skip to content

Commit

Permalink
ARTESCA-13607 // filter out iam storage manager role
Browse files Browse the repository at this point in the history
Refactor SelectAccountIAMRole component and utils/hooks.ts
  • Loading branch information
hervedombya committed Oct 21, 2024
1 parent 23fe25f commit 9a2ff16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/react/ui-elements/SelectAccountIAMRole.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
Form,
FormGroup,
FormSection,
Stack,
useToast,
} from '@scality/core-ui';
import { Form, FormGroup, FormSection, useToast } from '@scality/core-ui';
import { Select } from '@scality/core-ui/dist/next';
import { IAM } from 'aws-sdk';
import { Bucket } from 'aws-sdk/clients/s3';
Expand All @@ -26,7 +20,7 @@ import {
} from '../next-architecture/ui/AccessibleAccountsAdapterProvider';
import { AccountsLocationsEndpointsAdapterProvider } from '../next-architecture/ui/AccountsLocationsEndpointsAdapterProvider';
import { getListRolesQuery } from '../queries';
import { SCALITY_INTERNAL_ROLES, regexArn } from '../utils/hooks';
import { SCALITY_IAM_ROLES, regexArn } from '../utils/hooks';

class NoOpMetricsAdapter implements IMetricsAdapter {
async listBucketsLatestUsedCapacity(
Expand Down Expand Up @@ -234,7 +228,7 @@ const SelectAccountIAMRoleWithAccount = (
const roles = props.filterOutInternalRoles
? allRolesExceptHiddenOnes.filter((role) => {
return (
SCALITY_INTERNAL_ROLES.includes(role.RoleName) ||
SCALITY_IAM_ROLES.includes(role.RoleName) ||
!role.Arn.includes('role/scality-internal')
);
})
Expand Down
5 changes: 5 additions & 0 deletions src/react/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ export const SCALITY_INTERNAL_ROLES = [
DATA_CONSUMER_ROLE,
DATA_ACCESSOR_ROLE,
];
export const SCALITY_IAM_ROLES = [
STORAGE_ACCOUNT_OWNER_ROLE,
DATA_CONSUMER_ROLE,
DATA_ACCESSOR_ROLE,
];

const reduxBasedEventDispatcher = () => {
const dispatch = useDispatch();
Expand Down

0 comments on commit 9a2ff16

Please sign in to comment.