Skip to content

Commit 4216618

Browse files
authored
feat: add MDM authentication notification when navigation is blocked (#7291)
- Show VSCode warning when users under MDM policy try to leave AccountView without auth - Add showMdmAuthRequiredNotification message type to WebviewMessage interface - Implement handler in webviewMessageHandler to display localized warning - Add 'Your organization requires authentication' translation in all 17 languages - Fix translation key path to use common:mdm.info.organization_requires_auth
1 parent 6fd261d commit 4216618

File tree

22 files changed

+70
-4
lines changed

22 files changed

+70
-4
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,8 @@ export class ClineProvider
15531553
this.postMessageToWebview({ type: "state", state })
15541554

15551555
// Check MDM compliance and send user to account tab if not compliant
1556-
if (!this.checkMdmCompliance()) {
1556+
// Only redirect if there's an actual MDM policy requiring authentication
1557+
if (this.mdmService?.requiresCloudAuth() && !this.checkMdmCompliance()) {
15571558
await this.postMessageToWebview({ type: "action", action: "accountButtonClicked" })
15581559
}
15591560
}
@@ -1872,7 +1873,9 @@ export class ClineProvider
18721873
codebaseIndexSearchMaxResults: codebaseIndexConfig?.codebaseIndexSearchMaxResults,
18731874
codebaseIndexSearchMinScore: codebaseIndexConfig?.codebaseIndexSearchMinScore,
18741875
},
1875-
mdmCompliant: this.checkMdmCompliance(),
1876+
// Only set mdmCompliant if there's an actual MDM policy
1877+
// undefined means no MDM policy, true means compliant, false means non-compliant
1878+
mdmCompliant: this.mdmService?.requiresCloudAuth() ? this.checkMdmCompliance() : undefined,
18761879
profileThresholds: profileThresholds ?? {},
18771880
cloudApiUrl: getRooCodeApiUrl(),
18781881
hasOpenedModeSelector: this.getGlobalState("hasOpenedModeSelector") ?? false,
@@ -2172,7 +2175,7 @@ export class ClineProvider
21722175

21732176
/**
21742177
* Check if the current state is compliant with MDM policy
2175-
* @returns true if compliant, false if blocked
2178+
* @returns true if compliant or no MDM policy exists, false if MDM policy exists and user is non-compliant
21762179
*/
21772180
public checkMdmCompliance(): boolean {
21782181
if (!this.mdmService) {

src/core/webview/webviewMessageHandler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,5 +2618,10 @@ export const webviewMessageHandler = async (
26182618
}
26192619
break
26202620
}
2621+
case "showMdmAuthRequiredNotification": {
2622+
// Show notification that organization requires authentication
2623+
vscode.window.showWarningMessage(t("common:mdm.info.organization_requires_auth"))
2624+
break
2625+
}
26212626
}
26222627
}

src/i18n/locales/ca/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
"cloud_auth_required": "Your organization requires Roo Code Cloud authentication. Please sign in to continue.",
181181
"organization_mismatch": "You must be authenticated with your organization's Roo Code Cloud account.",
182182
"verification_failed": "Unable to verify organization authentication."
183+
},
184+
"info": {
185+
"organization_requires_auth": "Your organization requires authentication."
183186
}
184187
},
185188
"prompts": {

src/i18n/locales/es/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)