From 3ccd3106c14ac735150e65399ccfdda320d62eb5 Mon Sep 17 00:00:00 2001 From: max Date: Wed, 8 Jan 2025 16:30:51 +0100 Subject: [PATCH] [CHANGE] Updated models --- .../Managers/AuthorityRoleManager.cs | 10 +++++++++- .../Models/Authority/AuthorityGroup.cs | 9 +++------ .../Models/Authority/AuthorityRole.cs | 11 +++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/DotBased.AspNet.Authority/Managers/AuthorityRoleManager.cs b/DotBased.AspNet.Authority/Managers/AuthorityRoleManager.cs index 3500cb4..52f09a5 100644 --- a/DotBased.AspNet.Authority/Managers/AuthorityRoleManager.cs +++ b/DotBased.AspNet.Authority/Managers/AuthorityRoleManager.cs @@ -19,8 +19,16 @@ public partial class AuthorityManager return Result.Failed("Not implemented!"); } - public async Task AddUserToRole(AuthorityUser user, AuthorityRole role, CancellationToken? cancellationToken = null) + public async Task AddRoleToUserAsync(AuthorityUser user, AuthorityRole role, CancellationToken? cancellationToken = null) { } + + public async Task RemoveRoleFromUserAsync(AuthorityRole role, AuthorityUser user, CancellationToken? cancellationToken = null) + { + } + + public async Task AddRoleToGroupAsync(AuthorityRole role, AuthorityGroup group, CancellationToken? cancellationToken = null) + { + } } \ No newline at end of file diff --git a/DotBased.AspNet.Authority/Models/Authority/AuthorityGroup.cs b/DotBased.AspNet.Authority/Models/Authority/AuthorityGroup.cs index df010e8..c5474df 100644 --- a/DotBased.AspNet.Authority/Models/Authority/AuthorityGroup.cs +++ b/DotBased.AspNet.Authority/Models/Authority/AuthorityGroup.cs @@ -1,6 +1,6 @@ namespace DotBased.AspNet.Authority.Models.Authority; -public class AuthorityGroup : AuthorityGroup +public class AuthorityGroup { public AuthorityGroup(string name) : this() { @@ -12,11 +12,8 @@ public class AuthorityGroup : AuthorityGroup Id = Guid.NewGuid(); CreatedDate = DateTime.Now; } -} - -public abstract class AuthorityGroup where TKey : IEquatable -{ - public TKey Id { get; set; } + + public Guid Id { get; set; } public string? Name { get; set; } diff --git a/DotBased.AspNet.Authority/Models/Authority/AuthorityRole.cs b/DotBased.AspNet.Authority/Models/Authority/AuthorityRole.cs index 4fc2600..1e22cb5 100644 --- a/DotBased.AspNet.Authority/Models/Authority/AuthorityRole.cs +++ b/DotBased.AspNet.Authority/Models/Authority/AuthorityRole.cs @@ -2,6 +2,17 @@ namespace DotBased.AspNet.Authority.Models.Authority; public abstract class AuthorityRole { + public AuthorityRole(string name) : this() + { + Name = name; + } + + public AuthorityRole() + { + Id = Guid.NewGuid(); + CreatedDate = DateTime.Now; + } + public Guid Id { get; set; } public string? Name { get; set; }