✨ Magic spell for one time code
🗑️ Drop the usage of casbin ♻️ Refactor the permission service ♻️ Refactor the flow of creating an account 🧱 Email infra structure
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using System.ComponentModel.DataAnnotations.Schema; | ||||
| using System.Text.Json; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Newtonsoft.Json; | ||||
| using NodaTime; | ||||
| @@ -18,18 +19,24 @@ namespace DysonNetwork.Sphere.Permission; | ||||
| /// and when the permission node has a GroupId, the actor will be set to the group, but it won't work on checking | ||||
| /// expect the member of that permission group inherent the permission from the group. | ||||
| [Index(nameof(Key), nameof(Area), nameof(Actor))] | ||||
| public class PermissionNode : ModelBase | ||||
| public class PermissionNode : ModelBase, IDisposable | ||||
| { | ||||
|     public Guid Id { get; set; } = Guid.NewGuid(); | ||||
|     [MaxLength(1024)] public string Actor { get; set; } = null!; | ||||
|     [MaxLength(1024)] public string Area { get; set; } = null!; | ||||
|     [MaxLength(1024)] public string Key { get; set; } = null!; | ||||
|     [Column(TypeName = "jsonb")] public object Value { get; set; } = null!; | ||||
|     [Column(TypeName = "jsonb")] public JsonDocument Value { get; set; } = null!; | ||||
|     public Instant? ExpiredAt { get; set; } = null; | ||||
|     public Instant? AffectedAt { get; set; } = null; | ||||
|      | ||||
|  | ||||
|     public Guid? GroupId { get; set; } = null; | ||||
|     [JsonIgnore] public PermissionNode? Group { get; set; } = null; | ||||
|     [JsonIgnore] public PermissionGroup? Group { get; set; } = null; | ||||
|  | ||||
|     public void Dispose() | ||||
|     { | ||||
|         Value.Dispose(); | ||||
|         GC.SuppressFinalize(this); | ||||
|     } | ||||
| } | ||||
|  | ||||
| public class PermissionGroup : ModelBase | ||||
| @@ -44,10 +51,9 @@ public class PermissionGroup : ModelBase | ||||
| public class PermissionGroupMember : ModelBase | ||||
| { | ||||
|     public Guid GroupId { get; set; } | ||||
|     public long AccountId { get; set; } | ||||
|     public PermissionGroup Group { get; set; } = null!; | ||||
|     public Account.Account Account { get; set; } = null!; | ||||
|      | ||||
|     public Instant? ExpiredAt { get; set; } = null; | ||||
|     public Instant? AffectedAt { get; set; } = null; | ||||
|     [MaxLength(1024)] public string Actor { get; set; } = null!; | ||||
|  | ||||
|     public Instant? ExpiredAt { get; set; } | ||||
|     public Instant? AffectedAt { get; set; } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user