Enhance policy protection feature and add managed policy property

This commit is contained in:
Thorsten Sommer 2025-10-20 18:46:56 +02:00
parent cd9d6b2258
commit a6a52989b8
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 7 additions and 2 deletions

View File

@ -50,7 +50,7 @@ else
</MudText>
<MudTextField T="string" Disabled="@this.IsNoPolicySelectedOrProtected" @bind-Text="@this.policyName" Validation="@this.ValidatePolicyName" Immediate="@true" Label="@T("Policy name")" HelperText="@T("Please give your policy a name that provides information about the intended purpose. The name will be displayed to users in AI Studio.")" Counter="60" MaxLength="60" Variant="Variant.Outlined" Margin="Margin.Normal" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3" OnKeyUp="() => this.PolicyNameWasChanged()"/>
<MudTextField T="string" Disabled="@this.IsNoPolicySelectedOrProtected" @bind-Text="@this.policyDescription" Validation="@this.ValidatePolicyDescription" Immediate="@true" Label="@T("Policy description")" HelperText="@T("Please provide a brief description of your policy. Describe or explain what your policy does. This description will be shown to users in AI Studio.")" Counter="512" MaxLength="512" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
<MudTextSwitch Label="@T("Would you like to protect this policy so that you cannot accidentally edit or delete it?")" Value="@this.policyIsProtected" ValueChanged="async state => await this.PolicyProtectionWasChanged(state)" LabelOn="@T("Yes, protect this policy")" LabelOff="@T("No, the policy can be edited")" />
<MudTextSwitch Disabled="@(this.IsNoPolicySelected || (this.selectedPolicy?.IsManaged ?? true))" Label="@T("Would you like to protect this policy so that you cannot accidentally edit or delete it?")" Value="@this.policyIsProtected" ValueChanged="async state => await this.PolicyProtectionWasChanged(state)" LabelOn="@T("Yes, protect this policy")" LabelOff="@T("No, the policy can be edited")" />
<MudText Typo="Typo.h4" Class="mt-6 mb-1">
@T("Input and output rules")

View File

@ -16,10 +16,15 @@ public sealed class DataDocumentAnalysisPolicy
/// <summary>
/// Is this policy protected? If so, it cannot be deleted or modified by the user.
/// This is useful for policies that are distributed by the organization.
/// </summary>
public bool IsProtected { get; set; }
/// <summary>
/// Is this a managed policy? Managed policies are created and managed by the organization
/// and cannot be modified or deleted by the user.
/// </summary>
public bool IsManaged { get; set; }
/// <summary>
/// The rules for the document analysis policy.
/// </summary>