-
-
+ {userContext.apiType === "SQL" && userContext.authType === AuthType.AAD && (
+ <>
+
+
+
+
-
- )}
- {(
-
-
-
-
-
+ >
)}
{userContext.apiType === "SQL" && (
<>
diff --git a/src/Explorer/Tables/TableDataClient.ts b/src/Explorer/Tables/TableDataClient.ts
index e40ddef6f..25a43f56b 100644
--- a/src/Explorer/Tables/TableDataClient.ts
+++ b/src/Explorer/Tables/TableDataClient.ts
@@ -755,10 +755,6 @@ 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
@@ -773,4 +769,3 @@ export class CassandraAPIDataClient extends TableDataClient {
);
}
}
-}
diff --git a/src/Platform/Hosted/extractFeatures.ts b/src/Platform/Hosted/extractFeatures.ts
index 28723e475..5bd84516e 100644
--- a/src/Platform/Hosted/extractFeatures.ts
+++ b/src/Platform/Hosted/extractFeatures.ts
@@ -14,7 +14,6 @@ export type Features = {
readonly enableTtl: boolean;
readonly executeSproc: boolean;
readonly enableAadDataPlane: boolean;
- readonly enableDataPlaneRbac: boolean;
readonly enableResourceGraph: boolean;
readonly enableKoResourceTree: boolean;
readonly hostedDataExplorer: boolean;
@@ -70,7 +69,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
canExceedMaximumValue: "true" === get("canexceedmaximumvalue"),
cosmosdb: "true" === get("cosmosdb"),
enableAadDataPlane: "true" === get("enableaaddataplane"),
- enableDataPlaneRbac: "true" === get("enabledataplanerbac"),
enableResourceGraph: "true" === get("enableresourcegraph"),
enableChangeFeedPolicy: "true" === get("enablechangefeedpolicy"),
enableFixedCollectionWithSharedThroughput: "true" === get("enablefixedcollectionwithsharedthroughput"),
diff --git a/src/Shared/StorageUtility.ts b/src/Shared/StorageUtility.ts
index 6cf5fa47d..f2ca1f20b 100644
--- a/src/Shared/StorageUtility.ts
+++ b/src/Shared/StorageUtility.ts
@@ -7,8 +7,6 @@ export { LocalStorageUtility, SessionStorageUtility };
export enum StorageKey {
ActualItemPerPage,
DataPlaneRbacEnabled,
- DataPlaneRbacDisabled,
- isDataPlaneRbacAutomatic,
RUThresholdEnabled,
RUThreshold,
QueryTimeoutEnabled,
diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts
index 70af4e603..3ee6a04a4 100644
--- a/src/hooks/useKnockoutExplorer.ts
+++ b/src/hooks/useKnockoutExplorer.ts
@@ -43,6 +43,7 @@ import { isInvalidParentFrameOrigin, shouldProcessMessage } from "../Utils/Messa
import { listKeys } from "../Utils/arm/generatedClients/cosmos/databaseAccounts";
import { DatabaseAccountListKeysResult } from "../Utils/arm/generatedClients/cosmos/types";
import { applyExplorerBindings } from "../applyExplorerBindings";
+import { useDataPlaneRbac } from "Explorer/Panes/SettingsPane/SettingsPane";
// This hook will create a new instance of Explorer.ts and bind it to the DOM
// This hook has a LOT of magic, but ideally we can delete it once we have removed KO and switched entirely to React
@@ -255,7 +256,6 @@ async function configureHostedWithAAD(config: AAD): Promise
{
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
let aadToken;
- let keys: DatabaseAccountListKeysResult = {};
if (account.properties?.documentEndpoint) {
const hrefEndpoint = new URL(account.properties.documentEndpoint).href.replace(/\/$/, "/.default");
const msalInstance = await getMsalInstance();
@@ -273,30 +273,30 @@ async function configureHostedWithAAD(config: AAD): Promise {
}
}
try {
- if(LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
- var isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
- if (isDataPlaneRbacSetting == Constants.RBACOptions.setAutomaticRBACOption)
- {
- if (!account.properties.disableLocalAuth) {
- keys = await listKeys(subscriptionId, resourceGroup, account.name);
- }
- else {
- updateUserContext({
- dataPlaneRbacEnabled: true
- });
+ updateUserContext({
+ databaseAccount: config.databaseAccount,
+ });
+
+ if (!userContext.features.enableAadDataPlane) {
+ if (userContext.apiType === "SQL") {
+ if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
+ const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
+
+ let dataPlaneRbacEnabled;
+ if (isDataPlaneRbacSetting === Constants.RBACOptions.setAutomaticRBACOption) {
+ dataPlaneRbacEnabled = account.properties.disableLocalAuth;
+ } else {
+ dataPlaneRbacEnabled = isDataPlaneRbacSetting === Constants.RBACOptions.setTrueRBACOption;
}
+
+ updateUserContext({ dataPlaneRbacEnabled });
}
- else if(isDataPlaneRbacSetting == Constants.RBACOptions.setTrueRBACOption) {
- updateUserContext({
- dataPlaneRbacEnabled: true
- });
- }
- else {
- keys = await listKeys(subscriptionId, resourceGroup, account.name);
- updateUserContext({
- dataPlaneRbacEnabled: false
- });
- }
+ } else {
+ const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
+ updateUserContext({
+ masterKey: keys.primaryMasterKey,
+ });
+ }
}
} catch (e) {
if (userContext.features.enableAadDataPlane) {
@@ -309,8 +309,6 @@ async function configureHostedWithAAD(config: AAD): Promise {
subscriptionId,
resourceGroup,
aadToken,
- databaseAccount: config.databaseAccount,
- masterKey: keys.primaryMasterKey,
});
const explorer = new Explorer();
return explorer;
@@ -418,10 +416,8 @@ async function configurePortal(): Promise {
updateUserContext({
authType: AuthType.AAD,
});
-
-
let explorer: Explorer;
- return new Promise(async (resolve) => {
+ return new Promise((resolve) => {
// In development mode, try to load the iframe message from session storage.
// This allows webpack hot reload to function properly in the portal
if (process.env.NODE_ENV === "development" && !window.location.search.includes("disablePortalInitCache")) {
@@ -434,8 +430,6 @@ async function configurePortal(): Promise {
console.dir(message);
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") {
@@ -459,7 +453,7 @@ async function configurePortal(): Promise {
// Check for init message
const message: PortalMessage = event.data?.data;
- const inputs = message?.inputs;
+ const inputs = message?.inputs;
const openAction = message?.openAction;
if (inputs) {
if (
@@ -478,39 +472,29 @@ async function configurePortal(): Promise {
setTimeout(() => explorer.openNPSSurveyDialog(), 3000);
}
- let keys: DatabaseAccountListKeysResult = {};
- const account = userContext.databaseAccount;
- const subscriptionId = userContext.subscriptionId;
- const resourceGroup = userContext.resourceGroup;
+ const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
- if(LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
- var isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
- if (isDataPlaneRbacSetting == Constants.RBACOptions.setAutomaticRBACOption)
- {
- if (!account.properties.disableLocalAuth) {
- keys = await listKeys(subscriptionId, resourceGroup, account.name);
- }
- else {
- updateUserContext({
- dataPlaneRbacEnabled: true,
- authorizationToken: message.inputs.authorizationToken
- });
- }
- }
- else if(isDataPlaneRbacSetting == Constants.RBACOptions.setTrueRBACOption) {
- updateUserContext({
- dataPlaneRbacEnabled: true,
- authorizationToken: message.inputs.authorizationToken
- });
- }
- else {
- keys = await listKeys(subscriptionId, resourceGroup, account.name);
- updateUserContext({
- dataPlaneRbacEnabled: false
- });
+ if (userContext.apiType === "SQL") {
+ if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
+ const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
+
+ let dataPlaneRbacEnabled;
+ if (isDataPlaneRbacSetting === Constants.RBACOptions.setAutomaticRBACOption) {
+ dataPlaneRbacEnabled = account.properties.disableLocalAuth;
+ } else {
+ dataPlaneRbacEnabled = isDataPlaneRbacSetting === Constants.RBACOptions.setTrueRBACOption;
}
+
+ updateUserContext({ dataPlaneRbacEnabled });
+ useDataPlaneRbac.setState({ dataPlaneRbacEnabled: dataPlaneRbacEnabled });
+ }
+ } else {
+ const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
+ updateUserContext({
+ masterKey: keys.primaryMasterKey,
+ });
}
-
+
if (openAction) {
handleOpenAction(openAction, useDatabases.getState().databases, explorer);
}
@@ -531,11 +515,9 @@ async function configurePortal(): Promise {
},
false,
);
-
+
sendReadyMessage();
-
});
-
}
function shouldForwardMessage(message: PortalMessage, messageOrigin: string) {
@@ -553,7 +535,6 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
}
const authorizationToken = inputs.authorizationToken || "";
- const masterKey = inputs.masterKey || "";
const databaseAccount = inputs.databaseAccount;
updateConfigContext({
@@ -566,7 +547,6 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
updateUserContext({
authorizationToken,
- masterKey,
databaseAccount,
resourceGroup: inputs.resourceGroup,
subscriptionId: inputs.subscriptionId,