From 5a16eec29d21ca74d05e9d56e486314d86766d21 Mon Sep 17 00:00:00 2001 From: Senthamil Sindhu Date: Wed, 10 Jul 2024 07:38:37 -0700 Subject: [PATCH] Add more logs for RBAC features --- src/Common/CosmosClient.ts | 6 ++---- src/hooks/useKnockoutExplorer.ts | 16 +++------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Common/CosmosClient.ts b/src/Common/CosmosClient.ts index 7cbe22ceb..7e8a7f04c 100644 --- a/src/Common/CosmosClient.ts +++ b/src/Common/CosmosClient.ts @@ -11,7 +11,7 @@ import { logConsoleError } from "../Utils/NotificationConsoleUtils"; import * as PriorityBasedExecutionUtils from "../Utils/PriorityBasedExecutionUtils"; import { EmulatorMasterKey, HttpHeaders } from "./Constants"; import { getErrorMessage } from "./ErrorHandlingUtils"; -import * as Logger from "../Common/Logger" +import * as Logger from "../Common/Logger"; const _global = typeof self === "undefined" ? window : self; @@ -85,9 +85,7 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => { } if (userContext.masterKey) { - Logger.logInfo( - `Master Key exists`, "Explorer/tokenProvider", - ); + Logger.logInfo(`Master Key exists`, "Explorer/tokenProvider"); // TODO This SDK method mutates the headers object. Find a better one or fix the SDK. await Cosmos.setAuthorizationTokenHeaderUsingMasterKey( verb, diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index b7c9776cf..22cc0b51d 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -281,13 +281,9 @@ async function configureHostedWithAAD(config: AAD): Promise { "Explorer/configureHostedWithAAD", ); if (!userContext.features.enableAadDataPlane) { - Logger.logInfo( - `AAD Feature flag is not enabled for account ${account.name}`, - "Explorer/configureHostedWithAAD", - ); + Logger.logInfo(`AAD Feature flag is not enabled for account ${account.name}`, "Explorer/configureHostedWithAAD"); if (userContext.apiType === "SQL") { if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) { - const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled); Logger.logInfo( `Local storage RBAC setting for ${userContext.apiType} account ${account.name} is ${isDataPlaneRbacSetting}`, @@ -471,15 +467,9 @@ function configureEmulator(): Explorer { async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) { try { - Logger.logInfo( - `Fetching keys for ${userContext.apiType} account ${account}`, - "Explorer/fetchAndUpdateKeys", - ); + Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys"); const keys = await listKeys(subscriptionId, resourceGroup, account); - Logger.logInfo( - `Keys fetched for ${userContext.apiType} account ${account}`, - "Explorer/fetchAndUpdateKeys", - ); + Logger.logInfo(`Keys fetched for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys"); updateUserContext({ masterKey: keys.primaryMasterKey,