@ -35,6 +35,11 @@ namespace Volo.Blogging.Comments
private async Task<bool> HasDeletePermission(AuthorizationHandlerContext context, Comment resource)
{
if (resource.CreatorId != null && resource.CreatorId == context.User.FindUserId())
return true;
}
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Comments.Delete))
@ -35,6 +35,11 @@ namespace Volo.Blogging.Posts
private async Task<bool> HasDeletePermission(AuthorizationHandlerContext context, Post resource)
if (await _permissionChecker.IsGrantedAsync(context.User, BloggingPermissions.Posts.Delete))
@ -45,7 +45,7 @@ namespace Volo.Blogging
[Route("{id}")]
public Task DeleteAsync(Guid id)
throw new NotImplementedException();
return _commentAppService.DeleteAsync(id);
@ -147,7 +147,7 @@
</a>
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete))
@if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId))
<span class="seperator">|</span>
<a href="#" class="tag deleteLink" data-deleteid="@commentWithRepliesDto.Comment.Id">