load the ACL

This commit is contained in:
Paul Schneider 2026-08-30 19:37:55 +01:00
commit 0241dd98f0
Signed by: notazof
GPG key ID: 1DD5D838E5343B06
14 changed files with 438 additions and 174 deletions

View file

@ -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();
}

View file

@ -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; }
}

View file

@ -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; }
}

View file

@ -1,8 +0,0 @@
namespace Yavsc.Abstract.Identity.Security
{
public interface ICircleAuthorization
{
long CircleId { get; set; }
}
}

View file

@ -9,7 +9,7 @@ namespace Yavsc.Abstract.Identity.Security
bool AuthorizeCircle(long circleId);
ICircleAuthorization [] GetACL();
ICollection<CircleAuthorization> ACL { get; } //ICircleAuthorization [] GetACL();
}
}