Browse Source

Check and fix TODOs about authorization

pull/73/head
Başak ERDEM 5 years ago
parent
commit
cdd9540811
  1. 2
      apps/angular/src/environments/environment.ts
  2. 2
      services/basket/src/EShopOnAbp.BasketService.Application/BasketProductService.cs
  3. 1
      services/basket/src/EShopOnAbp.BasketService.Domain.Shared/BasketServiceDomainErrorCodes.cs
  4. 3
      services/basket/src/EShopOnAbp.BasketService.Domain.Shared/Localization/BasketService/en.json
  5. 3
      services/basket/src/EShopOnAbp.BasketService.Domain.Shared/Localization/BasketService/tr.json
  6. 9
      services/catalog/src/EShopOnAbp.CatalogService.Application/Products/ProductAppService.cs
  7. 3
      services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs

2
apps/angular/src/environments/environment.ts

@ -13,7 +13,7 @@ export const environment = {
redirectUri: baseUrl,
clientId: 'Web',
//responseType: 'code',
scope: 'offline_access openid profile email phone AccountService IdentityService AdministrationService',
scope: 'offline_access openid profile email phone AccountService IdentityService AdministrationService CatalogService',
//requireHttps: true,
},
apis: {

2
services/basket/src/EShopOnAbp.BasketService.Application/BasketProductService.cs

@ -31,6 +31,6 @@ public class BasketProductService : IBasketProductService, ITransientDependency
private Task<ProductDto> GetProductAsync(Guid productId)
{
return _productAppService.GetAsync(productId) ??
throw new UserFriendlyException("Could not find the product!"); //TODO: Business exception with localization;
throw new UserFriendlyException(BasketServiceDomainErrorCodes.ProductNotFound);
}
}

1
services/basket/src/EShopOnAbp.BasketService.Domain.Shared/BasketServiceDomainErrorCodes.cs

@ -3,5 +3,6 @@
public static class BasketServiceDomainErrorCodes
{
/* You can add your business exception error codes here, as constants */
public const string ProductNotFound = "ProductNotFound";
}
}

3
services/basket/src/EShopOnAbp.BasketService.Domain.Shared/Localization/BasketService/en.json

@ -6,6 +6,7 @@
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.",
"Toolbar:Cart": "My Cart",
"Toolbar:BasketNotLoaded": "Couldn't Load!",
"Toolbar:CartEmpty": "Cart is Empty!"
"Toolbar:CartEmpty": "Cart is Empty!",
"ProductNotFound": "Could not find the product!"
}
}

3
services/basket/src/EShopOnAbp.BasketService.Domain.Shared/Localization/BasketService/tr.json

@ -6,6 +6,7 @@
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz.",
"Toolbar:Cart": "Sepetim",
"Toolbar:BasketNotLoaded": "Sepet Hatası!",
"Toolbar:CartEmpty": "Sepetiniz Boş"
"Toolbar:CartEmpty": "Sepetiniz Boş",
"ProductNotFound": "Bu ürün bulunamadı!"
}
}

9
services/catalog/src/EShopOnAbp.CatalogService.Application/Products/ProductAppService.cs

@ -11,7 +11,7 @@ using Volo.Abp.Domain.Repositories;
namespace EShopOnAbp.CatalogService.Products
{
//[Authorize(CatalogServicePermissions.Products.Default)] //TODO: Temporary removed authorization (I needed to use swagger but the auth didn't work)
[Authorize(CatalogServicePermissions.Products.Default)]
public class ProductAppService : ApplicationService, IProductAppService
{
private readonly ProductManager _productManager;
@ -23,18 +23,17 @@ namespace EShopOnAbp.CatalogService.Products
_productRepository = productRepository;
}
//TODO: Is this method used?
public async Task<PagedResultDto<ProductDto>> GetListPagedAsync(PagedAndSortedResultRequestDto input)
{
var queryable = await _productRepository.GetQueryableAsync();
var products = await AsyncExecuter.ToListAsync(
queryable
.OrderBy(input.Sorting ?? "Name")
.Skip(input.SkipCount)
.Take(input.MaxResultCount)
);
var totalCount = await _productRepository.GetCountAsync();
return new PagedResultDto<ProductDto>(
@ -71,7 +70,7 @@ namespace EShopOnAbp.CatalogService.Products
return ObjectMapper.Map<Product, ProductDto>(product);
}
//[Authorize(CatalogServicePermissions.Products.Update)] //TODO: Temporary removed authorization (I needed to use swagger but the auth didn't work)
[Authorize(CatalogServicePermissions.Products.Update)]
public async Task<ProductDto> UpdateAsync(Guid id, UpdateProductDto input)
{
var product = await _productRepository.GetAsync(id);

3
services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/DbMigrations/IdentityServerDataSeeder.cs

@ -261,7 +261,8 @@ namespace EShopOnAbp.IdentityService.DbMigrations
{
"AccountService",
"IdentityService",
"AdministrationService"
"AdministrationService",
"CatalogService"
}),
grantTypes: new[] {"authorization_code", "LinkLogin", "password"},
secret: "1q2w3e*".Sha256(),

Loading…
Cancel
Save