Files
xIdentityModels/Models/XPolicyDefinition.cs
2026-11-15 17:53:12 +03:30

70 lines
2.0 KiB
C#

using xModels.Base;
using xIdentityModels.Constants;
using System.ComponentModel.DataAnnotations;
namespace xIdentityModels.Models
{
/// <summary>
/// a Policy Definition Model which can be converted to AuthorizationPolicy ...
/// </summary>
public class XPolicyDefinition : XBaseIntIDEntity
{
/// <summary>
/// Unique Policy Name, e.g. enabledEditorPolicy ...
/// </summary>
[Required]
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// Display Name ...
/// </summary>
[StringLength(255)]
public string DisplayName { get; set; }
/// <summary>
/// Policy Kind ...
/// </summary>
public XPolicyKind Kind { get; set; } = XPolicyKind.RoleBased;
/// <summary>
/// Comma Separated Role Names (explicit list) ...
/// </summary>
public string RequiredRoles { get; set; }
/// <summary>
/// if provided, all Roles with Weight >= MinRoleWeight will be Injected ...
/// </summary>
public int? MinRoleWeight { get; set; }
/// <summary>
/// Comma Separated Scope Names ...
/// </summary>
public string RequiredScopes { get; set; }
/// <summary>
/// Json Array of { "Type": "...", "Values": ["..."] } ...
/// </summary>
public string RequiredClaims { get; set; }
/// <summary>
/// Requires IsBanned=false and IsEnabled=true Claims ...
/// </summary>
public bool RequireEnabledUser { get; set; }
/// <summary>
/// Requires Authenticated User ...
/// </summary>
public bool RequireAuthenticatedUser { get; set; } = true;
/// <summary>
/// Is Enabled ...
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Seeded from Constants, cannot be removed ...
/// </summary>
public bool IsSystem { get; set; }
}
}