load the ACL
This commit is contained in:
parent
3a1ce55c0f
commit
0241dd98f0
14 changed files with 438 additions and 174 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Yavsc.Abstract.Identity.Security;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Yavsc.Blogspot;
|
||||
|
||||
|
|
@ -35,11 +36,26 @@ public class BlogPostDto : IBlogPost
|
|||
return true;
|
||||
}
|
||||
|
||||
private List<CircleAuthorization> ACL { get; set; } = new List<CircleAuthorization>();
|
||||
public ICollection<CircleAuthorization> ACL = new List<CircleAuthorization>();
|
||||
|
||||
/// <summary>
|
||||
/// Wire-only ACL bridge for System.Text.Json: accepts the
|
||||
/// <c>acl</c>/<c>ACL</c> payload from GET detail responses,
|
||||
/// but is never emitted on POST/PUT from the client.
|
||||
/// </summary>
|
||||
[JsonPropertyName("acl")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public List<CircleAuthorization>? WireAcl
|
||||
{
|
||||
get => null;
|
||||
set => ACL = value ?? new List<CircleAuthorization>();
|
||||
}
|
||||
|
||||
public string[] Tags { get; set; }
|
||||
|
||||
ICollection<CircleAuthorization> ICircleAuthorized.ACL => this.ACL;
|
||||
|
||||
public string[] GetTags() => Tags;
|
||||
|
||||
public ICircleAuthorization[] GetACL() => ACL.ToArray();
|
||||
public CircleAuthorization[] GetACL() => ACL.ToArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ using Yavsc.Abstract.Identity.Security;
|
|||
|
||||
namespace Yavsc.Abstract.BlogSpot;
|
||||
|
||||
public class PostAccessControlRulePayload : ICircleAuthorization
|
||||
public class PostAccessControlRulePayload : CircleAuthorization
|
||||
{
|
||||
public long CircleId { get; set; }
|
||||
public long BlogPostId { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Yavsc.Abstract.Identity.Security;
|
|||
/// UI already has the post, and the circles are looked up by id
|
||||
/// against the list returned by <c>GET /api/circle</c>.</para>
|
||||
/// </summary>
|
||||
public sealed class CircleAuthorization : ICircleAuthorization
|
||||
public class CircleAuthorization
|
||||
{
|
||||
public long CircleId { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
namespace Yavsc.Abstract.Identity.Security
|
||||
{
|
||||
|
||||
public interface ICircleAuthorization
|
||||
{
|
||||
long CircleId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ namespace Yavsc.Abstract.Identity.Security
|
|||
|
||||
bool AuthorizeCircle(long circleId);
|
||||
|
||||
ICircleAuthorization [] GetACL();
|
||||
ICollection<CircleAuthorization> ACL { get; } //ICircleAuthorization [] GetACL();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue