Revert "feat(blog): add Visibility { Private, Public } to gate post reads"
This reverts commit 33ecfa7ebd.
This commit is contained in:
parent
33ecfa7ebd
commit
42625f5ddd
16 changed files with 46 additions and 5427 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Security.Claims;
|
||||
using Yavsc.Blogspot;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Blog;
|
||||
|
||||
|
|
@ -24,21 +23,10 @@ namespace Yavsc.Server.Helpers
|
|||
dbContext.Circle.Include(c => c.Members)
|
||||
.Where(c => c.Members.Any(m => m.MemberId == readerId))
|
||||
.Select(c => c.Id).ToArray();
|
||||
// Mirror of BlogSpotService.Index for an
|
||||
// authenticated reader: Private restricts to the
|
||||
// author; Public is read-through-ACL.
|
||||
return dbContext.BlogSpot.Include(
|
||||
b => b.Author
|
||||
).Include(p => p.ACL).Where(x => x.Author.Id == posterId &&
|
||||
(
|
||||
(x.Visibility == Visibility.Private && x.AuthorId == readerId)
|
||||
|| (x.Visibility == Visibility.Public
|
||||
&& (x.ACL == null
|
||||
|| x.ACL.Count == 0
|
||||
|| x.AuthorId == readerId
|
||||
|| (readerCirclesMemberships != null
|
||||
&& x.ACL.Any(a => readerCirclesMemberships.Contains(a.CircleId)))))
|
||||
));
|
||||
(x.ACL.Count == 0 || x.ACL.Any(a => readerCirclesMemberships.Contains(a.CircleId))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue