From 9f3f6de0822451099647ea24316e5a6eadade6ff Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Thu, 6 Sep 2018 15:34:24 +0300 Subject: [PATCH] Remove authorization attributes to see the blog read only. --- .../Volo/Blogging/Posts/PostAppService.cs | 6 +++++- .../Volo/Blogging/Tagging/TagAppService.cs | 11 ++++++----- .../src/Volo.Blogging.Web/BloggingWebModule.cs | 11 +++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 569ef328ae..0df97fdd1e 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -12,7 +12,11 @@ using Volo.Blogging.Tagging.Dtos; namespace Volo.Blogging.Posts { - [Authorize(BloggingPermissions.Posts.Default)] + /* TODO: Custom policy with configuration. + * We should create a custom policy to see the blog as read only if the blog is + * configured as 'public' or the current user has the related permission. + */ + //[Authorize(BloggingPermissions.Posts.Default)] public class PostAppService : ApplicationService, IPostAppService { private readonly IPostRepository _postRepository; diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs index 3ead693022..163d2ca250 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs @@ -4,21 +4,22 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Services; -using Volo.Blogging.Posts; using Volo.Blogging.Tagging.Dtos; namespace Volo.Blogging.Tagging { - [Authorize(BloggingPermissions.Tags.Default)] + /* TODO: Custom policy with configuration. + * We should create a custom policy to see the blog as read only if the blog is + * configured as 'public' or the current user has the related permission. + */ + //[Authorize(BloggingPermissions.Tags.Default)] public class TagAppService : ApplicationService, ITagAppService { private readonly ITagRepository _tagRepository; - private readonly IPostTagRepository _postTagRepository; - public TagAppService(ITagRepository tagRepository, IPostTagRepository postTagRepository) + public TagAppService(ITagRepository tagRepository) { _tagRepository = tagRepository; - _postTagRepository = postTagRepository; } public async Task> GetListAsync() diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs index 1945e8159a..44f8b7cd8d 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs @@ -30,18 +30,17 @@ namespace Volo.Blogging public override void ConfigureServices(ServiceConfigurationContext context) { - - context.Services.Configure(options => + Configure(options => { options.MenuContributors.Add(new BloggingMenuContributor()); }); - context.Services.Configure(options => + Configure(options => { options.FileSets.AddEmbedded("Volo.Blogging"); }); - context.Services.Configure(options => + Configure(options => { options.Resources .Get() @@ -50,12 +49,12 @@ namespace Volo.Blogging .AddVirtualJson("/Localization/Resources/Blogging/Web"); }); - context.Services.Configure(options => + Configure(options => { options.AddProfile(validate: true); }); - context.Services.Configure(options => + Configure(options => { //TODO: Make configurable! options.Conventions.AddPageRoute("/Blog/Posts/Index", "blog/{blogShortName}");