fixed Article not viewable by logged in users without admin permissions
This commit is contained in:
parent
1720370292
commit
a8f8c33793
|
@ -109,6 +109,11 @@
|
||||||
private Article GetArticleProtected(ClaimsPrincipal principal) {
|
private Article GetArticleProtected(ClaimsPrincipal principal) {
|
||||||
if (Article is null) throw new ApplicationException("Article not found.");
|
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
|
// Admins always get access
|
||||||
if (principal.IsInRole("Admin")) {
|
if (principal.IsInRole("Admin")) {
|
||||||
return Article;
|
return Article;
|
||||||
|
|
Loading…
Reference in a new issue