mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Add more logs for RBAC features
This commit is contained in:
parent
2b11e0e52b
commit
5a16eec29d
@ -11,7 +11,7 @@ import { logConsoleError } from "../Utils/NotificationConsoleUtils";
|
|||||||
import * as PriorityBasedExecutionUtils from "../Utils/PriorityBasedExecutionUtils";
|
import * as PriorityBasedExecutionUtils from "../Utils/PriorityBasedExecutionUtils";
|
||||||
import { EmulatorMasterKey, HttpHeaders } from "./Constants";
|
import { EmulatorMasterKey, HttpHeaders } from "./Constants";
|
||||||
import { getErrorMessage } from "./ErrorHandlingUtils";
|
import { getErrorMessage } from "./ErrorHandlingUtils";
|
||||||
import * as Logger from "../Common/Logger"
|
import * as Logger from "../Common/Logger";
|
||||||
|
|
||||||
const _global = typeof self === "undefined" ? window : self;
|
const _global = typeof self === "undefined" ? window : self;
|
||||||
|
|
||||||
@ -85,9 +85,7 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (userContext.masterKey) {
|
if (userContext.masterKey) {
|
||||||
Logger.logInfo(
|
Logger.logInfo(`Master Key exists`, "Explorer/tokenProvider");
|
||||||
`Master Key exists`, "Explorer/tokenProvider",
|
|
||||||
);
|
|
||||||
// TODO This SDK method mutates the headers object. Find a better one or fix the SDK.
|
// TODO This SDK method mutates the headers object. Find a better one or fix the SDK.
|
||||||
await Cosmos.setAuthorizationTokenHeaderUsingMasterKey(
|
await Cosmos.setAuthorizationTokenHeaderUsingMasterKey(
|
||||||
verb,
|
verb,
|
||||||
|
@ -281,13 +281,9 @@ async function configureHostedWithAAD(config: AAD): Promise<Explorer> {
|
|||||||
"Explorer/configureHostedWithAAD",
|
"Explorer/configureHostedWithAAD",
|
||||||
);
|
);
|
||||||
if (!userContext.features.enableAadDataPlane) {
|
if (!userContext.features.enableAadDataPlane) {
|
||||||
Logger.logInfo(
|
Logger.logInfo(`AAD Feature flag is not enabled for account ${account.name}`, "Explorer/configureHostedWithAAD");
|
||||||
`AAD Feature flag is not enabled for account ${account.name}`,
|
|
||||||
"Explorer/configureHostedWithAAD",
|
|
||||||
);
|
|
||||||
if (userContext.apiType === "SQL") {
|
if (userContext.apiType === "SQL") {
|
||||||
if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
|
if (LocalStorageUtility.hasItem(StorageKey.DataPlaneRbacEnabled)) {
|
||||||
|
|
||||||
const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
|
const isDataPlaneRbacSetting = LocalStorageUtility.getEntryString(StorageKey.DataPlaneRbacEnabled);
|
||||||
Logger.logInfo(
|
Logger.logInfo(
|
||||||
`Local storage RBAC setting for ${userContext.apiType} account ${account.name} is ${isDataPlaneRbacSetting}`,
|
`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) {
|
async function fetchAndUpdateKeys(subscriptionId: string, resourceGroup: string, account: string) {
|
||||||
try {
|
try {
|
||||||
Logger.logInfo(
|
Logger.logInfo(`Fetching keys for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||||
`Fetching keys for ${userContext.apiType} account ${account}`,
|
|
||||||
"Explorer/fetchAndUpdateKeys",
|
|
||||||
);
|
|
||||||
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
const keys = await listKeys(subscriptionId, resourceGroup, account);
|
||||||
Logger.logInfo(
|
Logger.logInfo(`Keys fetched for ${userContext.apiType} account ${account}`, "Explorer/fetchAndUpdateKeys");
|
||||||
`Keys fetched for ${userContext.apiType} account ${account}`,
|
|
||||||
"Explorer/fetchAndUpdateKeys",
|
|
||||||
);
|
|
||||||
|
|
||||||
updateUserContext({
|
updateUserContext({
|
||||||
masterKey: keys.primaryMasterKey,
|
masterKey: keys.primaryMasterKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user