Browse Source

Merge pull request #1 from abpframework/master

update
pull/580/head
Nokecy 8 years ago
committed by GitHub
parent
commit
836b7a7d1f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/en/Getting-Started-Console-Application.md
  2. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json
  3. 3
      framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json
  4. 2
      modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs
  5. 694
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108104704_Identity_Changes.Designer.cs
  6. 170
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108104704_Identity_Changes.cs
  7. 73
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/BloggingTestAppDbContextModelSnapshot.cs
  8. 4
      modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj
  9. 6
      modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs
  10. 16
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs
  11. 6
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs
  12. 6
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserDto.cs
  13. 15
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ProfileDto.cs
  14. 22
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/UpdateProfileDto.cs
  15. 4
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
  16. 44
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs
  17. 4
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs
  18. 13
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs
  19. 2
      modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/IdentityUserExtensions.cs
  20. 30
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs
  21. 12
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs
  22. 3
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  23. 7
      modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json
  24. 5
      modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/tr.json
  25. 20
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml
  26. 66
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml.cs
  27. 18
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/personal-settings-modal.js
  28. 2
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
  29. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs
  30. 14
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  31. 6
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
  32. 97
      modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs
  33. 4
      modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs
  34. 8
      modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs
  35. 4
      modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs
  36. 2
      modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs
  37. 6
      modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs
  38. 2
      modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/AbpUsersDbContextModelCreatingExtensions.cs

2
docs/en/Getting-Started-Console-Application.md

@ -66,7 +66,7 @@ namespace AbpConsoleDemo
### Hello World! ### Hello World!
The application above does nothing. Let's create a service does something: The application above does nothing. Let's create a service that does something:
````C# ````C#
using System; using System;

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json

@ -34,6 +34,7 @@
"PagerPrevious": "Previous", "PagerPrevious": "Previous",
"PagerInfo": "Showing {0} to {1} of {2} entries.", "PagerInfo": "Showing {0} to {1} of {2} entries.",
"DatatableActionDropdownDefaultText": "Actions", "DatatableActionDropdownDefaultText": "Actions",
"ChangePassword": "Change password" "ChangePassword": "Change password",
"PersonalInfo": "Personal info"
} }
} }

3
framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json

@ -34,6 +34,7 @@
"PagerPrevious": "Önceki", "PagerPrevious": "Önceki",
"PagerInfo": "{2} kayıttan {0} ile {1} arası gösteriliyor.", "PagerInfo": "{2} kayıttan {0} ile {1} arası gösteriliyor.",
"DatatableActionDropdownDefaultText": "İşlemler", "DatatableActionDropdownDefaultText": "İşlemler",
"ChangePassword": "Şifre değiştir" "ChangePassword": "Şifre değiştir",
"PersonalInfo": "Kişisel Bilgiler"
} }
} }

2
modules/account/src/Volo.Abp.Account.Web/AbpAccountUserMenuContributor.cs

@ -24,6 +24,8 @@ namespace Volo.Abp.Account.Web
context.Menu.AddItem(new ApplicationMenuItem("Account.ChangePassword", l["ChangePassword"], icon: "fa fa-key", url: "#", elementId: "abp-account-change-password")); context.Menu.AddItem(new ApplicationMenuItem("Account.ChangePassword", l["ChangePassword"], icon: "fa fa-key", url: "#", elementId: "abp-account-change-password"));
context.Menu.AddItem(new ApplicationMenuItem("Account.PersonalSettings", l["PersonalInfo"], icon: "fa fa-info", url: "#", elementId: "abp-account-personal-settings"));
context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000));
return Task.CompletedTask; return Task.CompletedTask;

694
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108104704_Identity_Changes.Designer.cs

@ -0,0 +1,694 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.BloggingTestApp.EntityFrameworkCore;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
[DbContext(typeof(BloggingTestAppDbContext))]
[Migration("20181108104704_Identity_Changes")]
partial class Identity_Changes
{
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<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<bool>("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.IsRequired()
.HasMaxLength(256);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("NormalizedName");
b.ToTable("AbpRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AbpRoleClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount")
.ValueGeneratedOnAdd()
.HasColumnName("AccessFailedCount")
.HasDefaultValue(0);
b.Property<string>("ConcurrencyStamp")
.IsRequired()
.HasColumnName("ConcurrencyStamp")
.HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled")
.HasDefaultValue(false);
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.IsRequired()
.HasColumnName("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnName("PasswordHash")
.HasMaxLength(256);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("SecurityStamp")
.IsRequired()
.HasColumnName("SecurityStamp")
.HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<bool>("TwoFactorEnabled")
.ValueGeneratedOnAdd()
.HasColumnName("TwoFactorEnabled")
.HasDefaultValue(false);
b.Property<string>("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<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ClaimType")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("ClaimValue")
.HasMaxLength(1024);
b.Property<Guid?>("TenantId");
b.Property<Guid>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AbpUserClaims");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("ProviderDisplayName")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(196);
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "LoginProvider");
b.HasIndex("LoginProvider", "ProviderKey");
b.ToTable("AbpUserLogins");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
{
b.Property<Guid>("UserId");
b.Property<Guid>("RoleId");
b.Property<Guid?>("TenantId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId", "UserId");
b.ToTable("AbpUserRoles");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
{
b.Property<Guid>("UserId");
b.Property<string>("LoginProvider")
.HasMaxLength(64);
b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AbpUserTokens");
});
modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(64);
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(64);
b.Property<Guid?>("TenantId");
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpPermissionGrants");
});
modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasMaxLength(64);
b.Property<string>("ProviderName")
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2048);
b.HasKey("Id");
b.HasIndex("Name", "ProviderName", "ProviderKey");
b.ToTable("AbpSettings");
});
modelBuilder.Entity("Volo.Blogging.Blogs.Blog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(1024);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(256);
b.Property<string>("ShortName")
.IsRequired()
.HasColumnName("ShortName")
.HasMaxLength(32);
b.HasKey("Id");
b.ToTable("BlgBlogs");
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid?>("RepliedCommentId")
.HasColumnName("RepliedCommentId");
b.Property<string>("Text")
.IsRequired()
.HasColumnName("Text")
.HasMaxLength(1024);
b.HasKey("Id");
b.HasIndex("PostId");
b.HasIndex("RepliedCommentId");
b.ToTable("BlgComments");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<Guid>("BlogId")
.HasColumnName("BlogId");
b.Property<string>("Content")
.HasColumnName("Content")
.HasMaxLength(1048576);
b.Property<string>("CoverImage")
.IsRequired()
.HasColumnName("CoverImage");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<int>("ReadCount");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasMaxLength(512);
b.Property<string>("Url")
.IsRequired()
.HasColumnName("Url")
.HasMaxLength(64);
b.HasKey("Id");
b.HasIndex("BlogId");
b.ToTable("BlgPosts");
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.Property<Guid>("PostId")
.HasColumnName("PostId");
b.Property<Guid>("TagId")
.HasColumnName("TagId");
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.HasKey("PostId", "TagId");
b.HasIndex("TagId");
b.ToTable("BlgPostTags");
});
modelBuilder.Entity("Volo.Blogging.Tagging.Tag", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnName("Description")
.HasMaxLength(512);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<int>("UsageCount")
.HasColumnName("UsageCount");
b.HasKey("Id");
b.ToTable("BlgTags");
});
modelBuilder.Entity("Volo.Blogging.Users.BlogUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Email")
.HasColumnName("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("EmailConfirmed")
.HasDefaultValue(false);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber")
.HasMaxLength(16);
b.Property<bool>("PhoneNumberConfirmed")
.ValueGeneratedOnAdd()
.HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("UserName")
.IsRequired()
.HasColumnName("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("BlgUsers");
});
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);
});
modelBuilder.Entity("Volo.Blogging.Comments.Comment", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany()
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Comments.Comment")
.WithMany()
.HasForeignKey("RepliedCommentId");
});
modelBuilder.Entity("Volo.Blogging.Posts.Post", b =>
{
b.HasOne("Volo.Blogging.Blogs.Blog")
.WithMany()
.HasForeignKey("BlogId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Volo.Blogging.Posts.PostTag", b =>
{
b.HasOne("Volo.Blogging.Posts.Post")
.WithMany("Tags")
.HasForeignKey("PostId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Volo.Blogging.Tagging.Tag")
.WithMany()
.HasForeignKey("TagId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}

170
modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Migrations/20181108104704_Identity_Changes.cs

@ -0,0 +1,170 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
{
public partial class Identity_Changes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "BlgUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Surname",
table: "BlgUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "AbpUsers",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatorId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "AbpUsers",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastModificationTime",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "LastModifierId",
table: "AbpUsers",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "AbpUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Surname",
table: "AbpUsers",
maxLength: 64,
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDefault",
table: "AbpRoles",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsPublic",
table: "AbpRoles",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsStatic",
table: "AbpRoles",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "AbpClaimTypes",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: false),
Required = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
Regex = table.Column<string>(maxLength: 512, nullable: true),
RegexDescription = table.Column<string>(maxLength: 128, nullable: true),
Description = table.Column<string>(maxLength: 256, nullable: true),
ValueType = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpClaimTypes", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpClaimTypes");
migrationBuilder.DropColumn(
name: "Name",
table: "BlgUsers");
migrationBuilder.DropColumn(
name: "Surname",
table: "BlgUsers");
migrationBuilder.DropColumn(
name: "CreationTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "CreatorId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "LastModificationTime",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "LastModifierId",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "Name",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "Surname",
table: "AbpUsers");
migrationBuilder.DropColumn(
name: "IsDefault",
table: "AbpRoles");
migrationBuilder.DropColumn(
name: "IsPublic",
table: "AbpRoles");
migrationBuilder.DropColumn(
name: "IsStatic",
table: "AbpRoles");
}
}
}

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

@ -19,6 +19,35 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Description")
.HasMaxLength(256);
b.Property<bool>("IsStatic");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256);
b.Property<string>("Regex")
.HasMaxLength(512);
b.Property<string>("RegexDescription")
.HasMaxLength(128);
b.Property<bool>("Required");
b.Property<int>("ValueType");
b.HasKey("Id");
b.ToTable("AbpClaimTypes");
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -26,6 +55,15 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<string>("ConcurrencyStamp"); b.Property<string>("ConcurrencyStamp");
b.Property<bool>("IsDefault")
.HasColumnName("IsDefault");
b.Property<bool>("IsPublic")
.HasColumnName("IsPublic");
b.Property<bool>("IsStatic")
.HasColumnName("IsStatic");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasMaxLength(256); .HasMaxLength(256);
@ -81,6 +119,14 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasColumnName("ConcurrencyStamp") .HasColumnName("ConcurrencyStamp")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<DateTime>("CreationTime");
b.Property<Guid?>("CreatorId");
b.Property<Guid?>("DeleterId");
b.Property<DateTime?>("DeletionTime");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnName("Email") .HasColumnName("Email")
.HasMaxLength(256); .HasMaxLength(256);
@ -93,6 +139,12 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("LastModificationTime");
b.Property<Guid?>("LastModifierId");
b.Property<bool>("LockoutEnabled") b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnName("LockoutEnabled") .HasColumnName("LockoutEnabled")
@ -100,6 +152,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<DateTimeOffset?>("LockoutEnd"); b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnName("NormalizedEmail") .HasColumnName("NormalizedEmail")
.HasMaxLength(256); .HasMaxLength(256);
@ -127,6 +183,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasColumnName("SecurityStamp") .HasColumnName("SecurityStamp")
.HasMaxLength(256); .HasMaxLength(256);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnName("TenantId"); .HasColumnName("TenantId");
@ -219,9 +279,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<Guid>("UserId"); b.Property<Guid>("UserId");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasMaxLength(128); .HasMaxLength(64);
b.Property<string>("Name"); b.Property<string>("Name")
.HasMaxLength(128);
b.Property<Guid?>("TenantId"); b.Property<Guid?>("TenantId");
@ -518,6 +579,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
b.Property<string>("Name")
.HasColumnName("Name")
.HasMaxLength(64);
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.HasColumnName("PhoneNumber") .HasColumnName("PhoneNumber")
.HasMaxLength(16); .HasMaxLength(16);
@ -527,6 +592,10 @@ namespace Volo.BloggingTestApp.EntityFrameworkCore.Migrations
.HasColumnName("PhoneNumberConfirmed") .HasColumnName("PhoneNumberConfirmed")
.HasDefaultValue(false); .HasDefaultValue(false);
b.Property<string>("Surname")
.HasColumnName("Surname")
.HasMaxLength(64);
b.Property<Guid?>("TenantId") b.Property<Guid?>("TenantId")
.HasColumnName("TenantId"); .HasColumnName("TenantId");

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

@ -4,6 +4,10 @@
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20181108103917_Identity_Changes.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.0" />

6
modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users/BlogUser.cs

@ -14,6 +14,10 @@ namespace Volo.Blogging.Users
public virtual string Email { get; protected set; } public virtual string Email { get; protected set; }
public virtual string Name { get; set; }
public virtual string Surname { get; set; }
public virtual bool EmailConfirmed { get; protected set; } public virtual bool EmailConfirmed { get; protected set; }
public virtual string PhoneNumber { get; protected set; } public virtual string PhoneNumber { get; protected set; }
@ -31,6 +35,8 @@ namespace Volo.Blogging.Users
{ {
Id = user.Id; Id = user.Id;
Email = user.Email; Email = user.Email;
Name = user.Name;
Surname = user.Surname;
EmailConfirmed = user.EmailConfirmed; EmailConfirmed = user.EmailConfirmed;
PhoneNumber = user.PhoneNumber; PhoneNumber = user.PhoneNumber;
PhoneNumberConfirmed = user.PhoneNumberConfirmed; PhoneNumberConfirmed = user.PhoneNumberConfirmed;

16
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Services;
namespace Volo.Abp.Identity
{
public interface IProfileAppService : IApplicationService
{
Task<ProfileDto> GetAsync();
Task<ProfileDto> UpdateAsync(UpdateProfileDto input);
}
}

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

@ -9,6 +9,12 @@ namespace Volo.Abp.Identity
[StringLength(IdentityUserConsts.MaxUserNameLength)] [StringLength(IdentityUserConsts.MaxUserNameLength)]
public string UserName { get; set; } public string UserName { get; set; }
[StringLength(IdentityUserConsts.MaxNameLength)]
public string Name { get; set; }
[StringLength(IdentityUserConsts.MaxSurnameLength)]
public string Surname { get; set; }
[Required] [Required]
[EmailAddress] [EmailAddress]
[StringLength(IdentityUserConsts.MaxEmailLength)] [StringLength(IdentityUserConsts.MaxEmailLength)]

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

@ -4,12 +4,16 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Identity namespace Volo.Abp.Identity
{ {
public class IdentityUserDto : EntityDto<Guid>, IMultiTenant public class IdentityUserDto : FullAuditedEntityDto<Guid>, IMultiTenant
{ {
public Guid? TenantId { get; set; } public Guid? TenantId { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Email { get; set; } public string Email { get; set; }
public bool EmailConfirmed { get; set; } public bool EmailConfirmed { get; set; }

15
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ProfileDto.cs

@ -0,0 +1,15 @@
namespace Volo.Abp.Identity
{
public class ProfileDto
{
public string UserName { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string PhoneNumber { get; set; }
}
}

22
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/UpdateProfileDto.cs

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace Volo.Abp.Identity
{
public class UpdateProfileDto
{
[StringLength(IdentityUserConsts.MaxUserNameLength)]
public string UserName { get; set; }
[StringLength(IdentityUserConsts.MaxEmailLength)]
public string Email { get; set; }
[StringLength(IdentityUserConsts.MaxNameLength)]
public string Name { get; set; }
[StringLength(IdentityUserConsts.MaxSurnameLength)]
public string Surname { get; set; }
[StringLength(IdentityUserConsts.MaxPhoneNumberLength)]
public string PhoneNumber { get; set; }
}
}

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

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Security.Authentication;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
@ -149,6 +150,9 @@ namespace Volo.Abp.Identity
(await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors(); (await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors();
(await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors(); (await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors();
user.Name = input.Name;
user.Surname = input.Surname;
if (input.RoleNames != null) if (input.RoleNames != null)
{ {
(await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors(); (await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors();

44
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Volo.Abp.Users;
namespace Volo.Abp.Identity
{
[Authorize]
public class ProfileAppService : IdentityAppServiceBase, IProfileAppService
{
private readonly IdentityUserManager _userManager;
public ProfileAppService(IdentityUserManager userManager)
{
_userManager = userManager;
}
public async Task<ProfileDto> GetAsync()
{
return ObjectMapper.Map<IdentityUser, ProfileDto>(
await _userManager.GetByIdAsync(CurrentUser.GetId())
);
}
public async Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
{
var user = await _userManager.GetByIdAsync(CurrentUser.GetId());
(await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors();
(await _userManager.SetEmailAsync(user, input.Email)).CheckErrors();
(await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors();
user.Name = input.Name;
user.Surname = input.Surname;
(await _userManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<IdentityUser, ProfileDto>(user);
}
}
}

4
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs

@ -6,6 +6,10 @@ namespace Volo.Abp.Identity
{ {
public const int MaxUserNameLength = AbpUserConsts.MaxUserNameLength; public const int MaxUserNameLength = AbpUserConsts.MaxUserNameLength;
public const int MaxNameLength = AbpUserConsts.MaxNameLength;
public const int MaxSurnameLength = AbpUserConsts.MaxSurnameLength;
public const int MaxNormalizedUserNameLength = MaxUserNameLength; public const int MaxNormalizedUserNameLength = MaxUserNameLength;
public const int MaxEmailLength = AbpUserConsts.MaxEmailLength; public const int MaxEmailLength = AbpUserConsts.MaxEmailLength;

13
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs

@ -8,12 +8,13 @@ using Microsoft.AspNetCore.Identity;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Volo.Abp.Users; using Volo.Abp.Users;
namespace Volo.Abp.Identity namespace Volo.Abp.Identity
{ {
public class IdentityUser : AggregateRoot<Guid>, IHasConcurrencyStamp, IUser, IHasExtraProperties public class IdentityUser : FullAuditedAggregateRoot<Guid>, IHasConcurrencyStamp, IUser, IHasExtraProperties
{ {
public virtual Guid? TenantId { get; protected set; } public virtual Guid? TenantId { get; protected set; }
@ -28,6 +29,16 @@ namespace Volo.Abp.Identity
[DisableAuditing] [DisableAuditing]
public virtual string NormalizedUserName { get; protected internal set; } public virtual string NormalizedUserName { get; protected internal set; }
/// <summary>
/// Gets or sets the Name for the user.
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// Gets or sets the Surame for the user.
/// </summary>
public virtual string Surname { get; set; }
/// <summary> /// <summary>
/// Gets or sets the email address for this user. /// Gets or sets the email address for this user.
/// </summary> /// </summary>

2
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/IdentityUserExtensions.cs

@ -10,6 +10,8 @@ namespace Volo.Abp.Identity
user.Id, user.Id,
user.UserName, user.UserName,
user.Email, user.Email,
user.Name,
user.Surname,
user.EmailConfirmed, user.EmailConfirmed,
user.PhoneNumber, user.PhoneNumber,
user.PhoneNumberConfirmed, user.PhoneNumberConfirmed,

30
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.Identity
{
[RemoteService]
[Area("identity")]
[ControllerName("Profile")]
public class ProfileController : IProfileAppService
{
private readonly IProfileAppService _profileAppService;
public ProfileController(IProfileAppService profileAppService)
{
_profileAppService = profileAppService;
}
public Task<ProfileDto> GetAsync()
{
return _profileAppService.GetAsync();
}
public Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
{
return _profileAppService.UpdateAsync(input);
}
}
}

12
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs

@ -1,5 +1,6 @@
using AutoMapper; using AutoMapper;
using Volo.Abp.Identity.Web.Pages.Identity.Roles; using Volo.Abp.Identity.Web.Pages.Identity.Roles;
using Volo.Abp.Identity.Web.Pages.Identity.Shared;
using CreateUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel; using CreateUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel;
using EditUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel; using EditUserModalModel = Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel;
@ -11,6 +12,7 @@ namespace Volo.Abp.Identity.Web
{ {
CreateUserMappings(); CreateUserMappings();
CreateRoleMappings(); CreateRoleMappings();
CreateProfileMappings();
} }
private void CreateUserMappings() private void CreateUserMappings()
@ -31,6 +33,10 @@ namespace Volo.Abp.Identity.Web
CreateMap<IdentityRoleDto, EditUserModalModel.AssignedRoleViewModel>() CreateMap<IdentityRoleDto, EditUserModalModel.AssignedRoleViewModel>()
.ForMember(dest => dest.IsAssigned, opt => opt.Ignore()); .ForMember(dest => dest.IsAssigned, opt => opt.Ignore());
CreateMap<ProfileDto, PersonalSettingsInfoModel>();
CreateMap<PersonalSettingsInfoModel, UpdateProfileDto>();
} }
private void CreateRoleMappings() private void CreateRoleMappings()
@ -44,5 +50,11 @@ namespace Volo.Abp.Identity.Web
//EditModal //EditModal
CreateMap<EditModalModel.RoleInfoModel, IdentityRoleUpdateDto>(); CreateMap<EditModalModel.RoleInfoModel, IdentityRoleUpdateDto>();
} }
private void CreateProfileMappings()
{
CreateMap<ProfileDto, PersonalSettingsInfoModel>();
CreateMap<PersonalSettingsInfoModel, UpdateProfileDto>();
}
} }
} }

3
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs

@ -75,7 +75,8 @@ namespace Volo.Abp.Identity.Web
options options
.ScriptBundles .ScriptBundles
.Get(StandardBundles.Scripts.Global) .Get(StandardBundles.Scripts.Global)
.AddFiles("/Pages/Identity/Shared/change-password-modal.js"); .AddFiles("/Pages/Identity/Shared/change-password-modal.js")
.AddFiles("/Pages/Identity/Shared/personal-settings-modal.js");
}); });
} }
} }

7
modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json

@ -13,10 +13,14 @@
"DisplayName:IsPublic": "Public", "DisplayName:IsPublic": "Public",
"Roles": "Roles", "Roles": "Roles",
"Password": "Password", "Password": "Password",
"PersonalInfo": "Personal Info",
"PersonalSettings": "Personal settings",
"UserDeletionConfirmationMessage": "User '{0}' will be deleted. Do you confirm that?", "UserDeletionConfirmationMessage": "User '{0}' will be deleted. Do you confirm that?",
"RoleDeletionConfirmationMessage": "Role '{0}' will be deleted. Do you confirm that?", "RoleDeletionConfirmationMessage": "Role '{0}' will be deleted. Do you confirm that?",
"DisplayName:RoleName": "Role name", "DisplayName:RoleName": "Role name",
"DisplayName:UserName": "User name", "DisplayName:UserName": "User name",
"DisplayName:Name": "Name",
"DisplayName:Surname": "Surname",
"DisplayName:Password": "Password", "DisplayName:Password": "Password",
"DisplayName:EmailAddress": "Email address", "DisplayName:EmailAddress": "Email address",
"DisplayName:PhoneNumber": "Phone number", "DisplayName:PhoneNumber": "Phone number",
@ -29,6 +33,7 @@
"DisplayName:CurrentPassword": "Current password", "DisplayName:CurrentPassword": "Current password",
"DisplayName:NewPassword": "New password", "DisplayName:NewPassword": "New password",
"DisplayName:NewPasswordConfirm": "Confirm new password", "DisplayName:NewPasswordConfirm": "Confirm new password",
"PasswordChangedMessage": "Your password has been changed successfully." "PasswordChangedMessage": "Your password has been changed successfully.",
"PersonalSettingsSavedMessage": "Your personal settings has been saved successfully."
} }
} }

5
modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/tr.json

@ -13,10 +13,14 @@
"UserInformations": "Kullanıcı bilgileri", "UserInformations": "Kullanıcı bilgileri",
"Roles": "Roller", "Roles": "Roller",
"Password": "Şifre", "Password": "Şifre",
"PersonalInfo": "Kişisel bilgi",
"PersonalSettings": "Kişisel Ayarlar",
"UserDeletionConfirmationMessage": "{0} kullanıcısı silinecektir. Onaylıyor musunuz?", "UserDeletionConfirmationMessage": "{0} kullanıcısı silinecektir. Onaylıyor musunuz?",
"RoleDeletionConfirmationMessage": "'{0}' rolü silinecektir. Onaylıyor musunuz?", "RoleDeletionConfirmationMessage": "'{0}' rolü silinecektir. Onaylıyor musunuz?",
"DisplayName:RoleName": "Rol adı", "DisplayName:RoleName": "Rol adı",
"DisplayName:UserName": "Kullanıcı adı", "DisplayName:UserName": "Kullanıcı adı",
"DisplayName:Name": "Adı",
"DisplayName:Surname": "Soyadı",
"DisplayName:Password": "Şifre", "DisplayName:Password": "Şifre",
"DisplayName:EmailAddress": "E-posta adresi", "DisplayName:EmailAddress": "E-posta adresi",
"DisplayName:PhoneNumber": "Telefon numarası", "DisplayName:PhoneNumber": "Telefon numarası",
@ -30,6 +34,7 @@
"DisplayName:NewPassword": "Yeni şifre", "DisplayName:NewPassword": "Yeni şifre",
"DisplayName:NewPasswordConfirm": "Yeni şifre (tekrar)", "DisplayName:NewPasswordConfirm": "Yeni şifre (tekrar)",
"PasswordChangedMessage": "Şifreniz başarıyla değiştirildi.", "PasswordChangedMessage": "Şifreniz başarıyla değiştirildi.",
"PersonalSettingsSavedMessage": "Kişisel bilgileriniz başarıyla kaydedildi.",
"Identity.StaticRoleRenamingErrorMessage": "Bir Sabit rolün ismi değiştirilemez.", "Identity.StaticRoleRenamingErrorMessage": "Bir Sabit rolün ismi değiştirilemez.",
"Identity.StaticRoleDeletionErrorMessage": "Bir Sabit rol silinemez." "Identity.StaticRoleDeletionErrorMessage": "Bir Sabit rol silinemez."
} }

20
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml

@ -0,0 +1,20 @@
@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Identity.Localization
@using Volo.Abp.Identity.Web.Pages.Identity.Shared
@model PersonalSettingsModal
@inject IHtmlLocalizer<IdentityResource> L
@{
Layout = null;
}
<abp-dynamic-form abp-model="@Model.PersonalSettingsInfoModel" asp-page="/Identity/Shared/PersonalSettingsModal">
<abp-modal>
<abp-modal-header title="@L["PersonalSettings"].Value"></abp-modal-header>
<abp-modal-body>
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

66
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/PersonalSettingsModal.cshtml.cs

@ -0,0 +1,66 @@
using System.ComponentModel.DataAnnotations;
using System.Security.Authentication;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Abp.Identity.Localization;
namespace Volo.Abp.Identity.Web.Pages.Identity.Shared
{
public class PersonalSettingsModal : AbpPageModel
{
[BindProperty]
public PersonalSettingsInfoModel PersonalSettingsInfoModel { get; set; }
private readonly IProfileAppService _profileAppService;
public PersonalSettingsModal(IProfileAppService profileAppService)
{
_profileAppService = profileAppService;
}
public async Task OnGetAsync()
{
var user = await _profileAppService.GetAsync();
PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user);
}
public async Task<IActionResult> OnPostAsync()
{
ValidateModel();
var updateDto = ObjectMapper.Map<PersonalSettingsInfoModel, UpdateProfileDto>(PersonalSettingsInfoModel);
await _profileAppService.UpdateAsync(updateDto);
return NoContent();
}
}
public class PersonalSettingsInfoModel
{
[Required]
[StringLength(IdentityUserConsts.MaxUserNameLength)]
[Display(Name = "DisplayName:UserName")]
public string UserName { get; set; }
[Required]
[StringLength(IdentityUserConsts.MaxEmailLength)]
[Display(Name = "DisplayName:Email")]
public string Email { get; set; }
[StringLength(IdentityUserConsts.MaxNameLength)]
[Display(Name = "DisplayName:Name")]
public string Name { get; set; }
[StringLength(IdentityUserConsts.MaxSurnameLength)]
[Display(Name = "DisplayName:Surname")]
public string Surname { get; set; }
[StringLength(IdentityUserConsts.MaxPhoneNumberLength)]
[Display(Name = "DisplayName:PhoneNumber")]
public string PhoneNumber { get; set; }
}
}

18
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Shared/personal-settings-modal.js

@ -0,0 +1,18 @@
(function ($) {
var l = abp.localization.getResource('AbpIdentity');
var _personalSettingsModal = new abp.ModalManager(abp.appPath + 'Identity/Shared/PersonalSettingsModal');
$(function () {
$("#abp-account-personal-settings").click(function (e) {
e.preventDefault();
_personalSettingsModal.open();
});
_personalSettingsModal.onResult(function () {
//abp.message.success(l("PersonalSettingsSavedMessage"));
});
});
})(jQuery);

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

@ -15,6 +15,8 @@
<abp-tab title="@L["UserInformations"].Value"> <abp-tab title="@L["UserInformations"].Value">
@* TODO: Can we use dynamic form? *@ @* TODO: Can we use dynamic form? *@
<abp-input asp-for="UserInfo.UserName" /> <abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.Surname" />
<abp-input asp-for="UserInfo.Password" /> <abp-input asp-for="UserInfo.Password" />
<abp-input asp-for="UserInfo.Email" /> <abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.PhoneNumber" /> <abp-input asp-for="UserInfo.PhoneNumber" />

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

@ -56,6 +56,12 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
[StringLength(IdentityUserConsts.MaxUserNameLength)] [StringLength(IdentityUserConsts.MaxUserNameLength)]
public string UserName { get; set; } public string UserName { get; set; }
[StringLength(IdentityUserConsts.MaxNameLength)]
public string Name { get; set; }
[StringLength(IdentityUserConsts.MaxSurnameLength)]
public string Surname { get; set; }
[Required] [Required]
[StringLength(IdentityUserConsts.MaxPasswordLength)] [StringLength(IdentityUserConsts.MaxPasswordLength)]
[DataType(DataType.Password)] [DataType(DataType.Password)]

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

@ -14,12 +14,14 @@
<abp-tabs name="create-user-modal-tabs"> <abp-tabs name="create-user-modal-tabs">
<abp-tab title="@L["UserInformations"].Value"> <abp-tab title="@L["UserInformations"].Value">
@* TODO: Can we use dynamic form? *@ @* TODO: Can we use dynamic form? *@
<input asp-for="UserInfo.Id"/> <input asp-for="UserInfo.Id" />
<abp-input asp-for="UserInfo.UserName"/> <abp-input asp-for="UserInfo.UserName" />
<abp-input asp-for="UserInfo.Email"/> <abp-input asp-for="UserInfo.Name" />
<abp-input asp-for="UserInfo.PhoneNumber"/> <abp-input asp-for="UserInfo.Surname" />
<abp-input asp-for="UserInfo.LockoutEnabled"/> <abp-input asp-for="UserInfo.Email" />
<abp-input asp-for="UserInfo.TwoFactorEnabled"/> <abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />
<abp-input asp-for="UserInfo.TwoFactorEnabled" />
</abp-tab> </abp-tab>
<abp-tab title="@L["Roles"].Value"> <abp-tab title="@L["Roles"].Value">
@for (var i = 0; i < Model.Roles.Length; i++) @for (var i = 0; i < Model.Roles.Length; i++)

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

@ -63,6 +63,12 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
[StringLength(IdentityUserConsts.MaxUserNameLength)] [StringLength(IdentityUserConsts.MaxUserNameLength)]
public string UserName { get; set; } public string UserName { get; set; }
[StringLength(IdentityUserConsts.MaxNameLength)]
public string Name { get; set; }
[StringLength(IdentityUserConsts.MaxSurnameLength)]
public string Surname { get; set; }
[Required] [Required]
[EmailAddress] [EmailAddress]
[StringLength(IdentityUserConsts.MaxEmailLength)] [StringLength(IdentityUserConsts.MaxEmailLength)]

97
modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs

@ -0,0 +1,97 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;
using Shouldly;
using Volo.Abp.Users;
using Xunit;
namespace Volo.Abp.Identity
{
public class ProfileAppService_Tests : AbpIdentityApplicationTestBase
{
private readonly IProfileAppService _profileAppService;
private readonly IIdentityUserRepository _userRepository;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly IdentityTestData _testData;
private ICurrentUser _currentUser;
public ProfileAppService_Tests()
{
_profileAppService = GetRequiredService<IProfileAppService>();
_userRepository = GetRequiredService<IIdentityUserRepository>();
_signInManager = GetRequiredService<SignInManager<IdentityUser>>();
_testData = GetRequiredService<IdentityTestData>();
}
protected override void AfterAddApplication(IServiceCollection services)
{
_currentUser = Substitute.For<ICurrentUser>();
services.AddSingleton(_currentUser);
}
[Fact]
public async Task GetAsync()
{
//Arrange
_currentUser.Id.Returns(_testData.UserJohnId);
_currentUser.IsAuthenticated.Returns(true);
//Act
var result = await _profileAppService.GetAsync();
//Assert
var johnNash = GetUser("john.nash");
result.UserName.ShouldBe(johnNash.UserName);
result.Email.ShouldBe(johnNash.Email);
result.PhoneNumber.ShouldBe(johnNash.PhoneNumber);
}
[Fact]
public async Task UpdateAsync()
{
//Arrange
//Arrange
_currentUser.Id.Returns(_testData.UserJohnId);
_currentUser.IsAuthenticated.Returns(true);
var input = new UpdateProfileDto
{
UserName = CreateRandomString(),
PhoneNumber = CreateRandomPhoneNumber(),
Email = CreateRandomEmail(),
Name = CreateRandomString(),
Surname = CreateRandomString()
};
//Act
var result = await _profileAppService.UpdateAsync(input);
//Assert
result.UserName.ShouldBe(input.UserName);
result.Email.ShouldBe(input.Email);
result.PhoneNumber.ShouldBe(input.PhoneNumber);
result.Surname.ShouldBe(input.Surname);
result.Name.ShouldBe(input.Name);
}
private static string CreateRandomEmail()
{
return CreateRandomString() + "@abp.io";
}
private static string CreateRandomString()
{
return Guid.NewGuid().ToString("N").Left(16);
}
private static string CreateRandomPhoneNumber()
{
return RandomHelper.GetRandom(10000000, 100000000).ToString();
}
}
}

4
modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/IUserData.cs

@ -11,6 +11,10 @@ namespace Volo.Abp.Users
string UserName { get; } string UserName { get; }
string Name { get; }
string Surname { get; }
[CanBeNull] [CanBeNull]
string Email { get; } string Email { get; }

8
modules/users/src/Volo.Abp.Users.Abstractions/Volo/Abp/Users/UserData.cs

@ -9,6 +9,10 @@ namespace Volo.Abp.Users
public string UserName { get; set; } public string UserName { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Email { get; set; } public string Email { get; set; }
public bool EmailConfirmed { get; set; } public bool EmailConfirmed { get; set; }
@ -28,6 +32,8 @@ namespace Volo.Abp.Users
Guid id, Guid id,
[NotNull] string userName, [NotNull] string userName,
[CanBeNull] string email = null, [CanBeNull] string email = null,
[CanBeNull] string name = null,
[CanBeNull] string surname = null,
bool emailConfirmed = false, bool emailConfirmed = false,
[CanBeNull] string phoneNumber = null, [CanBeNull] string phoneNumber = null,
bool phoneNumberConfirmed = false, bool phoneNumberConfirmed = false,
@ -36,6 +42,8 @@ namespace Volo.Abp.Users
Id = id; Id = id;
UserName = userName; UserName = userName;
Email = email; Email = email;
Name = name;
Surname = surname;
EmailConfirmed = emailConfirmed; EmailConfirmed = emailConfirmed;
PhoneNumber = phoneNumber; PhoneNumber = phoneNumber;
PhoneNumberConfirmed = phoneNumberConfirmed; PhoneNumberConfirmed = phoneNumberConfirmed;

4
modules/users/src/Volo.Abp.Users.Domain.Shared/Volo/Abp/Users/AbpUserConsts.cs

@ -3,6 +3,10 @@ namespace Volo.Abp.Users
public class AbpUserConsts public class AbpUserConsts
{ {
public const int MaxUserNameLength = 256; public const int MaxUserNameLength = 256;
public const int MaxNameLength = 64;
public const int MaxSurnameLength = 64;
public const int MaxEmailLength = 256; public const int MaxEmailLength = 256;

2
modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/AbpUserExtensions.cs

@ -7,6 +7,8 @@ namespace Volo.Abp.Users
return new UserData( return new UserData(
user.Id, user.Id,
user.UserName, user.UserName,
user.Name,
user.Surname,
user.Email, user.Email,
user.EmailConfirmed, user.EmailConfirmed,
user.PhoneNumber, user.PhoneNumber,

6
modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/IUser.cs

@ -12,6 +12,12 @@ namespace Volo.Abp.Users
[CanBeNull] [CanBeNull]
string Email { get; } string Email { get; }
[CanBeNull]
string Name { get; }
[CanBeNull]
string Surname { get; }
bool EmailConfirmed { get; } bool EmailConfirmed { get; }
[CanBeNull] [CanBeNull]

2
modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/AbpUsersDbContextModelCreatingExtensions.cs

@ -12,6 +12,8 @@ namespace Volo.Abp.Users.EntityFrameworkCore
b.Property(u => u.TenantId).HasColumnName(nameof(IUser.TenantId)); b.Property(u => u.TenantId).HasColumnName(nameof(IUser.TenantId));
b.Property(u => u.UserName).IsRequired().HasMaxLength(AbpUserConsts.MaxUserNameLength).HasColumnName(nameof(IUser.UserName)); b.Property(u => u.UserName).IsRequired().HasMaxLength(AbpUserConsts.MaxUserNameLength).HasColumnName(nameof(IUser.UserName));
b.Property(u => u.Email).HasMaxLength(AbpUserConsts.MaxEmailLength).HasColumnName(nameof(IUser.Email)); b.Property(u => u.Email).HasMaxLength(AbpUserConsts.MaxEmailLength).HasColumnName(nameof(IUser.Email));
b.Property(u => u.Name).HasMaxLength(AbpUserConsts.MaxNameLength).HasColumnName(nameof(IUser.Name));
b.Property(u => u.Surname).HasMaxLength(AbpUserConsts.MaxSurnameLength).HasColumnName(nameof(IUser.Surname));
b.Property(u => u.EmailConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.EmailConfirmed)); b.Property(u => u.EmailConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.EmailConfirmed));
b.Property(u => u.PhoneNumber).HasMaxLength(AbpUserConsts.MaxPhoneNumberLength).HasColumnName(nameof(IUser.PhoneNumber)); b.Property(u => u.PhoneNumber).HasMaxLength(AbpUserConsts.MaxPhoneNumberLength).HasColumnName(nameof(IUser.PhoneNumber));
b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.PhoneNumberConfirmed)); b.Property(u => u.PhoneNumberConfirmed).HasDefaultValue(false).HasColumnName(nameof(IUser.PhoneNumberConfirmed));

Loading…
Cancel
Save