diff --git a/Volo.Abp.sln b/Volo.Abp.sln index 65aa5a9b81..14d8299ef7 100644 --- a/Volo.Abp.sln +++ b/Volo.Abp.sln @@ -170,8 +170,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Validation.Tests", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Security", "src\Volo.Abp.Security\Volo.Abp.Security.csproj", "{D43CC2C9-449A-4619-B5C6-CBC72BCA0512}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Session", "src\Volo.Abp.Session\Volo.Abp.Session.csproj", "{2FCC8412-8558-465A-A659-025A7BB88F2C}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Guids", "src\Volo.Abp.Guids\Volo.Abp.Guids.csproj", "{75C24B75-7B8A-4FC5-9DE4-91BF6168BCC0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Threading", "src\Volo.Abp.Threading\Volo.Abp.Threading.csproj", "{B17BAA37-27E8-4421-A18B-DDF6D146EA06}" @@ -306,6 +304,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{EBD8 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{F33F751F-1260-40C0-8F76-E3D680605662}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Users", "src\Volo.Abp.Users\Volo.Abp.Users.csproj", "{DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -580,10 +580,6 @@ Global {D43CC2C9-449A-4619-B5C6-CBC72BCA0512}.Debug|Any CPU.Build.0 = Debug|Any CPU {D43CC2C9-449A-4619-B5C6-CBC72BCA0512}.Release|Any CPU.ActiveCfg = Release|Any CPU {D43CC2C9-449A-4619-B5C6-CBC72BCA0512}.Release|Any CPU.Build.0 = Release|Any CPU - {2FCC8412-8558-465A-A659-025A7BB88F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FCC8412-8558-465A-A659-025A7BB88F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FCC8412-8558-465A-A659-025A7BB88F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FCC8412-8558-465A-A659-025A7BB88F2C}.Release|Any CPU.Build.0 = Release|Any CPU {75C24B75-7B8A-4FC5-9DE4-91BF6168BCC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {75C24B75-7B8A-4FC5-9DE4-91BF6168BCC0}.Debug|Any CPU.Build.0 = Debug|Any CPU {75C24B75-7B8A-4FC5-9DE4-91BF6168BCC0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -808,6 +804,10 @@ Global {5AB7E368-1CC8-401D-9952-6CA6779305E7}.Debug|Any CPU.Build.0 = Debug|Any CPU {5AB7E368-1CC8-401D-9952-6CA6779305E7}.Release|Any CPU.ActiveCfg = Release|Any CPU {5AB7E368-1CC8-401D-9952-6CA6779305E7}.Release|Any CPU.Build.0 = Release|Any CPU + {DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -889,7 +889,6 @@ Global {5BECBCEF-459F-424B-A15A-0558D291842A} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {87117AFB-4C87-40CB-889E-F1D97C504906} = {37087D1B-3693-4E96-983D-A69F210BDE53} {D43CC2C9-449A-4619-B5C6-CBC72BCA0512} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} - {2FCC8412-8558-465A-A659-025A7BB88F2C} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {75C24B75-7B8A-4FC5-9DE4-91BF6168BCC0} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {B17BAA37-27E8-4421-A18B-DDF6D146EA06} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {C6CE997A-DE6F-4669-822F-5654BA72C0B0} = {37087D1B-3693-4E96-983D-A69F210BDE53} @@ -957,6 +956,7 @@ Global {5AB7E368-1CC8-401D-9952-6CA6779305E7} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} {EBD87D3A-8130-4FBB-9A47-4A81717BB915} = {447C8A77-E5F0-4538-8687-7383196D04EA} {F33F751F-1260-40C0-8F76-E3D680605662} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {DAE9088E-6E30-4D5D-9DF8-2188E8D386FE} = {4C753F64-0C93-4D65-96C2-A40893AFC1E8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/src/AbpDesk/AbpDesk.Web.Mvc/Pages/App/Tickets/Index.cshtml b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/App/Tickets/Index.cshtml index ad2ea9c211..6fbe072d76 100644 --- a/src/AbpDesk/AbpDesk.Web.Mvc/Pages/App/Tickets/Index.cshtml +++ b/src/AbpDesk/AbpDesk.Web.Mvc/Pages/App/Tickets/Index.cshtml @@ -1,6 +1,6 @@ @page @using AbpDesk.Web.Mvc.Pages.App.Tickets -@using Volo.Abp.Session +@using Volo.Abp.Users @model AbpDesk.Web.Mvc.Pages.App.Tickets.IndexModel @inject ICurrentUser CurrentUser; diff --git a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml index dcaf29a3ea..1dc0526391 100644 --- a/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml +++ b/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Views/Shared/Components/AbpMenu/Default.cshtml @@ -1,6 +1,6 @@ @using Volo.Abp.MultiTenancy -@using Volo.Abp.Session @using Volo.Abp.Ui.Navigation +@using Volo.Abp.Users @model ApplicationMenu @inject ICurrentUser CurrentUser @inject ICurrentTenant CurrentTenant diff --git a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs index 704b880afd..9574f30717 100644 --- a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs +++ b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs @@ -5,9 +5,9 @@ using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; -using Volo.Abp.Session; using Volo.Abp.Timing; using Volo.Abp.Uow; +using Volo.Abp.Users; namespace Volo.Abp.AspNetCore.Mvc { diff --git a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/RazorPages/AbpPageModel.cs b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/RazorPages/AbpPageModel.cs index 9af2327e3f..b9728476e1 100644 --- a/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/RazorPages/AbpPageModel.cs +++ b/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/RazorPages/AbpPageModel.cs @@ -10,9 +10,9 @@ using Volo.Abp.Authorization; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; -using Volo.Abp.Session; using Volo.Abp.Timing; using Volo.Abp.Uow; +using Volo.Abp.Users; namespace Volo.Abp.AspNetCore.Mvc.RazorPages { diff --git a/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj b/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj index feeac28946..aaac4368a0 100644 --- a/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj +++ b/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs b/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs index 8d00cb9741..a8e04b8d0c 100644 --- a/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs +++ b/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/AbpDddApplicationModule.cs @@ -7,13 +7,13 @@ using Volo.Abp.Http; using Volo.Abp.Http.Modeling; using Volo.Abp.Modularity; using Volo.Abp.ObjectMapping; -using Volo.Abp.Session; +using Volo.Abp.Users; using Volo.Abp.Validation; namespace Volo.Abp.Application { [DependsOn(typeof(AbpDddDomainModule))] - [DependsOn(typeof(AbpSessionModule))] + [DependsOn(typeof(AbpUsersModule))] [DependsOn(typeof(AbpObjectMappingModule))] [DependsOn(typeof(AbpValidationModule))] [DependsOn(typeof(AbpAuthorizationModule))] diff --git a/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs index 95c128bda0..85d0e74786 100644 --- a/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs +++ b/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs @@ -7,9 +7,9 @@ using Volo.Abp.Aspects; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.ObjectMapping; -using Volo.Abp.Session; using Volo.Abp.Timing; using Volo.Abp.Uow; +using Volo.Abp.Users; namespace Volo.Abp.Application.Services { diff --git a/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj b/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj index 475290bd98..d9541fcf58 100644 --- a/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj +++ b/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj @@ -18,7 +18,6 @@ - diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs index e37bde87d0..0535eddf98 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModule.cs @@ -2,7 +2,7 @@ using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Permissions; -using Volo.Abp.Session; +using Volo.Abp.Users; namespace Volo.Abp.Identity { @@ -10,7 +10,7 @@ namespace Volo.Abp.Identity typeof(AbpIdentityDomainModule), typeof(AbpIdentityApplicationContractsModule), typeof(AbpAutoMapperModule), - typeof(AbpSessionModule), + typeof(AbpUsersModule), typeof(AbpPermissionsApplicationModule) )] public class AbpIdentityApplicationModule : AbpModule diff --git a/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj b/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj index 2a303fdef1..dbda23dad3 100644 --- a/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj +++ b/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs index 9025e5fe93..f54bce7755 100644 --- a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs +++ b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs @@ -2,12 +2,14 @@ using Volo.Abp.Domain; using Volo.Abp.Modularity; using Volo.Abp.Permissions; +using Volo.Abp.Users; namespace Volo.Abp.Identity { [DependsOn(typeof(AbpPermissionsDomainModule))] [DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpIdentityDomainSharedModule))] + [DependsOn(typeof(AbpUsersModule))] public class AbpIdentityDomainModule : AbpModule { public override void ConfigureServices(IServiceCollection services) diff --git a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserExtensions.cs b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserExtensions.cs new file mode 100644 index 0000000000..760a045116 --- /dev/null +++ b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserExtensions.cs @@ -0,0 +1,19 @@ +using Volo.Abp.Users; + +namespace Volo.Abp.Identity +{ + public static class IdentityUserExtensions + { + public static IUserInfo ToUserInfo(this IdentityUser user) + { + return new UserInfo( + user.Id, + user.UserName, + user.Email, + user.EmailConfirmed, + user.PhoneNumber, + user.PhoneNumberConfirmed + ); + } + } +} diff --git a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLookupService.cs b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLookupService.cs new file mode 100644 index 0000000000..4d3fb1de80 --- /dev/null +++ b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserLookupService.cs @@ -0,0 +1,30 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Users; + +namespace Volo.Abp.Identity +{ + public class IdentityUserLookupService : IUserLookupService, ITransientDependency + { + private readonly IIdentityUserRepository _userRepository; + private readonly ILookupNormalizer _lookupNormalizer; + + public IdentityUserLookupService(IIdentityUserRepository userRepository, ILookupNormalizer lookupNormalizer) + { + _userRepository = userRepository; + _lookupNormalizer = lookupNormalizer; + } + + public async Task FindUserByIdAsync(Guid id) + { + return (await _userRepository.FindAsync(id)).ToUserInfo(); + } + + public async Task FindUserByUserNameAsync(string userName) + { + return (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.Normalize(userName))).ToUserInfo(); + } + } +} diff --git a/src/Volo.Abp.Session/Volo.Abp.Session.csproj.DotSettings b/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj.DotSettings similarity index 100% rename from src/Volo.Abp.Session/Volo.Abp.Session.csproj.DotSettings rename to src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj.DotSettings diff --git a/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientIdentityUserLookupService.cs b/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientIdentityUserLookupService.cs new file mode 100644 index 0000000000..ae6b2476c9 --- /dev/null +++ b/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientIdentityUserLookupService.cs @@ -0,0 +1,31 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Users; + +namespace Volo.Abp.Identity +{ + public class HttpClientIdentityUserLookupService : IUserLookupService, ITransientDependency + { + private readonly IIdentityUserAppService _userAppService; + + public HttpClientIdentityUserLookupService(IIdentityUserAppService userAppService) + { + _userAppService = userAppService; + } + + public async Task FindUserByIdAsync(Guid id) + { + //TODO: Should return null if not found! + return (await _userAppService.GetAsync(id)).ToUserInfo(); + } + + public async Task FindUserByUserNameAsync(string userName) + { + //TODO: Should return null if not found! + //TODO: Search by UserName, not by a general filter! + return (await _userAppService.GetListAsync(new GetIdentityUsersInput { Filter = userName })).Items.FirstOrDefault()?.ToUserInfo(); + } + } +} diff --git a/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/IdentityUserExtensions.cs b/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/IdentityUserExtensions.cs new file mode 100644 index 0000000000..8cc10fe85a --- /dev/null +++ b/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/IdentityUserExtensions.cs @@ -0,0 +1,19 @@ +using Volo.Abp.Users; + +namespace Volo.Abp.Identity +{ + public static class IdentityUserDtoExtensions + { + public static IUserInfo ToUserInfo(this IdentityUserDto user) + { + return new UserInfo( + user.Id, + user.UserName, + user.Email, + user.EmailConfirmed, + user.PhoneNumber, + user.PhoneNumberConfirmed + ); + } + } +} diff --git a/src/Volo.Abp.Session/Volo.Abp.Session.csproj b/src/Volo.Abp.Users/Volo.Abp.Users.csproj similarity index 88% rename from src/Volo.Abp.Session/Volo.Abp.Session.csproj rename to src/Volo.Abp.Users/Volo.Abp.Users.csproj index 894c8abb5d..ae2e0bf249 100644 --- a/src/Volo.Abp.Session/Volo.Abp.Session.csproj +++ b/src/Volo.Abp.Users/Volo.Abp.Users.csproj @@ -4,8 +4,8 @@ netstandard2.0 - Volo.Abp.Session - Volo.Abp.Session + Volo.Abp.Users + Volo.Abp.Users $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false diff --git a/src/Volo.Abp.Users/Volo.Abp.Users.csproj.DotSettings b/src/Volo.Abp.Users/Volo.Abp.Users.csproj.DotSettings new file mode 100644 index 0000000000..58ad6c8854 --- /dev/null +++ b/src/Volo.Abp.Users/Volo.Abp.Users.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp71 \ No newline at end of file diff --git a/src/Volo.Abp.Session/Volo/Abp/Settings/UserSettingManagerExtensions.cs b/src/Volo.Abp.Users/Volo/Abp/Settings/UserSettingManagerExtensions.cs similarity index 98% rename from src/Volo.Abp.Session/Volo/Abp/Settings/UserSettingManagerExtensions.cs rename to src/Volo.Abp.Users/Volo/Abp/Settings/UserSettingManagerExtensions.cs index 8239d92e7a..4e3a1dd574 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Settings/UserSettingManagerExtensions.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Settings/UserSettingManagerExtensions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using JetBrains.Annotations; -using Volo.Abp.Session; +using Volo.Abp.Users; namespace Volo.Abp.Settings { diff --git a/src/Volo.Abp.Session/Volo/Abp/Session/AbpSessionModule.cs b/src/Volo.Abp.Users/Volo/Abp/Users/AbpUsersModule.cs similarity index 79% rename from src/Volo.Abp.Session/Volo/Abp/Session/AbpSessionModule.cs rename to src/Volo.Abp.Users/Volo/Abp/Users/AbpUsersModule.cs index 33cc5e2a88..c1a84bd44f 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Session/AbpSessionModule.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Users/AbpUsersModule.cs @@ -3,11 +3,11 @@ using Volo.Abp.Modularity; using Volo.Abp.Security; using Volo.Abp.Settings; -namespace Volo.Abp.Session +namespace Volo.Abp.Users { [DependsOn(typeof(AbpSecurityModule))] [DependsOn(typeof(AbpSettingsModule))] - public class AbpSessionModule : AbpModule + public class AbpUsersModule : AbpModule { public override void ConfigureServices(IServiceCollection services) { @@ -16,7 +16,7 @@ namespace Volo.Abp.Session options.ValueProviders.Add(); }); - services.AddAssemblyOf(); + services.AddAssemblyOf(); } } } diff --git a/src/Volo.Abp.Session/Volo/Abp/Session/CurrentUser.cs b/src/Volo.Abp.Users/Volo/Abp/Users/CurrentUser.cs similarity index 98% rename from src/Volo.Abp.Session/Volo/Abp/Session/CurrentUser.cs rename to src/Volo.Abp.Users/Volo/Abp/Users/CurrentUser.cs index 88ede57c44..abcde115ab 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Session/CurrentUser.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Users/CurrentUser.cs @@ -4,7 +4,7 @@ using System.Security.Claims; using Volo.Abp.DependencyInjection; using Volo.Abp.Security.Claims; -namespace Volo.Abp.Session +namespace Volo.Abp.Users { public class CurrentUser : ICurrentUser, ITransientDependency { diff --git a/src/Volo.Abp.Session/Volo/Abp/Session/CurrentUserExtensions.cs b/src/Volo.Abp.Users/Volo/Abp/Users/CurrentUserExtensions.cs similarity index 95% rename from src/Volo.Abp.Session/Volo/Abp/Session/CurrentUserExtensions.cs rename to src/Volo.Abp.Users/Volo/Abp/Users/CurrentUserExtensions.cs index 1ddaa2af7b..d6c1054936 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Session/CurrentUserExtensions.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Users/CurrentUserExtensions.cs @@ -1,7 +1,7 @@ using System; using JetBrains.Annotations; -namespace Volo.Abp.Session +namespace Volo.Abp.Users { public static class CurrentUserExtensions { diff --git a/src/Volo.Abp.Session/Volo/Abp/Session/ICurrentUser.cs b/src/Volo.Abp.Users/Volo/Abp/Users/ICurrentUser.cs similarity index 96% rename from src/Volo.Abp.Session/Volo/Abp/Session/ICurrentUser.cs rename to src/Volo.Abp.Users/Volo/Abp/Users/ICurrentUser.cs index 12da47fba0..46bcb7d308 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Session/ICurrentUser.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Users/ICurrentUser.cs @@ -2,7 +2,7 @@ using System.Security.Claims; using JetBrains.Annotations; -namespace Volo.Abp.Session +namespace Volo.Abp.Users { public interface ICurrentUser { diff --git a/src/Volo.Abp.Users/Volo/Abp/Users/IUserInfo.cs b/src/Volo.Abp.Users/Volo/Abp/Users/IUserInfo.cs new file mode 100644 index 0000000000..f2b8940319 --- /dev/null +++ b/src/Volo.Abp.Users/Volo/Abp/Users/IUserInfo.cs @@ -0,0 +1,22 @@ +using System; +using JetBrains.Annotations; + +namespace Volo.Abp.Users +{ + public interface IUserInfo + { + Guid Id { get; } + + string UserName { get; } + + [CanBeNull] + string Email { get; } + + bool EmailConfirmed { get; } + + [CanBeNull] + string PhoneNumber { get; } + + bool PhoneNumberConfirmed { get; } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.Users/Volo/Abp/Users/IUserLookupService.cs b/src/Volo.Abp.Users/Volo/Abp/Users/IUserLookupService.cs new file mode 100644 index 0000000000..5c2b43161b --- /dev/null +++ b/src/Volo.Abp.Users/Volo/Abp/Users/IUserLookupService.cs @@ -0,0 +1,14 @@ +using System; +using System.Threading.Tasks; + +namespace Volo.Abp.Users +{ + public interface IUserLookupService + { + Task FindUserByIdAsync(Guid id); + + Task FindUserByUserNameAsync(string userName); + + //TODO: Searching users... + } +} diff --git a/src/Volo.Abp.Users/Volo/Abp/Users/NullUserLookupService.cs b/src/Volo.Abp.Users/Volo/Abp/Users/NullUserLookupService.cs new file mode 100644 index 0000000000..b16e52a704 --- /dev/null +++ b/src/Volo.Abp.Users/Volo/Abp/Users/NullUserLookupService.cs @@ -0,0 +1,21 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Users +{ + public class NullUserLookupService : IUserLookupService, ISingletonDependency + { + private static readonly Task NullUserResult = Task.FromResult((IUserInfo) null); + + public Task FindUserByIdAsync(Guid id) + { + return NullUserResult; + } + + public Task FindUserByUserNameAsync(string userName) + { + return NullUserResult; + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.Users/Volo/Abp/Users/UserInfo.cs b/src/Volo.Abp.Users/Volo/Abp/Users/UserInfo.cs new file mode 100644 index 0000000000..49eae3c878 --- /dev/null +++ b/src/Volo.Abp.Users/Volo/Abp/Users/UserInfo.cs @@ -0,0 +1,38 @@ +using System; +using JetBrains.Annotations; + +namespace Volo.Abp.Users +{ + public class UserInfo : IUserInfo + { + public Guid Id { get; } + + public string UserName { get; } + + public string Email { get; } + + public bool EmailConfirmed { get; } + + public string PhoneNumber { get; } + + public bool PhoneNumberConfirmed { get; } + + public UserInfo( + Guid id, + [NotNull] string userName, + [CanBeNull] string email = null, + bool emailConfirmed = false, + [CanBeNull] string phoneNumber = null, + bool phoneNumberConfirmed = false) + { + Check.NotNull(userName, nameof(userName)); + + Id = id; + UserName = userName; + Email = email; + EmailConfirmed = emailConfirmed; + PhoneNumber = phoneNumber; + PhoneNumberConfirmed = phoneNumberConfirmed; + } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.Session/Volo/Abp/Session/UserSettingValueProvider.cs b/src/Volo.Abp.Users/Volo/Abp/Users/UserSettingValueProvider.cs similarity index 98% rename from src/Volo.Abp.Session/Volo/Abp/Session/UserSettingValueProvider.cs rename to src/Volo.Abp.Users/Volo/Abp/Users/UserSettingValueProvider.cs index 87217d3478..0a0c08bd99 100644 --- a/src/Volo.Abp.Session/Volo/Abp/Session/UserSettingValueProvider.cs +++ b/src/Volo.Abp.Users/Volo/Abp/Users/UserSettingValueProvider.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Volo.Abp.Settings; -namespace Volo.Abp.Session +namespace Volo.Abp.Users { //TODO: Optimization: Get all settings and cache it! diff --git a/test/Volo.Abp.Permissions.Tests/Volo.Abp.Permissions.Tests.csproj b/test/Volo.Abp.Permissions.Tests/Volo.Abp.Permissions.Tests.csproj index 4ef6ebf992..b2043b55fb 100644 --- a/test/Volo.Abp.Permissions.Tests/Volo.Abp.Permissions.Tests.csproj +++ b/test/Volo.Abp.Permissions.Tests/Volo.Abp.Permissions.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/AbpPermissionTestModule.cs b/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/AbpPermissionTestModule.cs index ea77e715b4..a9c3759785 100644 --- a/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/AbpPermissionTestModule.cs +++ b/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/AbpPermissionTestModule.cs @@ -6,14 +6,14 @@ using Volo.Abp.Autofac; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.Permissions.EntityFrameworkCore; -using Volo.Abp.Session; using Volo.Abp.Uow; +using Volo.Abp.Users; namespace Volo.Abp.Permissions { [DependsOn( typeof(AbpPermissionsEntityFrameworkCoreModule), - typeof(AbpSessionModule), + typeof(AbpUsersModule), typeof(AbpAutofacModule))] public class AbpPermissionTestModule : AbpModule { diff --git a/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionTestBase.cs b/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionTestBase.cs index f997a3e066..d94784a2fc 100644 --- a/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionTestBase.cs +++ b/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionTestBase.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Volo.Abp.Permissions.EntityFrameworkCore; -using Volo.Abp.Session; +using Volo.Abp.Users; namespace Volo.Abp.Permissions { diff --git a/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj b/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj index 081e8358c7..6a15d99742 100644 --- a/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj +++ b/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj @@ -13,8 +13,8 @@ - + diff --git a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/AbpSettingsTestModule.cs b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/AbpSettingsTestModule.cs index 19f0bd3878..7fe5f0168d 100644 --- a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/AbpSettingsTestModule.cs +++ b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/AbpSettingsTestModule.cs @@ -4,15 +4,15 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Autofac; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; -using Volo.Abp.Session; using Volo.Abp.Settings.EntityFrameworkCore; using Volo.Abp.Uow; +using Volo.Abp.Users; namespace Volo.Abp.Settings { [DependsOn( typeof(AbpSettingsEntityFrameworkCoreModule), - typeof(AbpSessionModule), + typeof(AbpUsersModule), typeof(AbpAutofacModule))] public class AbpSettingsTestModule : AbpModule { diff --git a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_User_Tests.cs b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_User_Tests.cs index f861bddad6..e8f7df0c88 100644 --- a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_User_Tests.cs +++ b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingManager_User_Tests.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using NSubstitute; using Shouldly; -using Volo.Abp.Session; +using Volo.Abp.Users; using Xunit; namespace Volo.Abp.Settings diff --git a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingTestDataBuilder.cs b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingTestDataBuilder.cs index b535bab045..aa72c65647 100644 --- a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingTestDataBuilder.cs +++ b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingTestDataBuilder.cs @@ -1,7 +1,7 @@ using System; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; -using Volo.Abp.Session; +using Volo.Abp.Users; namespace Volo.Abp.Settings { diff --git a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingsTestBase.cs b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingsTestBase.cs index 79ab98672c..7e005acdb6 100644 --- a/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingsTestBase.cs +++ b/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingsTestBase.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Volo.Abp.Session; using Volo.Abp.Settings.EntityFrameworkCore; +using Volo.Abp.Users; namespace Volo.Abp.Settings {