Skip to content

Commit 01cdb1f

Browse files
committed
merged
2 parents b764b8c + 14ffb02 commit 01cdb1f

File tree

11 files changed

+257
-15
lines changed

11 files changed

+257
-15
lines changed

src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/User.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static User CreateTenantAdminUser(int tenantId, string emailAddress, stri
2626
Password = new PasswordHasher().HashPassword(password)
2727
};
2828

29+
user.SetNormalizedNames();
30+
2931
return user;
3032
}
3133
}

src/AbpCompanyName.AbpProjectName.Core/Authorization/Users/UserStore.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Abp.Authorization.Users;
22
using Abp.Domain.Repositories;
33
using Abp.Domain.Uow;
4+
using Abp.Organizations;
45
using AbpCompanyName.AbpProjectName.Authorization.Roles;
56

67
namespace AbpCompanyName.AbpProjectName.Authorization.Users
@@ -14,15 +15,19 @@ public UserStore(
1415
IRepository<Role> roleRepository,
1516
IRepository<UserPermissionSetting, long> userPermissionSettingRepository,
1617
IUnitOfWorkManager unitOfWorkManager,
17-
IRepository<UserClaim, long> userClaimStore)
18+
IRepository<UserClaim, long> userClaimStore,
19+
IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository,
20+
IRepository<OrganizationUnitRole, long> organizationUnitRoleRepository)
1821
: base(
19-
userRepository,
20-
userLoginRepository,
21-
userRoleRepository,
22-
roleRepository,
23-
userPermissionSettingRepository,
24-
unitOfWorkManager,
25-
userClaimStore)
22+
userRepository,
23+
userLoginRepository,
24+
userRoleRepository,
25+
roleRepository,
26+
userPermissionSettingRepository,
27+
unitOfWorkManager,
28+
userClaimStore,
29+
userOrganizationUnitRepository,
30+
organizationUnitRoleRepository)
2631
{
2732
}
2833
}

src/AbpCompanyName.AbpProjectName.EntityFramework/AbpCompanyName.AbpProjectName.EntityFramework.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@
232232
<Compile Include="Migrations\201901110613114_Upgraded_To_ABP_v4_1_0.Designer.cs">
233233
<DependentUpon>201901110613114_Upgraded_To_ABP_v4_1_0.cs</DependentUpon>
234234
</Compile>
235+
<Compile Include="Migrations\201902080730036_Upgrade_ABP_To_4_2_0.cs" />
236+
<Compile Include="Migrations\201902080730036_Upgrade_ABP_To_4_2_0.Designer.cs">
237+
<DependentUpon>201902080730036_Upgrade_ABP_To_4_2_0.cs</DependentUpon>
238+
</Compile>
235239
<Compile Include="Migrations\AbpZeroDbMigrator.cs" />
236240
<Compile Include="Migrations\Configuration.cs" />
237241
<Compile Include="Migrations\SeedData\DefaultEditionsCreator.cs" />
@@ -263,6 +267,9 @@
263267
<EmbeddedResource Include="Migrations\201901110613114_Upgraded_To_ABP_v4_1_0.resx">
264268
<DependentUpon>201901110613114_Upgraded_To_ABP_v4_1_0.cs</DependentUpon>
265269
</EmbeddedResource>
270+
<EmbeddedResource Include="Migrations\201902080730036_Upgrade_ABP_To_4_2_0.resx">
271+
<DependentUpon>201902080730036_Upgrade_ABP_To_4_2_0.cs</DependentUpon>
272+
</EmbeddedResource>
266273
</ItemGroup>
267274
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
268275
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/201902080730036_Upgrade_ABP_To_4_2_0.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
namespace AbpCompanyName.AbpProjectName.Migrations
2+
{
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Data.Entity.Infrastructure.Annotations;
6+
using System.Data.Entity.Migrations;
7+
8+
public partial class Upgrade_ABP_To_4_2_0 : DbMigration
9+
{
10+
public override void Up()
11+
{
12+
CreateTable(
13+
"dbo.AbpOrganizationUnitRoles",
14+
c => new
15+
{
16+
Id = c.Long(nullable: false, identity: true),
17+
TenantId = c.Int(),
18+
RoleId = c.Int(nullable: false),
19+
OrganizationUnitId = c.Long(nullable: false),
20+
IsDeleted = c.Boolean(nullable: false),
21+
CreationTime = c.DateTime(nullable: false),
22+
CreatorUserId = c.Long(),
23+
},
24+
annotations: new Dictionary<string, object>
25+
{
26+
{ "DynamicFilter_OrganizationUnitRole_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
27+
})
28+
.PrimaryKey(t => t.Id)
29+
.Index(t => t.TenantId);
30+
31+
AddColumn("dbo.AbpAuditLogs", "ReturnValue", c => c.String());
32+
AddColumn("dbo.AbpRoles", "NormalizedName", c => c.String(nullable: false, maxLength: 32));
33+
AddColumn("dbo.AbpUsers", "NormalizedUserName", c => c.String(nullable: false, maxLength: 256));
34+
AddColumn("dbo.AbpUsers", "NormalizedEmailAddress", c => c.String(nullable: false, maxLength: 256));
35+
DropColumn("dbo.AbpUsers", "LastLoginTime");
36+
DropColumn("dbo.AbpUserAccounts", "LastLoginTime");
37+
}
38+
39+
public override void Down()
40+
{
41+
AddColumn("dbo.AbpUserAccounts", "LastLoginTime", c => c.DateTime());
42+
AddColumn("dbo.AbpUsers", "LastLoginTime", c => c.DateTime());
43+
DropIndex("dbo.AbpOrganizationUnitRoles", new[] { "TenantId" });
44+
DropColumn("dbo.AbpUsers", "NormalizedEmailAddress");
45+
DropColumn("dbo.AbpUsers", "NormalizedUserName");
46+
DropColumn("dbo.AbpRoles", "NormalizedName");
47+
DropColumn("dbo.AbpAuditLogs", "ReturnValue");
48+
DropTable("dbo.AbpOrganizationUnitRoles",
49+
removedAnnotations: new Dictionary<string, object>
50+
{
51+
{ "DynamicFilter_OrganizationUnitRole_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
52+
});
53+
}
54+
}
55+
}

src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/201902080730036_Upgrade_ABP_To_4_2_0.resx

Lines changed: 126 additions & 0 deletions
Large diffs are not rendered by default.

src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/SeedData/HostRoleAndUserCreator.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ private void CreateHostRoleAndUsers()
3232
var adminRoleForHost = _context.Roles.FirstOrDefault(r => r.TenantId == null && r.Name == StaticRoleNames.Host.Admin);
3333
if (adminRoleForHost == null)
3434
{
35-
adminRoleForHost = _context.Roles.Add(new Role { Name = StaticRoleNames.Host.Admin, DisplayName = StaticRoleNames.Host.Admin, IsStatic = true });
35+
36+
adminRoleForHost = new Role
37+
{
38+
Name = StaticRoleNames.Host.Admin,
39+
DisplayName = StaticRoleNames.Host.Admin,
40+
IsStatic = true
41+
};
42+
43+
adminRoleForHost.SetNormalizedName();
44+
45+
_context.Roles.Add(adminRoleForHost);
3646
_context.SaveChanges();
3747

3848
//Grant all tenant permissions
@@ -71,10 +81,11 @@ private void CreateHostRoleAndUsers()
7181
Password = new PasswordHasher().HashPassword(User.DefaultPassword)
7282
});
7383

84+
adminUserForHost.SetNormalizedNames();
85+
7486
_context.SaveChanges();
7587

7688
_context.UserRoles.Add(new UserRole(null, adminUserForHost.Id, adminRoleForHost.Id));
77-
7889
_context.SaveChanges();
7990
}
8091
}

src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/SeedData/TenantRoleAndUserBuilder.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ private void CreateRolesAndUsers()
3333
var adminRole = _context.Roles.FirstOrDefault(r => r.TenantId == _tenantId && r.Name == StaticRoleNames.Tenants.Admin);
3434
if (adminRole == null)
3535
{
36-
adminRole = _context.Roles.Add(new Role(_tenantId, StaticRoleNames.Tenants.Admin, StaticRoleNames.Tenants.Admin) { IsStatic = true });
36+
adminRole = new Role(_tenantId, StaticRoleNames.Tenants.Admin, StaticRoleNames.Tenants.Admin)
37+
{
38+
IsStatic = true
39+
};
40+
41+
adminRole.SetNormalizedName();
42+
43+
_context.Roles.Add(adminRole);
3744
_context.SaveChanges();
3845

3946
//Grant all permissions to admin role

src/AbpCompanyName.AbpProjectName.WebApi/AbpCompanyName.AbpProjectName.WebApi.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
<Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
9393
<HintPath>..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
9494
</Reference>
95-
<Reference Include="Microsoft.Owin, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
96-
<HintPath>..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll</HintPath>
95+
<Reference Include="Microsoft.Owin, Version=4.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
96+
<HintPath>..\packages\Microsoft.Owin.4.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
9797
</Reference>
9898
<Reference Include="Microsoft.Owin.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9999
<HintPath>..\packages\Microsoft.Owin.Security.4.0.0\lib\net451\Microsoft.Owin.Security.dll</HintPath>

src/AbpCompanyName.AbpProjectName.WebApi/app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
</dependentAssembly>
241241
<dependentAssembly>
242242
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
243-
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
243+
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
244244
</dependentAssembly>
245245
<dependentAssembly>
246246
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

0 commit comments

Comments
 (0)