From 7b43dcb6a1197646fa4cd7d958551342f233f160 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Thu, 17 Dec 2020 14:20:45 -0600 Subject: [PATCH] [Policy] Single Org dependency chain (#739) * Initial commit of Single Org downstream policy checks * Moved comments --- .../manage/policy-edit.component.ts | 16 +++++++++++++++- src/locales/en/messages.json | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/organizations/manage/policy-edit.component.ts b/src/app/organizations/manage/policy-edit.component.ts index 5856b3abf5c..ebf934b7168 100644 --- a/src/app/organizations/manage/policy-edit.component.ts +++ b/src/app/organizations/manage/policy-edit.component.ts @@ -175,7 +175,8 @@ export class PolicyEditComponent implements OnInit { private preValidate(): boolean { switch (this.type) { case PolicyType.RequireSso: - if (!this.enabled) { // Don't need prevalidation checks if submitting to disable + // Don't need prevalidation checks if submitting to disable + if (!this.enabled) { return true; } // Have SingleOrg policy enabled? @@ -186,6 +187,19 @@ export class PolicyEditComponent implements OnInit { } return true; + case PolicyType.SingleOrg: + // Don't need prevalidation checks if submitting to enable + if (this.enabled) { + return true; + } + // If RequireSso Policy is enabled prevent submittal + if (this.policiesEnabledMap.has(PolicyType.RequireSso) + && this.policiesEnabledMap.get(PolicyType.RequireSso)) { + this.toasterService.popAsync('error', null, this.i18nService.t('disableRequireSsoError')); + return false; + } + return true; + default: return true; } diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 774c24d9b57..538584fadd7 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -3394,5 +3394,8 @@ }, "estimatedTax": { "message": "Estimated tax" + }, + "disableRequireSsoError": { + "message": "You must manually disable the Single Sign-On Authentication policy before this policy can be disabled." } }