diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs index 6e74d4f65b..90412d19f7 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs @@ -65,7 +65,7 @@ namespace Volo.Blogging [Route("{id}")] public async Task Update(Guid id, UpdateBlogDto input) { - throw new NotImplementedException(); + return await _blogAppService.Update(id, input); } [HttpDelete] diff --git a/modules/docs/Volo.Docs.sln b/modules/docs/Volo.Docs.sln index 3fe7cc736f..7e78d7432f 100644 --- a/modules/docs/Volo.Docs.sln +++ b/modules/docs/Volo.Docs.sln @@ -33,15 +33,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin-app", "admin-app", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "public-app", "public-app", "{8B0CDFC9-E313-4323-9390-59CFFAAC60B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.Admin.Application.Contracts", "src\Volo.Docs.Admin.Application.Contracts\Volo.Docs.Admin.Application.Contracts.csproj", "{37D483C8-400B-4127-A6D0-2EE4E80CB696}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.Application.Contracts", "src\Volo.Docs.Admin.Application.Contracts\Volo.Docs.Admin.Application.Contracts.csproj", "{37D483C8-400B-4127-A6D0-2EE4E80CB696}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.Admin.Application", "src\Volo.Docs.Admin.Application\Volo.Docs.Admin.Application.csproj", "{823C51A7-40AB-45D8-8FB8-F212AF7E45F2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.Application", "src\Volo.Docs.Admin.Application\Volo.Docs.Admin.Application.csproj", "{823C51A7-40AB-45D8-8FB8-F212AF7E45F2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.Admin.HttpApi", "src\Volo.Docs.Admin.HttpApi\Volo.Docs.Admin.HttpApi.csproj", "{262F38DB-62AF-427F-96E2-C6385C5AB695}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.HttpApi", "src\Volo.Docs.Admin.HttpApi\Volo.Docs.Admin.HttpApi.csproj", "{262F38DB-62AF-427F-96E2-C6385C5AB695}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.Admin.HttpApi.Client", "src\Volo.Docs.Admin.HttpApi.Client\Volo.Docs.Admin.HttpApi.Client.csproj", "{81EE378A-0DE1-47BA-86D9-08EF6317BB95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.HttpApi.Client", "src\Volo.Docs.Admin.HttpApi.Client\Volo.Docs.Admin.HttpApi.Client.csproj", "{81EE378A-0DE1-47BA-86D9-08EF6317BB95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.Admin.Web", "src\Volo.Docs.Admin.Web\Volo.Docs.Admin.Web.csproj", "{116A6145-9D66-4867-B3EF-A464FAC47946}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.Admin.Web", "src\Volo.Docs.Admin.Web\Volo.Docs.Admin.Web.csproj", "{116A6145-9D66-4867-B3EF-A464FAC47946}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContext.cs b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContext.cs index d983c156f5..78843aed64 100644 --- a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContext.cs +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppDbContext.cs @@ -1,5 +1,8 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Identity.EntityFrameworkCore; +using Volo.Abp.PermissionManagement.EntityFrameworkCore; +using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Docs.EntityFrameworkCore; namespace Volo.DocsTestApp.EntityFrameworkCore @@ -16,6 +19,9 @@ namespace Volo.DocsTestApp.EntityFrameworkCore { base.OnModelCreating(modelBuilder); + modelBuilder.ConfigurePermissionManagement(); + modelBuilder.ConfigureSettingManagement(); + modelBuilder.ConfigureIdentity(); modelBuilder.ConfigureDocs(); } } diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppEntityFrameworkCoreModule.cs b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppEntityFrameworkCoreModule.cs index 96c30adf11..f380f6b9d5 100644 --- a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppEntityFrameworkCoreModule.cs +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/DocsTestAppEntityFrameworkCoreModule.cs @@ -1,11 +1,17 @@ using Volo.Abp.EntityFrameworkCore.SqlServer; +using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Modularity; +using Volo.Abp.PermissionManagement.EntityFrameworkCore; +using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Docs.EntityFrameworkCore; namespace Volo.DocsTestApp.EntityFrameworkCore { [DependsOn( typeof(DocsEntityFrameworkCoreModule), + typeof(AbpIdentityEntityFrameworkCoreModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule))] public class DocsTestAppEntityFrameworkCoreModule : AbpModule { diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.Designer.cs b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.Designer.cs new file mode 100644 index 0000000000..8a4137a48f --- /dev/null +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.Designer.cs @@ -0,0 +1,458 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.DocsTestApp.EntityFrameworkCore; + +namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(DocsTestAppDbContext))] + [Migration("20181225063242_Added_Identity")] + partial class Added_Identity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Regex") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); + + b.Property("ValueType"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("DeleterId"); + + b.Property("DeletionTime"); + + b.Property("Email") + .HasColumnName("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasDefaultValue(false); + + b.Property("LockoutEnd"); + + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .HasColumnName("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("TenantId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196); + + b.Property("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("Name") + .HasMaxLength(128); + + b.Property("TenantId"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Docs.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("DefaultDocumentName") + .IsRequired() + .HasMaxLength(128); + + b.Property("DocumentStoreType"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("Format"); + + b.Property("LatestVersionBranchName") + .HasMaxLength(128); + + b.Property("MainWebsiteUrl"); + + b.Property("MinimumVersion"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("NavigationDocumentName") + .IsRequired() + .HasMaxLength(128); + + b.Property("ShortName") + .IsRequired() + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("DocsProjects"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.cs b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.cs new file mode 100644 index 0000000000..59e3de3d39 --- /dev/null +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/20181225063242_Added_Identity.cs @@ -0,0 +1,313 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations +{ + public partial class Added_Identity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 256, nullable: false), + Required = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + Regex = table.Column(maxLength: 512, nullable: true), + RegexDescription = table.Column(maxLength: 128, nullable: true), + Description = table.Column(maxLength: 256, nullable: true), + ValueType = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoles", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 256, nullable: false), + NormalizedName = table.Column(maxLength: 256, nullable: false), + IsDefault = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + IsPublic = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 2048, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUsers", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: false), + NormalizedUserName = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 64, nullable: true), + Surname = table.Column(maxLength: 64, nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false, defaultValue: false), + PasswordHash = table.Column(maxLength: 256, nullable: true), + SecurityStamp = table.Column(maxLength: 256, nullable: false), + PhoneNumber = table.Column(maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false, defaultValue: false), + AccessFailedCount = table.Column(nullable: false, defaultValue: 0) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoleClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpRoleClaims_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpUserClaims_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserLogins", + columns: table => new + { + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(maxLength: 128, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); + table.ForeignKey( + name: "FK_AbpUserLogins_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserRoles", + columns: table => new + { + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserTokens", + columns: table => new + { + TenantId = table.Column(nullable: true), + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AbpUserTokens_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoleClaims_RoleId", + table: "AbpRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoles_NormalizedName", + table: "AbpRoles", + column: "NormalizedName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserClaims_UserId", + table: "AbpUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserLogins_LoginProvider_ProviderKey", + table: "AbpUserLogins", + columns: new[] { "LoginProvider", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserRoles_RoleId_UserId", + table: "AbpUserRoles", + columns: new[] { "RoleId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_Email", + table: "AbpUsers", + column: "Email"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedEmail", + table: "AbpUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedUserName", + table: "AbpUsers", + column: "NormalizedUserName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_UserName", + table: "AbpUsers", + column: "UserName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpRoleClaims"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpUserClaims"); + + migrationBuilder.DropTable( + name: "AbpUserLogins"); + + migrationBuilder.DropTable( + name: "AbpUserRoles"); + + migrationBuilder.DropTable( + name: "AbpUserTokens"); + + migrationBuilder.DropTable( + name: "AbpRoles"); + + migrationBuilder.DropTable( + name: "AbpUsers"); + } + } +} diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/DocsTestAppDbContextModelSnapshot.cs b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/DocsTestAppDbContextModelSnapshot.cs index a568d3ef13..b1ee9d3e2f 100644 --- a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/DocsTestAppDbContextModelSnapshot.cs +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Migrations/DocsTestAppDbContextModelSnapshot.cs @@ -19,12 +19,357 @@ namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Regex") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); + + b.Property("ValueType"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("CreationTime"); + + b.Property("CreatorId"); + + b.Property("DeleterId"); + + b.Property("DeletionTime"); + + b.Property("Email") + .HasColumnName("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted"); + + b.Property("LastModificationTime"); + + b.Property("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasDefaultValue(false); + + b.Property("LockoutEnd"); + + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .HasColumnName("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("TenantId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196); + + b.Property("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("Name") + .HasMaxLength(128); + + b.Property("TenantId"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + modelBuilder.Entity("Volo.Docs.Projects.Project", b => { b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); b.Property("DefaultDocumentName") .IsRequired() @@ -60,6 +405,51 @@ namespace Volo.DocsTestApp.EntityFrameworkCore.Migrations b.ToTable("DocsProjects"); }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 } } diff --git a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Volo.DocsTestApp.EntityFrameworkCore.csproj b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Volo.DocsTestApp.EntityFrameworkCore.csproj index 1ae23682c5..b458a273e0 100644 --- a/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Volo.DocsTestApp.EntityFrameworkCore.csproj +++ b/modules/docs/app/Volo.DocsTestApp.EntityFrameworkCore/Volo.DocsTestApp.EntityFrameworkCore.csproj @@ -5,7 +5,7 @@ - + @@ -17,6 +17,9 @@ + + + diff --git a/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs b/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs index 00259a0400..a80cc2dfeb 100644 --- a/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs +++ b/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs @@ -5,9 +5,9 @@ namespace Volo.DocsTestApp.Controllers { public class HomeController : AbpController { - public ActionResult Index() + public void Index() { - return Redirect("/Documents/"); + } } } diff --git a/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs b/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs index 4458a443ec..ff5589e192 100644 --- a/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs +++ b/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Localization; @@ -9,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; +using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Modularity; using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; @@ -18,19 +20,28 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theming; using Volo.Abp.Autofac; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Identity; +using Volo.Abp.Identity.Web; using Volo.Abp.Modularity; +using Volo.Abp.Threading; using Volo.Abp.UI; using Volo.Abp.VirtualFileSystem; using Volo.Docs; +using Volo.Docs.Admin; using Volo.DocsTestApp.EntityFrameworkCore; namespace Volo.DocsTestApp { [DependsOn( typeof(DocsWebModule), + typeof(DocsAdminWebModule), typeof(DocsApplicationModule), + typeof(DocsAdminApplicationModule), typeof(DocsTestAppEntityFrameworkCoreModule), typeof(AbpAutofacModule), + typeof(AbpAccountWebModule), + typeof(AbpIdentityWebModule), + typeof(AbpIdentityApplicationModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule) )] public class DocsTestAppModule : AbpModule @@ -62,6 +73,7 @@ namespace Volo.DocsTestApp options.FileSets.ReplaceEmbeddedByPyhsical(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}..{0}..{0}framework{0}src{0}Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic", Path.DirectorySeparatorChar))); options.FileSets.ReplaceEmbeddedByPyhsical(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Volo.Docs.Domain", Path.DirectorySeparatorChar))); options.FileSets.ReplaceEmbeddedByPyhsical(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Volo.Docs.Web", Path.DirectorySeparatorChar))); + options.FileSets.ReplaceEmbeddedByPyhsical(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Volo.Docs.Admin.Web", Path.DirectorySeparatorChar))); }); } @@ -72,7 +84,6 @@ namespace Volo.DocsTestApp options.DocInclusionPredicate((docName, description) => true); }); - var cultures = new List { new CultureInfo("en"), new CultureInfo("tr") }; Configure(options => { @@ -94,7 +105,7 @@ namespace Volo.DocsTestApp app.UseDeveloperExceptionPage(); app.UseVirtualFiles(); - + app.UseSwagger(); app.UseSwaggerUI(options => { @@ -115,6 +126,16 @@ namespace Volo.DocsTestApp name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); + + AsyncHelper.RunSync(async () => + { + await context.ServiceProvider + .GetRequiredService() + .SeedAsync( + "1q2w3E*", + IdentityPermissions.GetAll().Union(DocsAdminPermissions.GetAll()) + ); + }); } } } diff --git a/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml new file mode 100644 index 0000000000..f47edcbd98 --- /dev/null +++ b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml @@ -0,0 +1,4 @@ +@page +@model Volo.DocsTestApp.Pages.IndexModel +

Welcome to the Docs demo application.

+Go to Docs \ No newline at end of file diff --git a/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml.cs b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml.cs new file mode 100644 index 0000000000..c1600215d5 --- /dev/null +++ b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Volo.DocsTestApp.Pages +{ + public class IndexModel : PageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/modules/docs/app/Volo.DocsTestApp/Pages/_ViewImports.cshtml b/modules/docs/app/Volo.DocsTestApp/Pages/_ViewImports.cshtml index 5f6b33c1a3..e4a3ba9471 100644 --- a/modules/docs/app/Volo.DocsTestApp/Pages/_ViewImports.cshtml +++ b/modules/docs/app/Volo.DocsTestApp/Pages/_ViewImports.cshtml @@ -1,4 +1,6 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI @addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap -@addTagHelper *, Volo.Docs.Web \ No newline at end of file +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling +@addTagHelper *, Volo.Docs.Web +@addTagHelper *, Volo.Docs.Admin.Web \ No newline at end of file diff --git a/modules/docs/app/Volo.DocsTestApp/Volo.DocsTestApp.csproj b/modules/docs/app/Volo.DocsTestApp/Volo.DocsTestApp.csproj index 584c380ff3..87d314b454 100644 --- a/modules/docs/app/Volo.DocsTestApp/Volo.DocsTestApp.csproj +++ b/modules/docs/app/Volo.DocsTestApp/Volo.DocsTestApp.csproj @@ -18,10 +18,15 @@ + + + + + diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj index 0835730d57..46a7df4293 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj @@ -9,6 +9,16 @@ + + + + + + + + + + diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminApplicationContractsModule.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminApplicationContractsModule.cs index 547fb6bf71..545fcb25b8 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminApplicationContractsModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminApplicationContractsModule.cs @@ -1,5 +1,9 @@ using Volo.Abp.Application; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; +using Volo.Docs.Localization; namespace Volo.Docs.Admin { @@ -9,6 +13,24 @@ namespace Volo.Docs.Admin )] public class DocsAdminApplicationContractsModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.DefinitionProviders.Add(); + }); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts"); + }); + } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs new file mode 100644 index 0000000000..9ad0411d15 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs @@ -0,0 +1,24 @@ +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; +using Volo.Docs.Localization; + +namespace Volo.Docs.Admin +{ + public class DocsAdminPermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + var group = context.AddGroup(DocsAdminPermissions.GroupName, L("Permission:DocumentManagement")); + + var projects = group.AddPermission(DocsAdminPermissions.Projects.Default, L("Permission:Projects")); + projects.AddChild(DocsAdminPermissions.Projects.Update, L("Permission:Edit")); + projects.AddChild(DocsAdminPermissions.Projects.Delete, L("Permission:Delete")); + projects.AddChild(DocsAdminPermissions.Projects.Create, L("Permission:Create")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs new file mode 100644 index 0000000000..7865c14aa3 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Volo.Docs.Admin +{ + public class DocsAdminPermissions + { + public const string GroupName = "Docs.Admin"; + + public static class Projects + { + public const string Default = GroupName + ".Projects"; + public const string Delete = Default + ".Delete"; + public const string Update = Default + ".Update"; + public const string Create = Default + ".Create"; + } + + public static string[] GetAll() + { + return new[] + { + GroupName, + Projects.Default, + Projects.Delete, + Projects.Update, + Projects.Create, + }; + } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json new file mode 100644 index 0000000000..1a6ab2e154 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json @@ -0,0 +1,10 @@ +{ + "culture": "en", + "texts": { + "Permission:DocumentManagement": "Document Management", + "Permission:Projects": "Projects", + "Permission:Edit": "Edit", + "Permission:Delete": "Delete", + "Permission:Create": "Create" + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json new file mode 100644 index 0000000000..0e1601f486 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json @@ -0,0 +1,10 @@ +{ + "culture": "tr", + "texts": { + "Permission:DocumentManagement": "Döküman yönetimi", + "Permission:Projects": "Projeler", + "Permission:Edit": "Düzenle", + "Permission:Delete": "Sil", + "Permission:Create": "Oluştur" + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs index 25e9754140..ec84824d24 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs @@ -1,6 +1,7 @@ using System; 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.Guids; @@ -8,6 +9,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.Admin.Projects { + [Authorize(DocsAdminPermissions.Projects.Default)] public class ProjectAdminAppService : ApplicationService, IProjectAdminAppService { private readonly IProjectRepository _projectRepository; @@ -22,11 +24,11 @@ namespace Volo.Docs.Admin.Projects public async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - var blogs = await _projectRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); + var projects = await _projectRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); var totalCount = await _projectRepository.GetTotalProjectCount(); - var dtos = ObjectMapper.Map, List>(blogs); + var dtos = ObjectMapper.Map, List>(projects); return new PagedResultDto(totalCount, dtos); } @@ -38,6 +40,7 @@ namespace Volo.Docs.Admin.Projects return ObjectMapper.Map(project); } + [Authorize(DocsAdminPermissions.Projects.Create)] public async Task CreateAsync(CreateProjectDto input) { var project = new Project(_guidGenerator.Create(), @@ -64,6 +67,7 @@ namespace Volo.Docs.Admin.Projects return ObjectMapper.Map(project); } + [Authorize(DocsAdminPermissions.Projects.Update)] public async Task UpdateAsync(Guid id, UpdateProjectDto input) { var project = await _projectRepository.GetAsync(id); @@ -87,6 +91,7 @@ namespace Volo.Docs.Admin.Projects return ObjectMapper.Map(project); } + [Authorize(DocsAdminPermissions.Projects.Delete)] public async Task DeleteAsync(Guid id) { await _projectRepository.DeleteAsync(id); diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/Projects/DocsAdminProjectController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/Projects/DocsAdminProjectController.cs deleted file mode 100644 index 58f3f23758..0000000000 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/Projects/DocsAdminProjectController.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.AspNetCore.Mvc; - -namespace Volo.Docs.Admin.Projects -{ - [RemoteService] - [Area("docs")] - [ControllerName("Project")] - [Route("api/docs/admin/projects")] - public class DocsAdminProjectController : AbpController, IProjectAdminAppService - { - protected IProjectAdminAppService ProjectAppService { get; } - - public DocsAdminProjectController(IProjectAdminAppService projectAppService) - { - ProjectAppService = projectAppService; - } - - public Task> GetListAsync(PagedAndSortedResultRequestDto input) - { - return ProjectAppService.GetListAsync(input); - } - - [HttpGet] - [Route("{id}")] - public Task GetAsync(Guid id) - { - return ProjectAppService.GetAsync(id); - } - - public Task CreateAsync(CreateProjectDto input) - { - return ProjectAppService.CreateAsync(input); - } - - public Task UpdateAsync(Guid id, UpdateProjectDto input) - { - return ProjectAppService.UpdateAsync(id, input); - } - - public Task DeleteAsync(Guid id) - { - return ProjectAppService.DeleteAsync(id); - } - } -} diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs new file mode 100644 index 0000000000..ed46afe944 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs @@ -0,0 +1,57 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Docs.Admin.Projects; + +namespace Volo.Docs.Admin +{ + [RemoteService] + [Area("docs")] + [ControllerName("ProjectsAdmin")] + [Route("api/docs/admin/projects")] + public class ProjectsAdminController : AbpController, IProjectAdminAppService + { + private readonly IProjectAdminAppService _projectAppService; + + public ProjectsAdminController(IProjectAdminAppService projectAdminAppService) + { + _projectAppService = projectAdminAppService; + } + + [HttpGet] + [Route("")] + public Task> GetListAsync(PagedAndSortedResultRequestDto input) + { + return _projectAppService.GetListAsync(input); + } + + [HttpGet] + [Route("{id}")] + public Task GetAsync(Guid id) + { + return _projectAppService.GetAsync(id); + } + + [HttpPost] + public Task CreateAsync(CreateProjectDto input) + { + return _projectAppService.CreateAsync(input); + } + + [HttpPut] + [Route("{id}")] + public Task UpdateAsync(Guid id, UpdateProjectDto input) + { + return _projectAppService.UpdateAsync(id, input); + } + + [HttpDelete] + public Task DeleteAsync(Guid id) + { + return _projectAppService.DeleteAsync(id); + } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs index 0b9d5ebd3b..1105fe94aa 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs @@ -1,5 +1,7 @@ using AutoMapper; using Volo.Abp.AutoMapper; +using Volo.Docs.Admin.Pages.Docs.Admin.Projects; +using Volo.Docs.Admin.Projects; namespace Volo.Docs.Admin { @@ -7,7 +9,12 @@ namespace Volo.Docs.Admin { public DocsAdminWebAutoMapperProfile() { + CreateMap().Ignore(x => x.ExtraProperties); + CreateMap().Ignore(x => x.ExtraProperties); + + CreateMap () + .Ignore(x => x.GitHubAccessToken).Ignore(x => x.GitHubRootUrl); } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs index a443865676..d0baaea58f 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs @@ -1,7 +1,11 @@ using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AutoMapper; +using Volo.Abp.Localization; +using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.UI; +using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; using Volo.Docs.Localization; @@ -23,11 +27,26 @@ namespace Volo.Docs.Admin public override void ConfigureServices(ServiceConfigurationContext context) { + + Configure(options => + { + options.MenuContributors.Add(new DocsMenuContributor()); + }); + Configure(options => { options.FileSets.AddEmbedded("Volo.Docs.Admin"); }); + Configure(options => + { + options.Resources + .Get() + .AddBaseTypes(typeof(AbpValidationResource)) + .AddBaseTypes(typeof(AbpUiModule)) + .AddVirtualJson("/Localization/Resources/Docs/Web"); + }); + Configure(options => { options.AddProfile(validate: true); diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsMenuContributor.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsMenuContributor.cs new file mode 100644 index 0000000000..6af722dd96 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsMenuContributor.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; +using Volo.Abp.UI.Navigation; +using Volo.Docs.Localization; + +namespace Volo.Docs.Admin +{ + public class DocsMenuContributor : IMenuContributor + { + public async Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.Main) + { + await ConfigureMainMenu(context); + } + } + + private async Task ConfigureMainMenu(MenuConfigurationContext context) + { + var authorizationService = context.ServiceProvider.GetRequiredService(); + var l = context.ServiceProvider.GetRequiredService>(); + + //if (await authorizationService.IsGrantedAsync(DocsAdminPermissions.GroupName)) + { + var rootMenuItem = new ApplicationMenuItem("DocumentManagement", l["Menu:DocumentManagement"], "/Docs/Admin"); + + if (await authorizationService.IsGrantedAsync(DocsAdminPermissions.Projects.Default)) + { + rootMenuItem.AddItem(new ApplicationMenuItem("ProjectManagement", l["Menu:ProjectManagement"], "/Docs/Admin/Projects")); + } + + context.Menu.AddItem(rootMenuItem); + } + } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/en.json b/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/en.json new file mode 100644 index 0000000000..fb52d8d431 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/en.json @@ -0,0 +1,25 @@ +{ + "culture": "en", + "texts": { + "Menu:DocumentManagement": "Documents", + "Menu:ProjectManagement": "Projects", + "CreateANewProject": "Create new project", + "Edit": "Edit", + "Create": "Create", + "Projects": "Projects", + "Name": "Name", + "ShortName": "ShortName", + "DocumentStoreType": "DocumentStoreType", + "Format": "Format", + "DisplayName:Name": "Name", + "DisplayName:ShortName": "Short name", + "DisplayName:Format": "Format", + "DisplayName:DefaultDocumentName": "Default documentName", + "DisplayName:NavigationDocumentName": "Navigation document name", + "DisplayName:MinimumVersion": "Minimum version", + "DisplayName:MainWebsiteUrl": "Main web site url", + "DisplayName:LatestVersionBranchName": "Latest version branch name", + "DisplayName:GitHubRootUrl": "GitHub root url", + "DisplayName:GitHubAccessToken": "GitHub access token" + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/tr.json b/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/tr.json new file mode 100644 index 0000000000..b12bc7f0b4 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/tr.json @@ -0,0 +1,26 @@ +{ + "culture": "tr", + "texts": { + "Menu:DocumentManagement": "Dökümanlar", + "Menu:ProjectManagement": "Projeler", + "CreateANewProject": "Yeni proje oluştur", + "Edit": "Düzenle", + "Create": "Yeni oluştur", + "Projects": "Projeler", + "Name": "İsim", + "ShortName": "Kısa isim", + "DocumentStoreType": "Döküman saklama tipi", + "Format": "Format", + "Actions": "İşlemler", + "DisplayName:Name": "Adı", + "DisplayName:ShortName": "Kısa adı", + "DisplayName:Format": "Format", + "DisplayName:DefaultDocumentName": "Varsayılan döküman adı", + "DisplayName:NavigationDocumentName": "Navigasyon dökümanı adı", + "DisplayName:MinimumVersion": "Minimum versiyon", + "DisplayName:MainWebsiteUrl": "Ana web site url'i", + "DisplayName:LatestVersionBranchName": "Son versiyon Branch adı", + "DisplayName:GitHubRootUrl": "GitHub kök url'i", + "DisplayName:GitHubAccessToken": "GitHub erişim jetonu" + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPage.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPage.cs new file mode 100644 index 0000000000..7fb608e7f4 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPage.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc.Localization; +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Docs.Localization; + +namespace Volo.Docs.Admin.Pages.Docs.Admin +{ + public abstract class DocsAdminPage : AbpPage + { + [RazorInject] + public IHtmlLocalizer L { get; set; } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml new file mode 100644 index 0000000000..62177fc030 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml @@ -0,0 +1,22 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Docs.Admin.Pages.Docs.Admin.Projects +@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage +@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.CreateModel +@{ + Layout = null; +} + +@if (Model.GithubProject != null) +{ + + + + + + + + + + +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs new file mode 100644 index 0000000000..74ce091141 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.Rendering; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Docs.Admin.Projects; +using Volo.Docs.Projects; + +namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects +{ + public class CreateModel : AbpPageModel + { + [BindProperty] + public CreateGithubProjectViewModel GithubProject { get; set; } + + private readonly IProjectAdminAppService _projectAppService; + + public List FormatTypes { get; set; } + = new List {new SelectListItem("markdown", "md")}; + + public CreateModel(IProjectAdminAppService projectAppService) + { + _projectAppService = projectAppService; + } + + public async Task OnGetAsync(string source) + { + if (source == "GitHub") + { + GithubProject = new CreateGithubProjectViewModel(); + return Page(); + } + else + { + throw new BusinessException("UnknowDocumentSourceExceptionMessage"); + } + } + + public async void OnPostAsync() + { + if (GithubProject != null) + { + var dto = GetGithubProjectAsDto(); + await _projectAppService.CreateAsync(dto); + } + } + + public CreateProjectDto GetGithubProjectAsDto() + { + var dto = ObjectMapper.Map(GithubProject); + + dto.ExtraProperties = new Dictionary + { + {nameof(GithubProject.GitHubRootUrl), GithubProject.GitHubRootUrl}, + {nameof(GithubProject.GitHubAccessToken), GithubProject.GitHubAccessToken} + }; + + return dto; + } + + public abstract class CreateProjectViewModelBase + { + [Required] + [StringLength(ProjectConsts.MaxNameLength)] + public string Name { get; set; } + + [Required] + [StringLength(ProjectConsts.MaxShortNameLength)] + public string ShortName { get; set; } + + [Required] + [SelectItems(nameof(FormatTypes))] + public string Format { get; set; } + + [StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] + public string DefaultDocumentName { get; set; } + + [StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] + public string NavigationDocumentName { get; set; } + + [StringLength(ProjectConsts.MaxVersionNameLength)] + public string MinimumVersion { get; set; } + + public string MainWebsiteUrl { get; set; } + + [StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] + public string LatestVersionBranchName { get; set; } + + [HiddenInput] + public string DocumentStoreType { get; set; } = "GitHub"; + } + + public class CreateGithubProjectViewModel : CreateProjectViewModelBase + { + [DisplayOrder(10001)] + [Required] + [StringLength(256)] + public string GitHubRootUrl { get; set; } + + + [DisplayOrder(10001)] + [StringLength(512)] + public string GitHubAccessToken { get; set; } + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml new file mode 100644 index 0000000000..a8ad2848b1 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml @@ -0,0 +1,22 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Docs.Admin.Pages.Docs.Admin.Projects +@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage +@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.EditModel +@{ + Layout = null; +} + +@if (Model.GithubProject != null) +{ + + + + + + + + + + +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs new file mode 100644 index 0000000000..99a47feffa --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.Rendering; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Docs.Admin.Projects; +using Volo.Docs.Projects; + +namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects +{ + public class EditModel : AbpPageModel + { + [BindProperty] + public EditGithubProjectViewModel GithubProject { get; set; } + + private readonly IProjectAdminAppService _projectAppService; + + public List FormatTypes { get; set; } + = new List { new SelectListItem("markdown", "md") }; + + public EditModel(IProjectAdminAppService projectAppService) + { + _projectAppService = projectAppService; + } + + public async Task OnGetAsync(Guid id) + { + var project = await _projectAppService.GetAsync(id); + + if (project.DocumentStoreType == "GitHub") + { + SetGithubProjectFromDto(project); + return Page(); + } + else + { + throw new BusinessException("UnknowDocumentSourceExceptionMessage"); + } + } + + public async void OnPostAsync() + { + if (GithubProject != null) + { + var dto = GetGithubProjectAsDto(); + await _projectAppService.UpdateAsync(GithubProject.Id, dto); + } + } + + public UpdateProjectDto GetGithubProjectAsDto() + { + var dto = ObjectMapper.Map(GithubProject); + + dto.ExtraProperties = new Dictionary + { + {nameof(GithubProject.GitHubRootUrl), GithubProject.GitHubRootUrl}, + {nameof(GithubProject.GitHubAccessToken), GithubProject.GitHubAccessToken} + }; + + return dto; + } + + public void SetGithubProjectFromDto(ProjectDto dto) + { + GithubProject = ObjectMapper.Map(dto); + + GithubProject.GitHubAccessToken = (string) dto.ExtraProperties[nameof(GithubProject.GitHubAccessToken)]; + GithubProject.GitHubRootUrl = (string) dto.ExtraProperties[nameof(GithubProject.GitHubRootUrl)]; + } + + public abstract class EditProjectViewModelBase + { + [Required] + [HiddenInput] + public Guid Id { get; set; } + + [Required] + [StringLength(ProjectConsts.MaxNameLength)] + public string Name { get; set; } + + [Required] + [SelectItems(nameof(FormatTypes))] + public string Format { get; set; } + + [StringLength(ProjectConsts.MaxDefaultDocumentNameLength)] + public string DefaultDocumentName { get; set; } + + [StringLength(ProjectConsts.MaxNavigationDocumentNameLength)] + public string NavigationDocumentName { get; set; } + + [StringLength(ProjectConsts.MaxVersionNameLength)] + public string MinimumVersion { get; set; } + + public string MainWebsiteUrl { get; set; } + + [StringLength(ProjectConsts.MaxLatestVersionBranchNameLength)] + public string LatestVersionBranchName { get; set; } + } + + public class EditGithubProjectViewModel : EditProjectViewModelBase + { + [DisplayOrder(10001)] + [Required] + [StringLength(256)] + public string GitHubRootUrl { get; set; } + + + [DisplayOrder(10001)] + [StringLength(512)] + public string GitHubAccessToken { get; set; } + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml new file mode 100644 index 0000000000..5b6a0df977 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml @@ -0,0 +1,49 @@ +@page +@using Microsoft.AspNetCore.Authorization +@using Volo.Docs.Admin +@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage +@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.IndexModel +@inject IAuthorizationService Authorization +@{ + ViewBag.PageTitle = "Projects"; +} + +@section scripts { + + + +} + + + + + +

@L["Projects"]

+
+ + @if (await Authorization.IsGrantedAsync(DocsAdminPermissions.Projects.Create)) + { + + + + Github + + + } + +
+
+ + + + + @L["Actions"] + @L["Name"] + @L["ShortName"] + @L["DocumentStoreType"] + @L["Format"] + + + + +
diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs new file mode 100644 index 0000000000..66a7008a1f --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs @@ -0,0 +1,11 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects +{ + public class IndexModel : AbpPageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/create.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/create.js new file mode 100644 index 0000000000..bf06d0750d --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/create.js @@ -0,0 +1,14 @@ +var abp = abp || {}; +$(function () { + abp.modals.projectCreate = function () { + var initModal = function (publicApi, args) { + var $form = publicApi.getForm(); + + + }; + + return { + initModal: initModal + } + }; +}); \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/edit.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/edit.js new file mode 100644 index 0000000000..14987552fb --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/edit.js @@ -0,0 +1,14 @@ +var abp = abp || {}; +$(function () { + abp.modals.projectEdit = function () { + var initModal = function (publicApi, args) { + var $form = publicApi.getForm(); + + + }; + + return { + initModal: initModal + } + }; +}); \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js new file mode 100644 index 0000000000..46962ddb83 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js @@ -0,0 +1,98 @@ +$(function () { + + var l = abp.localization.getResource('Docs'); + + var _createModal = new abp.ModalManager({ + viewUrl: abp.appPath + 'Docs/Admin/Projects/Create', + modalClass: 'projectCreate' + }); + + var _editModal = new abp.ModalManager({ + viewUrl: abp.appPath + 'Docs/Admin/Projects/Edit', + modalClass: 'projectEdit' + }); + + + var _dataTable = $('#ProjectsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + processing: true, + serverSide: true, + paging: true, + searching: false, + autoWidth: false, + scrollCollapse: true, + order: [[2, "desc"]], + ajax: abp.libs.datatables.createAjax(volo.docs.admin.projectsAdmin.getList), + columnDefs: [ + { + rowAction: { + items: + [ + { + text: l('Edit'), + visible: function () { + return true; //TODO: Check permission + }, + action: function (data) { + _editModal.open({ + Id: data.record.id + }); + } + }, + { + text: l('Delete'), + visible: function () { + return true; //TODO: Check permission + }, + confirmMessage: function (data) { return l('ProjectDeletionWarningMessage') }, + action: function (data) { + volo.docs.admin.projectsAdmin + .delete(data.record.id) + .then(function () { + _dataTable.ajax.reload(); + }); + } + } + ] + } + }, + { + target: 1, + data: "name" + }, + { + target: 2, + data: "shortName" + }, + { + target: 3, + data: "documentStoreType" + }, + { + target: 4, + data: "format", + render: function (data) { + if (data === 'md') { + return 'markdown'; + } + + return data; + } + } + ] + })); + + + $("#CreateNewGithubProjectButtonId").click(function (event) { + event.preventDefault(); + _createModal.open({source:"GitHub"}); + }); + + _createModal.onClose(function () { + _dataTable.ajax.reload(); + }); + + _editModal.onResult(function () { + _dataTable.ajax.reload(); + }); + +}); \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj index b5b4569789..912bef3034 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj @@ -33,17 +33,17 @@ - - - - + + + + + - - - - + + + @@ -52,4 +52,10 @@
+ + + Edit.cshtml + + +