mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 05:21:36 +00:00
Added protection for enterprise policies
This commit is contained in:
parent
2b55099025
commit
b35333a9b6
@ -46,7 +46,7 @@ else
|
|||||||
<MudButton OnClick="@this.AddPolicy" Variant="Variant.Filled" Color="Color.Primary">
|
<MudButton OnClick="@this.AddPolicy" Variant="Variant.Filled" Color="Color.Primary">
|
||||||
@T("Add policy")
|
@T("Add policy")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
<MudButton OnClick="@this.RemovePolicy" Disabled="@(this.selectedPolicy?.IsProtected ?? true)" Variant="Variant.Filled" Color="Color.Error">
|
<MudButton OnClick="@this.RemovePolicy" Disabled="@((this.selectedPolicy?.IsProtected ?? true) || (this.selectedPolicy?.IsEnterpriseConfiguration ?? true))" Variant="Variant.Filled" Color="Color.Error">
|
||||||
@T("Delete this policy")
|
@T("Delete this policy")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|||||||
@ -227,9 +227,13 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
|||||||
if(this.selectedPolicy is null)
|
if(this.selectedPolicy is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The preselected profile is always user-adjustable, even for protected policies:
|
// The preselected profile is always user-adjustable, even for protected policies and enterprise configurations:
|
||||||
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfileId;
|
this.selectedPolicy.PreselectedProfile = this.policyPreselectedProfileId;
|
||||||
|
|
||||||
|
// Enterprise configurations cannot be modified at all:
|
||||||
|
if(this.selectedPolicy.IsEnterpriseConfiguration)
|
||||||
|
return;
|
||||||
|
|
||||||
var canEditProtectedFields = force || (!this.selectedPolicy.IsProtected && !this.policyIsProtected);
|
var canEditProtectedFields = force || (!this.selectedPolicy.IsProtected && !this.policyIsProtected);
|
||||||
if (canEditProtectedFields)
|
if (canEditProtectedFields)
|
||||||
{
|
{
|
||||||
@ -307,6 +311,9 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
|||||||
if(this.selectedPolicy.IsProtected)
|
if(this.selectedPolicy.IsProtected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(this.selectedPolicy.IsEnterpriseConfiguration)
|
||||||
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters<ConfirmDialog>
|
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ x => x.Message, string.Format(T("Are you sure you want to delete the document analysis policy '{0}'?"), this.selectedPolicy.PolicyName) },
|
{ x => x.Message, string.Format(T("Are you sure you want to delete the document analysis policy '{0}'?"), this.selectedPolicy.PolicyName) },
|
||||||
@ -340,6 +347,9 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
|||||||
if(this.selectedPolicy.IsProtected)
|
if(this.selectedPolicy.IsProtected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(this.selectedPolicy.IsEnterpriseConfiguration)
|
||||||
|
return;
|
||||||
|
|
||||||
this.selectedPolicy.PolicyName = this.policyName;
|
this.selectedPolicy.PolicyName = this.policyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,6 +358,9 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
|||||||
if(this.selectedPolicy is null)
|
if(this.selectedPolicy is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(this.selectedPolicy.IsEnterpriseConfiguration)
|
||||||
|
return;
|
||||||
|
|
||||||
this.policyIsProtected = state;
|
this.policyIsProtected = state;
|
||||||
this.selectedPolicy.IsProtected = state;
|
this.selectedPolicy.IsProtected = state;
|
||||||
this.policyDefinitionExpanded = !state;
|
this.policyDefinitionExpanded = !state;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user