Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/5614/head
Ahmet 6 years ago
parent
commit
aee4afdf8b
  1. 2
      docs/en/UI/Angular/Environment.md
  2. 98
      docs/en/UI/Angular/Feature-Libraries.md
  3. 4
      docs/en/docs-nav.json
  4. 2
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/BloggingTestAppDbContext.cs
  5. 5
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/BloggingTestAppEntityFrameworkCoreModule.cs
  6. 1260
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200922115311_Added_BlobStoing.Designer.cs
  7. 73
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200922115311_Added_BlobStoing.cs
  8. 82
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs
  9. 1
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj
  10. 1
      modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj
  11. 7
      modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo/BloggingTestApp/MongoDB/BloggingTestAppMongoDbModule.cs
  12. 11
      modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs
  13. 6
      modules/blogging/app/Volo.BloggingTestApp/Properties/launchSettings.json
  14. 2
      modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj
  15. 1
      modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj
  16. 4
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs
  17. 10
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingFileContainer.cs
  18. 5
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/BlogFileOptions.cs
  19. 49
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs
  20. 6
      modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Ratings/IRatingPublicAppService.cs
  21. 14
      modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Ratings/RatingPublicAppService.cs
  22. 7
      modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Ratings/RatingPublicController.cs
  23. 35
      modules/cms-kit/test/Volo.CmsKit.Application.Tests/Ratings/RatingPublicAppService_Tests.cs
  24. 6
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs
  25. 4
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs
  26. 1
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  27. 6
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor
  28. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
  29. 2
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs
  30. 7
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  31. 2
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
  32. 4
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs
  33. 1
      modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/ExternalLoginProvider_Tests.cs
  34. 2
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj

2
docs/en/UI/Angular/Environment.md

@ -105,4 +105,4 @@ export interface RemoteEnv {
## What's Next?
* [Service Proxies](./Service-Proxies.md)
- [About Feature Libraries](./Feature-Libraries.md)

98
docs/en/UI/Angular/Feature-Libraries.md

@ -0,0 +1,98 @@
# About Feature Libraries
ABP has an ever-growing number of feature modules and [introducing a new one](../../Module-Development-Basics.md) is always possible. When the UI is Angular, these features have modular Angular libraries accompanying them.
## Feature Library Content
Each library has at least two modules:
1. The main module contains all components, services, types, enums, etc. to deliver the required UI when the feature is loaded. From here on, we will refer to these modules as **"feature module"**.
2. There is also a **"config module"** per library which helps us configure applications to run these modules or make them accessible.
## How to Add a Feature Library to Your Project
<!-- TODO: Insert info on CLI `add-module` command here when the schematic is ready. -->
The manual setup of a feature library has three steps:
### 1. Install the Library
Feature libraries are usually published as an npm package. If a library you want to use does not exist in your project, you may install it via the following command:
```shell
yarn add @my-company-name/my-project-name
```
...or...
```shell
npm install @my-company-name/my-project-name
```
The `my-company-name` and `my-project-name` parts are going to change according to the package you want to use. For example, if we want to install the ABP Identity module, the package installation will be as seen below:
```shell
yarn add @abp/ng.identity
```
> Identity is used just as an example. If you have initiated your project with ABP CLI or ABP Suite, the identity library will already be installed and configured in your project.
### 2. Import the Config Module
As of ABP v3.0, every lazy-loaded module has a config module available via a secondary entry point on the same package. Importing them in your root module looks like this:
```js
import { IdentityConfigModule } from "@abp/ng.identity/config";
@NgModule({
imports: [
// other imports
IdentityConfigModule.forRoot(),
],
// providers, declarations, and bootstrap
})
export class AppModule {}
```
We need the config modules for actions required before feature modules are loaded (lazily). For example, the above import configures the menu to display links to identity pages.
Furthermore, depending on the library, the `.forRoot` static method may receive some options that configure how the feature works.
### 3. Import the Feature Module
Finally, the feature module should be [loaded lazily via Angular router](https://angular.io/guide/lazy-loading-ngmodules). If you open the `/src/app/app-routing.module.ts` file, you should see `IdentityModule` is loaded exactly as follows:
```js
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
const routes: Routes = [
// other routes
{
path: "identity",
loadChildren: () =>
import("@abp/ng.identity").then((m) => m.IdentityModule.forLazy()),
},
// other routes
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
```
When you load the identity feature like this, the "Users" page, for example, will have a route path of `/identity/users`. <sup id="a-modify-route">[1](#f-modify-route)</sup>
Depending on the library, the `.forLazy` static method may also receive some options that configure how the feature works.
---
<sup id="f-modify-route"><b>1</b></sup> _Libraries expect to work at a predefined path. Please check [how to patch a navigation element](./Modifying-the-Menu.md#how-to-patch-or-remove-a-navigation-element), if you want to use a different path from the default one (e.g. '/identity')._ <sup>[↩](#a-modify-route)</sup>
---
## What's Next?
- [Service Proxies](./Service-Proxies.md)

4
docs/en/docs-nav.json

@ -442,6 +442,10 @@
"text": "Environment Variables",
"path": "UI/Angular/Environment.md"
},
{
"text": "About Feature Libraries",
"path": "UI/Angular/Feature-Libraries.md"
},
{
"text": "Service Proxies",
"path": "UI/Angular/Service-Proxies.md"

2
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/BloggingTestAppDbContext.cs

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
@ -23,6 +24,7 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore
modelBuilder.ConfigureSettingManagement();
modelBuilder.ConfigureIdentity();
modelBuilder.ConfigureBlogging();
modelBuilder.ConfigureBlobStoring();
}
}
}

5
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/BloggingTestAppEntityFrameworkCoreModule.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Modularity;
@ -13,9 +14,9 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqlServerModule))]
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(BlobStoringDatabaseEntityFrameworkCoreModule))]
public class BloggingTestAppEntityFrameworkCoreModule : AbpModule
{
}
}

1260
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200922115311_Added_BlobStoing.Designer.cs

File diff suppressed because it is too large

73
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20200922115311_Added_BlobStoing.cs

@ -0,0 +1,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
public partial class Added_BlobStoing : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpBlobContainers",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
TenantId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 128, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobContainers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpBlobs",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
ContainerId = table.Column<Guid>(nullable: false),
TenantId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 256, nullable: false),
Content = table.Column<byte[]>(maxLength: 2147483647, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpBlobs", x => x.Id);
table.ForeignKey(
name: "FK_AbpBlobs_AbpBlobContainers_ContainerId",
column: x => x.ContainerId,
principalTable: "AbpBlobContainers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AbpBlobContainers_TenantId_Name",
table: "AbpBlobContainers",
columns: new[] { "TenantId", "Name" });
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_ContainerId",
table: "AbpBlobs",
column: "ContainerId");
migrationBuilder.CreateIndex(
name: "IX_AbpBlobs_TenantId_ContainerId_Name",
table: "AbpBlobs",
columns: new[] { "TenantId", "ContainerId", "Name" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpBlobs");
migrationBuilder.DropTable(
name: "AbpBlobContainers");
}
}
}

82
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs

@ -21,6 +21,79 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
b.Property<Guid>("ContainerId")
.HasColumnType("uniqueidentifier");
b.Property<byte[]>("Content")
.HasColumnType("varbinary(max)")
.HasMaxLength(2147483647);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("ContainerId");
b.HasIndex("TenantId", "ContainerId", "Name");
b.ToTable("AbpBlobs");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("nvarchar(40)")
.HasMaxLength(40);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("TenantId", "Name");
b.ToTable("AbpBlobContainers");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
@ -1046,6 +1119,15 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.ToTable("BlgUsers");
});
modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
{
b.HasOne("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", null)
.WithMany()
.HasForeignKey("ContainerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.HasOne("Volo.Abp.Identity.IdentityRole", null)

1
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj

@ -12,6 +12,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.EntityFrameworkCore\Volo.Abp.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\blob-storing-database\src\Volo.Abp.BlobStoring.Database.EntityFrameworkCore\Volo.Abp.BlobStoring.Database.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>

1
modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj

@ -12,6 +12,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.MongoDB\Volo.Abp.PermissionManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.MongoDB\Volo.Abp.SettingManagement.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.MongoDB\Volo.Abp.Identity.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\blob-storing-database\src\Volo.Abp.BlobStoring.Database.MongoDB\Volo.Abp.BlobStoring.Database.MongoDB.csproj" />
</ItemGroup>
</Project>

7
modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo/BloggingTestApp/MongoDB/BloggingTestAppMongoDbModule.cs

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.BlobStoring.Database.MongoDB;
using Volo.Abp.Identity.MongoDB;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.MongoDB;
@ -13,7 +11,8 @@ namespace Volo.BloggingTestApp.MongoDB
typeof(AbpIdentityMongoDbModule),
typeof(BloggingMongoDbModule),
typeof(AbpSettingManagementMongoDbModule),
typeof(AbpPermissionManagementMongoDbModule)
typeof(AbpPermissionManagementMongoDbModule),
typeof(BlobStoringDatabaseMongoDbModule)
)]
public class BloggingTestAppMongoDbModule : AbpModule
{

11
modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs

@ -23,6 +23,8 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theming;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.Database;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity;
@ -37,7 +39,6 @@ using Volo.Blogging;
using Volo.Blogging.Admin;
using Volo.Blogging.Files;
using Volo.BloggingTestApp.EntityFrameworkCore;
using Volo.BloggingTestApp.MongoDB;
namespace Volo.BloggingTestApp
{
@ -57,6 +58,7 @@ namespace Volo.BloggingTestApp
typeof(AbpIdentityApplicationModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(BlobStoringDatabaseDomainModule),
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
)]
@ -130,9 +132,12 @@ namespace Volo.BloggingTestApp
options.DefaultThemeName = BasicTheme.Name;
});
Configure<BlogFileOptions>(options =>
Configure<AbpBlobStoringOptions>(options =>
{
options.FileUploadLocalFolder = Path.Combine(hostingEnvironment.WebRootPath, "files");
options.Containers.ConfigureDefault(container =>
{
container.UseDatabase();
});
});
}

6
modules/blogging/app/Volo.BloggingTestApp/Properties/launchSettings.json

@ -3,7 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:50013/",
"applicationUrl": "https://localhost:40013/",
"sslPort": 0
}
},
@ -21,7 +21,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:50017/"
"applicationUrl": "https://localhost:40017/"
}
}
}
}

2
modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj

@ -34,7 +34,7 @@
<ProjectReference Include="..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\Volo.BloggingTestApp.MongoDB\Volo.BloggingTestApp.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\blob-storing-database\src\Volo.Abp.BlobStoring.Database.Domain\Volo.Abp.BlobStoring.Database.Domain.csproj" />
</ItemGroup>
</Project>

1
modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj

@ -16,6 +16,7 @@
<ProjectReference Include="..\Volo.Blogging.Domain\Volo.Blogging.Domain.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Caching\Volo.Abp.Caching.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.BlobStoring\Volo.Abp.BlobStoring.csproj" />
</ItemGroup>
</Project>

4
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.BlobStoring;
using Volo.Abp.Caching;
using Volo.Abp.Modularity;
using Volo.Blogging.Comments;
@ -12,7 +13,8 @@ namespace Volo.Blogging
typeof(BloggingDomainModule),
typeof(BloggingApplicationContractsModule),
typeof(AbpCachingModule),
typeof(AbpAutoMapperModule))]
typeof(AbpAutoMapperModule),
typeof(AbpBlobStoringModule))]
public class BloggingApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

10
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingFileContainer.cs

@ -0,0 +1,10 @@
using Volo.Abp.BlobStoring;
namespace Volo.Blogging
{
[BlobContainerName("blogging-files")]
public class BloggingFileContainer
{
}
}

5
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/BlogFileOptions.cs

@ -1,4 +1,6 @@
namespace Volo.Blogging.Files
using System;
namespace Volo.Blogging.Files
{
/* TODO:
* - It is not to have different options for all different modules. We should find a more generic way.
@ -6,6 +8,7 @@
*/
public class BlogFileOptions
{
[Obsolete("Now store using blob storing system, will be deleted in a next version")]
public string FileUploadLocalFolder { get; set; }
}
}

49
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs

@ -2,9 +2,9 @@
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.BlobStoring;
using Volo.Abp.Validation;
using Volo.Blogging.Areas.Blog.Helpers;
@ -12,42 +12,25 @@ namespace Volo.Blogging.Files
{
public class FileAppService : BloggingAppServiceBase, IFileAppService
{
public BlogFileOptions Options { get; }
private readonly ILogger<FileAppService> _logger;
protected IBlobContainer<BloggingFileContainer> BlobContainer { get; }
public FileAppService(IOptions<BlogFileOptions> options, ILogger<FileAppService> logger)
public FileAppService(
IBlobContainer<BloggingFileContainer> blobContainer)
{
_logger = logger;
Options = options.Value;
BlobContainer = blobContainer;
}
public virtual Task<RawFileDto> GetAsync(string name)
public virtual async Task<RawFileDto> GetAsync(string name)
{
Check.NotNullOrWhiteSpace(name, nameof(name));
if (!Directory.Exists(Options.FileUploadLocalFolder))
return new RawFileDto
{
Directory.CreateDirectory(Options.FileUploadLocalFolder);
return Task.FromResult(
new RawFileDto
{
Bytes = new byte[0]
}
);
}
var filePath = Path.Combine(Options.FileUploadLocalFolder, name);
if (File.Exists(filePath))
{
return Task.FromResult(new RawFileDto {Bytes = File.ReadAllBytes(filePath)});
}
_logger.LogError($"Cannot find the file {filePath}");
return Task.FromResult(RawFileDto.EmptyResult());
Bytes = await BlobContainer.GetAllBytesAsync(name)
};
}
public virtual Task<FileUploadOutputDto> CreateAsync(FileUploadInputDto input)
public virtual async Task<FileUploadOutputDto> CreateAsync(FileUploadInputDto input)
{
if (input.Bytes.IsNullOrEmpty())
{
@ -65,20 +48,14 @@ namespace Volo.Blogging.Files
}
var uniqueFileName = GenerateUniqueFileName(Path.GetExtension(input.Name));
var filePath = Path.Combine(Options.FileUploadLocalFolder, uniqueFileName);
if (!Directory.Exists(Options.FileUploadLocalFolder))
{
Directory.CreateDirectory(Options.FileUploadLocalFolder);
}
File.WriteAllBytes(filePath, input.Bytes); //TODO: Previously was using WriteAllBytesAsync, but it's only in .netcore.
await BlobContainer.SaveAsync(uniqueFileName, input.Bytes);
return Task.FromResult(new FileUploadOutputDto
return new FileUploadOutputDto
{
Name = uniqueFileName,
WebUrl = "/api/blogging/files/www/" + uniqueFileName
});
};
}
private static void ThrowValidationException(string message, string memberName)

6
modules/cms-kit/src/Volo.CmsKit.Public.Application.Contracts/Volo/CmsKit/Public/Ratings/IRatingPublicAppService.cs

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Volo.CmsKit.Public.Ratings
@ -11,8 +9,6 @@ namespace Volo.CmsKit.Public.Ratings
Task<RatingDto> CreateAsync(string entityType, string entityId, CreateUpdateRatingInput input);
Task DeleteAsync(string entityType, string entityId);
Task<RatingDto> GetCurrentUserRatingAsync(string entityType, string entityId);
Task<List<RatingWithStarCountDto>> GetGroupedStarCountsAsync(string entityType, string entityId);
}

14
modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Ratings/RatingPublicAppService.cs

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Authorization;
using Volo.Abp.Users;
@ -66,16 +64,6 @@ namespace Volo.CmsKit.Public.Ratings
await RatingRepository.DeleteAsync(rating.Id);
}
[Authorize]
public virtual async Task<RatingDto> GetCurrentUserRatingAsync(string entityType, string entityId)
{
var currentUserId = CurrentUser.GetId();
var rating = await RatingRepository.GetCurrentUserRatingAsync(entityType, entityId, currentUserId);
return ObjectMapper.Map<Rating, RatingDto>(rating);
}
public virtual async Task<List<RatingWithStarCountDto>> GetGroupedStarCountsAsync(string entityType,
string entityId)
{

7
modules/cms-kit/src/Volo.CmsKit.Public.HttpApi/Volo/CmsKit/Public/Ratings/RatingPublicController.cs

@ -34,13 +34,6 @@ namespace Volo.CmsKit.Public.Ratings
return RatingPublicAppService.DeleteAsync(entityType, entityId);
}
[HttpGet]
[Route("{entityType}/{entityId}")]
public virtual Task<RatingDto> GetCurrentUserRatingAsync(string entityType, string entityId)
{
return RatingPublicAppService.GetCurrentUserRatingAsync(entityType, entityId);
}
[HttpGet]
[Route("{entityType}/{entityId}")]
public virtual Task<List<RatingWithStarCountDto>> GetGroupedStarCountsAsync(string entityType, string entityId)

35
modules/cms-kit/test/Volo.CmsKit.Application.Tests/Ratings/RatingPublicAppService_Tests.cs

@ -1,6 +1,5 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Shouldly;
@ -52,16 +51,16 @@ namespace Volo.CmsKit.Ratings
.ShouldBeTrue();
});
}
[Fact]
public async Task CreateAsync_Should_Update_If_Rating_Is_Exist()
{
_currentUser.Id.Returns(_cmsKitTestData.User1Id);
var entity =
await _ratingAppService.GetCurrentUserRatingAsync(_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1);
(await _ratingAppService.GetGroupedStarCountsAsync(_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1)).FirstOrDefault();
var updatedEntity = await _ratingAppService.CreateAsync(
_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1,
@ -69,34 +68,10 @@ namespace Volo.CmsKit.Ratings
{
StarCount = 5
});
entity.Id.ShouldBe(updatedEntity.Id);
entity.EntityId.ShouldBe(updatedEntity.EntityId);
entity.EntityType.ShouldBe(updatedEntity.EntityType);
entity.StarCount.ShouldBe(updatedEntity.StarCount);
}
[Fact]
public async Task GetCurrentUserRatingAsync()
{
_currentUser.Id.Returns(_cmsKitTestData.User1Id);
var rating = await _ratingAppService.GetCurrentUserRatingAsync(
_cmsKitTestData.EntityType1,
_cmsKitTestData.EntityId1
);
UsingDbContext(context =>
{
var ratings = context.Set<Rating>().Where(x =>
x.EntityId == _cmsKitTestData.EntityId1 && x.EntityType == _cmsKitTestData.EntityType1).ToList();
ratings
.Any(c => c.Id == rating.Id && c.EntityId == rating.EntityId && c.EntityType == rating.EntityType)
.ShouldBeTrue();
});
}
[Fact]
public async Task GetGroupedStarCountsAsync()
{

6
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs

@ -26,8 +26,6 @@ namespace Volo.Abp.Identity
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPhoneNumberLength))]
public string PhoneNumber { get; set; }
public bool TwoFactorEnabled { get; set; }
public bool LockoutEnabled { get; set; }
[CanBeNull]
@ -35,7 +33,7 @@ namespace Volo.Abp.Identity
protected IdentityUserCreateOrUpdateDtoBase() : base(false)
{
}
}
}
}

4
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs

@ -23,12 +23,10 @@ namespace Volo.Abp.Identity
public bool PhoneNumberConfirmed { get; set; }
public bool TwoFactorEnabled { get; set; }
public bool LockoutEnabled { get; set; }
public DateTimeOffset? LockoutEnd { get; set; }
public string ConcurrencyStamp { get; set; }
}
}
}

1
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

@ -162,7 +162,6 @@ namespace Volo.Abp.Identity
(await UserManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors();
}
(await UserManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors();
(await UserManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors();
user.Name = input.Name;

6
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor

@ -121,9 +121,6 @@
<Field>
<Check TValue="bool" @bind-checked="@NewEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check>
</Field>
<Field>
<Check TValue="bool" @bind-checked="@NewEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check>
</Field>
</TabPanel>
<TabPanel Name="Roles">
@if (NewUserRoles != null)
@ -197,9 +194,6 @@
<Field>
<Check TValue="bool" @bind-checked="EditingEntity.LockoutEnabled">@L["DisplayName:LockoutEnabled"]</Check>
</Field>
<Field>
<Check TValue="bool" @bind-checked="EditingEntity.TwoFactorEnabled">@L["DisplayName:TwoFactorEnabled"]</Check>
</Field>
</TabPanel>
<TabPanel Name="Roles">
@if (EditUserRoles != null)

5
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml

@ -26,8 +26,7 @@
<abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />
<abp-input asp-for="UserInfo.TwoFactorEnabled" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<CreateModalModel.UserInfoViewModel>())
{
if (propertyInfo.Type.IsEnum)
@ -56,4 +55,4 @@
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</form>
</form>

2
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs

@ -79,8 +79,6 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPhoneNumberLength))]
public string PhoneNumber { get; set; }
public bool TwoFactorEnabled { get; set; } = true;
public bool LockoutEnabled { get; set; } = true;
}

7
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml

@ -28,8 +28,7 @@
<abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />
<abp-input asp-for="UserInfo.TwoFactorEnabled" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.UserInfoViewModel>())
{
if (propertyInfo.Type.IsEnum)
@ -46,7 +45,7 @@
value="@propertyInfo.GetInputValueOrNull(Model.UserInfo.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-tab>
<abp-tab title="@L["Roles"].Value">
@for (var i = 0; i < Model.Roles.Length; i++)
@ -59,4 +58,4 @@
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</form>
</form>

2
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs

@ -87,8 +87,6 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
[DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxPhoneNumberLength))]
public string PhoneNumber { get; set; }
public bool TwoFactorEnabled { get; set; }
public bool LockoutEnabled { get; set; }
}

4
modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs

@ -98,7 +98,6 @@ namespace Volo.Abp.Identity
{
UserName = johnNash.UserName,
LockoutEnabled = true,
TwoFactorEnabled = true,
PhoneNumber = CreateRandomPhoneNumber(),
Password = "123qwe4R*",
Email = CreateRandomEmail(),
@ -135,7 +134,7 @@ namespace Volo.Abp.Identity
{
//Get user
var johnNash = await _userAppService.GetAsync(_testData.UserJohnId);
//Act
var input = new IdentityUserUpdateDto
@ -144,7 +143,6 @@ namespace Volo.Abp.Identity
Surname = "Nash-updated",
UserName = johnNash.UserName,
LockoutEnabled = true,
TwoFactorEnabled = true,
PhoneNumber = CreateRandomPhoneNumber(),
Email = CreateRandomEmail(),
RoleNames = new[] { "admin", "moderator" },

1
modules/identity/test/Volo.Abp.Identity.AspNetCore.Tests/Volo/Abp/Identity/AspNetCore/ExternalLoginProvider_Tests.cs

@ -44,7 +44,6 @@ namespace Volo.Abp.Identity.AspNetCore
user.Name.ShouldBe("Test Name");
user.Surname.ShouldBe("Test Surname");
user.EmailConfirmed.ShouldBeTrue();
user.TwoFactorEnabled.ShouldBeFalse();
user.PhoneNumber.ShouldBe("123");
user.PhoneNumberConfirmed.ShouldBeFalse();
user.IsExternal.ShouldBeTrue();

2
templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\common.props" />

Loading…
Cancel
Save