From 9193f9692d71bd64306f071a1fa3a82d2ff1d041 Mon Sep 17 00:00:00 2001 From: hikalkan Date: Mon, 9 Mar 2015 19:35:25 +0200 Subject: [PATCH] Upgraded to ABP 0.5.6. --- .../Abp.Zero.EntityFramework.csproj | 8 ++++---- src/Abp.Zero.EntityFramework/packages.config | 4 ++-- .../Abp.Zero.NHibernate.csproj | 12 +++++------ src/Abp.Zero.NHibernate/packages.config | 6 +++--- src/Abp.Zero/Abp.Zero.csproj | 5 ++--- .../Authorization/Users/AbpUserManager.cs | 5 +++-- src/Abp.Zero/Runtime/Session/AbpSession.cs | 20 +++++++++++++++---- src/Abp.Zero/Zero/AbpZeroCoreModule.cs | 3 +-- .../Zero/Configuration/MultiTenancyConfig.cs | 14 ------------- src/Abp.Zero/Zero/Configuration/ZeroConfig.cs | 12 ----------- src/Abp.Zero/packages.config | 2 +- .../Abp.Zero.SampleApp.Tests.csproj | 12 +++++------ .../Users/UserLogin_Tests.cs | 9 +++++---- .../Abp.Zero.SampleApp.Tests/packages.config | 6 +++--- .../Abp.Zero.SampleApp.csproj | 8 ++++---- .../Abp.Zero.SampleApp/Users/UserManager.cs | 4 ++-- src/Tests/Abp.Zero.SampleApp/packages.config | 4 ++-- 17 files changed, 60 insertions(+), 74 deletions(-) delete mode 100644 src/Abp.Zero/Zero/Configuration/MultiTenancyConfig.cs diff --git a/src/Abp.Zero.EntityFramework/Abp.Zero.EntityFramework.csproj b/src/Abp.Zero.EntityFramework/Abp.Zero.EntityFramework.csproj index 0eaef112..1c0584ab 100644 --- a/src/Abp.Zero.EntityFramework/Abp.Zero.EntityFramework.csproj +++ b/src/Abp.Zero.EntityFramework/Abp.Zero.EntityFramework.csproj @@ -34,13 +34,13 @@ bin\Release\Abp.Zero.EntityFramework.XML - + False - ..\packages\Abp.0.5.5.0\lib\net451\Abp.dll + ..\packages\Abp.0.5.6.0\lib\net451\Abp.dll - + False - ..\packages\Abp.EntityFramework.0.5.5.0\lib\net451\Abp.EntityFramework.dll + ..\packages\Abp.EntityFramework.0.5.6.0\lib\net451\Abp.EntityFramework.dll False diff --git a/src/Abp.Zero.EntityFramework/packages.config b/src/Abp.Zero.EntityFramework/packages.config index a5e91f29..f3f87d44 100644 --- a/src/Abp.Zero.EntityFramework/packages.config +++ b/src/Abp.Zero.EntityFramework/packages.config @@ -1,7 +1,7 @@  - - + + diff --git a/src/Abp.Zero.NHibernate/Abp.Zero.NHibernate.csproj b/src/Abp.Zero.NHibernate/Abp.Zero.NHibernate.csproj index 9a304ffa..7a1879ca 100644 --- a/src/Abp.Zero.NHibernate/Abp.Zero.NHibernate.csproj +++ b/src/Abp.Zero.NHibernate/Abp.Zero.NHibernate.csproj @@ -34,17 +34,17 @@ bin\Release\Abp.Zero.NHibernate.XML - + False - ..\packages\Abp.0.5.5.0\lib\net451\Abp.dll + ..\packages\Abp.0.5.6.0\lib\net451\Abp.dll - + False - ..\packages\Abp.FluentMigrator.0.5.5.0\lib\net451\Abp.FluentMigrator.dll + ..\packages\Abp.FluentMigrator.0.5.6.0\lib\net451\Abp.FluentMigrator.dll - + False - ..\packages\Abp.NHibernate.0.5.5.0\lib\net451\Abp.NHibernate.dll + ..\packages\Abp.NHibernate.0.5.6.0\lib\net451\Abp.NHibernate.dll False diff --git a/src/Abp.Zero.NHibernate/packages.config b/src/Abp.Zero.NHibernate/packages.config index 9acf14c1..b7dae489 100644 --- a/src/Abp.Zero.NHibernate/packages.config +++ b/src/Abp.Zero.NHibernate/packages.config @@ -1,8 +1,8 @@  - - - + + + diff --git a/src/Abp.Zero/Abp.Zero.csproj b/src/Abp.Zero/Abp.Zero.csproj index b186505a..d84e5551 100644 --- a/src/Abp.Zero/Abp.Zero.csproj +++ b/src/Abp.Zero/Abp.Zero.csproj @@ -34,9 +34,9 @@ bin\Release\Abp.Zero.XML - + False - ..\packages\Abp.0.5.5.0\lib\net451\Abp.dll + ..\packages\Abp.0.5.6.0\lib\net451\Abp.dll False @@ -104,7 +104,6 @@ - diff --git a/src/Abp.Zero/Authorization/Users/AbpUserManager.cs b/src/Abp.Zero/Authorization/Users/AbpUserManager.cs index 2f0b8d3d..3cf78043 100644 --- a/src/Abp.Zero/Authorization/Users/AbpUserManager.cs +++ b/src/Abp.Zero/Authorization/Users/AbpUserManager.cs @@ -5,6 +5,7 @@ using System.Security.Claims; using System.Threading.Tasks; using Abp.Authorization.Roles; +using Abp.Configuration.Startup; using Abp.Dependency; using Abp.Domain.Repositories; using Abp.Extensions; @@ -39,14 +40,14 @@ private IUserPermissionStore UserPermissionStore private readonly IPermissionManager _permissionManager; private readonly AbpRoleManager _roleManager; private readonly IRepository _tenantRepository; - private readonly MultiTenancyConfig _multiTenancyConfig; + private readonly IMultiTenancyConfig _multiTenancyConfig; private readonly AbpUserStore _abpUserStore; protected AbpUserManager( AbpUserStore userStore, AbpRoleManager roleManager, IRepository tenantRepository, - MultiTenancyConfig multiTenancyConfig, + IMultiTenancyConfig multiTenancyConfig, IPermissionManager permissionManager) : base(userStore) { diff --git a/src/Abp.Zero/Runtime/Session/AbpSession.cs b/src/Abp.Zero/Runtime/Session/AbpSession.cs index 970d7eba..cce6a76d 100644 --- a/src/Abp.Zero/Runtime/Session/AbpSession.cs +++ b/src/Abp.Zero/Runtime/Session/AbpSession.cs @@ -2,7 +2,9 @@ using System.Linq; using System.Security.Claims; using System.Threading; +using Abp.Configuration.Startup; using Abp.Dependency; +using Abp.MultiTenancy; using Abp.Runtime.Security; using Abp.Zero.Configuration; using Microsoft.AspNet.Identity; @@ -14,8 +16,6 @@ namespace Abp.Runtime.Session /// public class AbpSession : IAbpSession, ISingletonDependency { - private readonly MultiTenancyConfig _multiTenancy; - public long? UserId { get @@ -36,7 +36,7 @@ public int? TenantId { if (!_multiTenancy.IsEnabled) { - return 1; //TODO: This assumption is not good! + return 1; //TODO@hikalkan: This assumption may not be good? } var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal; @@ -55,10 +55,22 @@ public int? TenantId } } + public MultiTenancySide MultiTenancySide + { + get + { + return _multiTenancy.IsEnabled && !TenantId.HasValue + ? MultiTenancySide.Host + : MultiTenancySide.Tenant; + } + } + + private readonly IMultiTenancyConfig _multiTenancy; + /// /// Constructor. /// - public AbpSession(MultiTenancyConfig multiTenancy) + public AbpSession(IMultiTenancyConfig multiTenancy) { _multiTenancy = multiTenancy; } diff --git a/src/Abp.Zero/Zero/AbpZeroCoreModule.cs b/src/Abp.Zero/Zero/AbpZeroCoreModule.cs index e8b57610..52defb3a 100644 --- a/src/Abp.Zero/Zero/AbpZeroCoreModule.cs +++ b/src/Abp.Zero/Zero/AbpZeroCoreModule.cs @@ -12,11 +12,10 @@ public class AbpZeroCoreModule : AbpModule /// /// Current version of the zero module. /// - public const string CurrentVersion = "0.5.7.0"; + public const string CurrentVersion = "0.5.8.0"; public override void PreInitialize() { - IocManager.Register(); IocManager.Register(); } diff --git a/src/Abp.Zero/Zero/Configuration/MultiTenancyConfig.cs b/src/Abp.Zero/Zero/Configuration/MultiTenancyConfig.cs deleted file mode 100644 index 6657cfd0..00000000 --- a/src/Abp.Zero/Zero/Configuration/MultiTenancyConfig.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Abp.Zero.Configuration -{ - /// - /// Used to configure multitenancy. - /// - public class MultiTenancyConfig - { - /// - /// Is multi-tenancy enabled? - /// Default value: false. - /// - public bool IsEnabled { get; set; } - } -} \ No newline at end of file diff --git a/src/Abp.Zero/Zero/Configuration/ZeroConfig.cs b/src/Abp.Zero/Zero/Configuration/ZeroConfig.cs index 657f91b6..efd96c8a 100644 --- a/src/Abp.Zero/Zero/Configuration/ZeroConfig.cs +++ b/src/Abp.Zero/Zero/Configuration/ZeroConfig.cs @@ -5,18 +5,6 @@ /// public class ZeroConfig { - /// - /// Multi tenancy configuration. - /// - public MultiTenancyConfig MultiTenancy { get; private set; } - /// - /// Constructor. - /// - /// Multi tenancy configuration - public ZeroConfig(MultiTenancyConfig multiTenancy) - { - MultiTenancy = multiTenancy; - } } } \ No newline at end of file diff --git a/src/Abp.Zero/packages.config b/src/Abp.Zero/packages.config index dcade915..17d12dc0 100644 --- a/src/Abp.Zero/packages.config +++ b/src/Abp.Zero/packages.config @@ -1,6 +1,6 @@  - + diff --git a/src/Tests/Abp.Zero.SampleApp.Tests/Abp.Zero.SampleApp.Tests.csproj b/src/Tests/Abp.Zero.SampleApp.Tests/Abp.Zero.SampleApp.Tests.csproj index 29e3aa72..1cd8938d 100644 --- a/src/Tests/Abp.Zero.SampleApp.Tests/Abp.Zero.SampleApp.Tests.csproj +++ b/src/Tests/Abp.Zero.SampleApp.Tests/Abp.Zero.SampleApp.Tests.csproj @@ -34,17 +34,17 @@ 4 - + False - ..\..\packages\Abp.0.5.5.0\lib\net451\Abp.dll + ..\..\packages\Abp.0.5.6.0\lib\net451\Abp.dll - + False - ..\..\packages\Abp.EntityFramework.0.5.5.0\lib\net451\Abp.EntityFramework.dll + ..\..\packages\Abp.EntityFramework.0.5.6.0\lib\net451\Abp.EntityFramework.dll - + False - ..\..\packages\Abp.TestBase.0.1.3.0\lib\net451\Abp.TestBase.dll + ..\..\packages\Abp.TestBase.0.1.4.0\lib\net451\Abp.TestBase.dll False diff --git a/src/Tests/Abp.Zero.SampleApp.Tests/Users/UserLogin_Tests.cs b/src/Tests/Abp.Zero.SampleApp.Tests/Users/UserLogin_Tests.cs index ef5453e8..bc4e5a4f 100644 --- a/src/Tests/Abp.Zero.SampleApp.Tests/Users/UserLogin_Tests.cs +++ b/src/Tests/Abp.Zero.SampleApp.Tests/Users/UserLogin_Tests.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Abp.Authorization.Users; +using Abp.Configuration.Startup; using Abp.Zero.Configuration; using Abp.Zero.SampleApp.MultiTenancy; using Abp.Zero.SampleApp.Users; @@ -50,7 +51,7 @@ public UserLogin_Tests() [Fact] public async Task Should_Login_With_Correct_Values_Without_MultiTenancy() { - Resolve().IsEnabled = false; + Resolve().IsEnabled = false; AbpSession.TenantId = 1; //TODO: We should not need to set this and implement AbpSession instead of TestSession. var loginResult = await _userManager.LoginAsync("user1", "123qwe"); @@ -62,7 +63,7 @@ public async Task Should_Login_With_Correct_Values_Without_MultiTenancy() [Fact] public async Task Should_Not_Login_With_Invalid_UserName_Without_MultiTenancy() { - Resolve().IsEnabled = false; + Resolve().IsEnabled = false; AbpSession.TenantId = 1; //TODO: We should not need to set this and implement AbpSession instead of TestSession. var loginResult = await _userManager.LoginAsync("wrongUserName", "asdfgh"); @@ -74,7 +75,7 @@ public async Task Should_Not_Login_With_Invalid_UserName_Without_MultiTenancy() [Fact] public async Task Should_Login_With_Correct_Values_With_MultiTenancy() { - Resolve().IsEnabled = true; + Resolve().IsEnabled = true; var loginResult = await _userManager.LoginAsync("user1", "123qwe", "tenant1"); loginResult.Result.ShouldBe(AbpLoginResultType.Success); @@ -85,7 +86,7 @@ public async Task Should_Login_With_Correct_Values_With_MultiTenancy() [Fact] public async Task Should_Login_TenancyOwner_With_Correct_Values() { - Resolve().IsEnabled = true; + Resolve().IsEnabled = true; var loginResult = await _userManager.LoginAsync("userOwner", "123qwe"); loginResult.Result.ShouldBe(AbpLoginResultType.Success); diff --git a/src/Tests/Abp.Zero.SampleApp.Tests/packages.config b/src/Tests/Abp.Zero.SampleApp.Tests/packages.config index 79333adf..9f35dcbd 100644 --- a/src/Tests/Abp.Zero.SampleApp.Tests/packages.config +++ b/src/Tests/Abp.Zero.SampleApp.Tests/packages.config @@ -1,8 +1,8 @@  - - - + + + diff --git a/src/Tests/Abp.Zero.SampleApp/Abp.Zero.SampleApp.csproj b/src/Tests/Abp.Zero.SampleApp/Abp.Zero.SampleApp.csproj index a8f0d758..6953692c 100644 --- a/src/Tests/Abp.Zero.SampleApp/Abp.Zero.SampleApp.csproj +++ b/src/Tests/Abp.Zero.SampleApp/Abp.Zero.SampleApp.csproj @@ -32,13 +32,13 @@ 4 - + False - ..\..\packages\Abp.0.5.5.0\lib\net451\Abp.dll + ..\..\packages\Abp.0.5.6.0\lib\net451\Abp.dll - + False - ..\..\packages\Abp.EntityFramework.0.5.5.0\lib\net451\Abp.EntityFramework.dll + ..\..\packages\Abp.EntityFramework.0.5.6.0\lib\net451\Abp.EntityFramework.dll False diff --git a/src/Tests/Abp.Zero.SampleApp/Users/UserManager.cs b/src/Tests/Abp.Zero.SampleApp/Users/UserManager.cs index 4a122fd5..f3e05ebc 100644 --- a/src/Tests/Abp.Zero.SampleApp/Users/UserManager.cs +++ b/src/Tests/Abp.Zero.SampleApp/Users/UserManager.cs @@ -1,7 +1,7 @@ using Abp.Authorization; using Abp.Authorization.Users; +using Abp.Configuration.Startup; using Abp.Domain.Repositories; -using Abp.Zero.Configuration; using Abp.Zero.SampleApp.MultiTenancy; using Abp.Zero.SampleApp.Roles; @@ -13,7 +13,7 @@ public UserManager( UserStore userStore, RoleManager roleManager, IRepository tenantRepository, - MultiTenancyConfig multiTenancyConfig, + IMultiTenancyConfig multiTenancyConfig, IPermissionManager permissionManager) : base( userStore, diff --git a/src/Tests/Abp.Zero.SampleApp/packages.config b/src/Tests/Abp.Zero.SampleApp/packages.config index 0984ce4a..57b176ff 100644 --- a/src/Tests/Abp.Zero.SampleApp/packages.config +++ b/src/Tests/Abp.Zero.SampleApp/packages.config @@ -1,7 +1,7 @@  - - + +