fixed Article not viewable by logged in users without admin permissions

This commit is contained in:
Mia Rose Winter 2024-02-02 16:36:34 +01:00
parent 1720370292
commit a8f8c33793
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E

View file

@ -109,6 +109,11 @@
private Article GetArticleProtected(ClaimsPrincipal principal) {
if (Article is null) throw new ApplicationException("Article not found.");
// The Article is publicly available
if (Article.Status >= ArticleStatus.Published && Article.PublishDate <= DateTimeOffset.UtcNow) {
return Article;
}
// Admins always get access
if (principal.IsInRole("Admin")) {
return Article;