Revert RBAC feature flag behavior (#1910)

* Fix API endpoint for CassandraProxy query API

* activate Mongo Proxy and Cassandra Proxy in Prod

* Add CP Prod endpoint

* Run npm format and tests

* Revert code

* fix bug that blocked local mongo proxy and cassandra proxy development

* Add prod endpoint

* fix pr check tests

* Remove prod

* Remove prod endpoint

* Remove dev endpoint

* Support data plane RBAC

* Support data plane RBAC

* Add additional changes for Portal RBAC functionality

* Remove unnecessary code

* Remove unnecessary code

* Add code to fix VCoreMongo/PG bug

* Address feedback

* Add more logs for RBAC feature

* Add more logs for RBAC features

* Revert enableAADDataPlane feature flag behavior

* Address feedback

* Address comment

---------

Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
sindhuba
2024-07-17 10:12:36 -07:00
committed by GitHub
parent bd334a118a
commit e67c3f6774
3 changed files with 13 additions and 23 deletions

View File

@@ -27,7 +27,7 @@ import {
} from "Shared/StorageUtility";
import * as StringUtility from "Shared/StringUtility";
import { updateUserContext, userContext } from "UserContext";
import { logConsoleInfo } from "Utils/NotificationConsoleUtils";
import { logConsoleError, logConsoleInfo } from "Utils/NotificationConsoleUtils";
import * as PriorityBasedExecutionUtils from "Utils/PriorityBasedExecutionUtils";
import { useQueryCopilot } from "hooks/useQueryCopilot";
import { useSidePanel } from "hooks/useSidePanel";
@@ -171,13 +171,18 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
hasDataPlaneRbacSettingChanged: true,
});
const { databaseAccount: account, subscriptionId, resourceGroup } = userContext;
if (!userContext.features.enableAadDataPlane) {
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
if (!userContext.features.enableAadDataPlane && !userContext.masterKey) {
try {
const keys: DatabaseAccountListKeysResult = await listKeys(subscriptionId, resourceGroup, account.name);
if (keys.primaryMasterKey) {
updateUserContext({ masterKey: keys.primaryMasterKey });
if (keys.primaryMasterKey) {
updateUserContext({ masterKey: keys.primaryMasterKey });
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
useDataPlaneRbac.setState({ dataPlaneRbacEnabled: false });
}
} catch (error) {
logConsoleError(`Error occurred fetching keys for the account." ${error.message}`);
throw error;
}
}
}