This commit is contained in:
2026-11-15 17:53:12 +03:30
parent fd78ac884c
commit f24cfb2fc1
13 changed files with 1296 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
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; }
}
}
+45
View File
@@ -0,0 +1,45 @@
using xModels.Base;
using System.ComponentModel.DataAnnotations;
namespace xIdentityModels.Models
{
/// <summary>
/// a Role Definition Model (mirror of ASP.NET IdentityRole + Weight) ...
/// </summary>
public class XRoleDefinition : XBaseIntIDEntity
{
/// <summary>
/// Unique Normalized Role Name, e.g. chief_clerk ...
/// </summary>
[Required]
[StringLength(256)]
public string Name { get; set; }
/// <summary>
/// Persian Display Name, e.g. سر دبیر ...
/// </summary>
[StringLength(255)]
public string DisplayName { get; set; }
/// <summary>
/// Role Weight, same as XUserRole enum (user=0 ... admin=10) ...
/// </summary>
public int Weight { get; set; }
/// <summary>
/// Optional Parent Role for Inheritance ...
/// </summary>
[StringLength(256)]
public string ParentRoleName { get; set; }
/// <summary>
/// Is Enabled ...
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Seeded from Constants, cannot be removed ...
/// </summary>
public bool IsSystem { get; set; }
}
}
+51
View File
@@ -0,0 +1,51 @@
using xModels.Base;
using System.ComponentModel.DataAnnotations;
namespace xIdentityModels.Models
{
/// <summary>
/// a Scope Definition Model (mirror of IdentityServer ApiScope) ...
/// </summary>
public class XScopeDefinition : XBaseIntIDEntity
{
/// <summary>
/// Unique Scope Name, e.g. XAPI.read ...
/// </summary>
[Required]
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// Display Name ...
/// </summary>
[StringLength(255)]
public string DisplayName { get; set; }
/// <summary>
/// Description ...
/// </summary>
[StringLength(1000)]
public string Description { get; set; }
/// <summary>
/// Comma Separated List of User Claims ...
/// </summary>
public string UserClaims { get; set; }
/// <summary>
/// Optional ApiResource Name on IdentityServer ...
/// </summary>
[StringLength(200)]
public string ApiResourceName { get; set; }
/// <summary>
/// Is Enabled ...
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Seeded from Constants, cannot be removed ...
/// </summary>
public bool IsSystem { get; set; }
}
}