Skip to content

Commit

Permalink
Fix access control tab fetching for remote cluster (opensearch-projec…
Browse files Browse the repository at this point in the history
…t#7456)

Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 authored Jul 24, 2024
1 parent 536fbbb commit d152ced
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface AccessControlTabProps {
connector: string;
properties: unknown;
allowedRoles: string[];
dataSourceMDSId: string;
}

export const AccessControlTab = (props: AccessControlTabProps) => {
Expand All @@ -34,17 +35,17 @@ export const AccessControlTab = (props: AccessControlTabProps) => {
const { http } = useOpenSearchDashboards<DataSourceManagementContext>().services;

useEffect(() => {
http!
.get(SECURITY_ROLES)
.then((data) =>
http
.get(SECURITY_ROLES, { query: { dataSourceId: props.dataSourceMDSId } })
.then((data) => {
setRoles(
Object.keys(data.data).map((key) => {
return { label: key };
})
)
)
);
})
.catch((err) => setHasSecurityAccess(false));
}, [http]);
}, [http, props.dataSourceMDSId]);

const [selectedQueryPermissionRoles, setSelectedQueryPermissionRoles] = useState<Role[]>(
props.allowedRoles.map((role) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ export const DirectQueryDataConnectionDetail: React.FC<DirectQueryDataConnection
properties={datasourceDetails.properties}
allowedRoles={datasourceDetails.allowedRoles}
key={JSON.stringify(datasourceDetails.allowedRoles)}
dataSourceMDSId={featureFlagStatus ? dataSourceMDSId ?? '' : ''}
/>
),
},
Expand Down

0 comments on commit d152ced

Please sign in to comment.