Commit f08cc005 authored by gdlcf88's avatar gdlcf88

Improved get list with hidden items permission check.

parent 3cc79680
......@@ -35,9 +35,9 @@ namespace EasyAbp.EShop.Products.Categories
public override async Task<PagedResultDto<CategoryDto>> GetListAsync(GetCategoryListDto input)
{
// Todo: Check if current user is an admin of the store.
var isCurrentUserStoreAdmin = true;
if (input.ShowHidden && (!isCurrentUserStoreAdmin || !await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.Default)))
var isCurrentUserStoreAdmin = true && await AuthorizationService.IsGrantedAsync(ProductsPermissions.Categories.Default);
if (input.ShowHidden && !isCurrentUserStoreAdmin)
{
throw new NotAllowedToGetCategoryListWithShowHiddenException();
}
......
......@@ -194,9 +194,9 @@ namespace EasyAbp.EShop.Products.Products
await CheckGetListPolicyAsync();
// Todo: Check if current user is an admin of the store.
var isCurrentUserStoreAdmin = true;
var isCurrentUserStoreAdmin = true && await AuthorizationService.IsGrantedAsync(ProductsPermissions.Products.Default);
if (input.ShowHidden && (!isCurrentUserStoreAdmin || !await AuthorizationService.IsGrantedAsync(ProductsPermissions.Products.Default)))
if (input.ShowHidden && !isCurrentUserStoreAdmin)
{
throw new NotAllowedToGetProductListWithShowHiddenException();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment