diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index 1cf10c2d1..64c724415 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -185,6 +185,9 @@ export class CassandraProxyAPIs { export class Queries { public static CustomPageOption: string = "custom"; public static UnlimitedPageOption: string = "unlimited"; + public static setAutomaticRBACOption: string = "Automatic"; + public static setTrueRBACOption: string = "True"; + public static setFalseRBACOption: string = "False"; public static itemsPerPage: number = 100; public static unlimitedItemsPerPage: number = 100; // TODO: Figure out appropriate value so it works for accounts with a large number of partitions public static containersPerPage: number = 50; diff --git a/src/Common/MongoProxyClient.ts b/src/Common/MongoProxyClient.ts index d9aa0fb4c..860be2bee 100644 --- a/src/Common/MongoProxyClient.ts +++ b/src/Common/MongoProxyClient.ts @@ -710,3 +710,4 @@ async function errorHandling(response: Response, action: string, params: unknown export function getARMCreateCollectionEndpoint(params: DataModels.MongoParameters): string { return `subscriptions/${params.sid}/resourceGroups/${params.rg}/providers/Microsoft.DocumentDB/databaseAccounts/${userContext.databaseAccount.name}/mongodbDatabases/${params.db}/collections/${params.coll}`; } + diff --git a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx index d8b9a82e4..8abb52ee9 100644 --- a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx +++ b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx @@ -129,6 +129,12 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ LocalStorageUtility.setEntryNumber(StorageKey.CustomItemPerPage, customItemPerPage); + LocalStorageUtility.setEntryString( + StorageKey.DataPlaneRbacEnabled, + enableDataPlaneRBACOption + ); + + LocalStorageUtility.setEntryString( StorageKey.DataPlaneRbacEnabled, enableDataPlaneRBACOption @@ -428,6 +434,27 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({ )} + {( +
+
+
+ + Enable DataPlane RBAC + + + Choose Automatic to enable DataPlane RBAC automatically. True/False to voluntarily enable/disable DataPlane RBAC + + +
+
+
+ )} {userContext.apiType === "SQL" && ( <>
diff --git a/src/Explorer/Tables/TableDataClient.ts b/src/Explorer/Tables/TableDataClient.ts index a9d7c96a6..80e4b1ec5 100644 --- a/src/Explorer/Tables/TableDataClient.ts +++ b/src/Explorer/Tables/TableDataClient.ts @@ -749,6 +749,10 @@ export class CassandraAPIDataClient extends TableDataClient { CassandraProxyEndpoints.Prod, ]; let canAccessCassandraProxy: boolean = userContext.databaseAccount.properties.publicNetworkAccess === "Enabled"; + if ( + configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && + userContext.databaseAccount.properties.ipRules?.length > 0 + ) { if ( configContext.CASSANDRA_PROXY_ENDPOINT !== CassandraProxyEndpoints.Development && userContext.databaseAccount.properties.ipRules?.length > 0 @@ -763,3 +767,4 @@ export class CassandraAPIDataClient extends TableDataClient { ); } } +} diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 5be72fb6b..70af4e603 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -419,6 +419,7 @@ async function configurePortal(): Promise { authType: AuthType.AAD, }); + let explorer: Explorer; return new Promise(async (resolve) => { // In development mode, try to load the iframe message from session storage. @@ -434,6 +435,7 @@ async function configurePortal(): Promise { updateContextsFromPortalMessage(message); explorer = new Explorer(); + // In development mode, save the iframe message from the portal in session storage. // This allows webpack hot reload to funciton properly if (process.env.NODE_ENV === "development") { @@ -442,7 +444,7 @@ async function configurePortal(): Promise { resolve(explorer); } } - + // In the Portal, configuration of Explorer happens via iframe message window.addEventListener( "message",