Moved Abp.Users to another module.

pull/272/head
Halil İbrahim Kalkan 7 years ago
parent fb3a05730a
commit 9f51b41ae0

@ -162,8 +162,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ddd.Domain", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ddd.Application", "src\Volo.Abp.Ddd.Application\Volo.Abp.Ddd.Application.csproj", "{5AB7E368-1CC8-401D-9952-6CA6779305E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Users", "src\Volo.Abp.Users\Volo.Abp.Users.csproj", "{DAE9088E-6E30-4D5D-9DF8-2188E8D386FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Auditing", "src\Volo.Abp.Auditing\Volo.Abp.Auditing.csproj", "{03F51721-DA51-4BAE-9909-3FC88FAB7774}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Auditing.Tests", "test\Volo.Abp.Auditing.Tests\Volo.Abp.Auditing.Tests.csproj", "{D5733D90-8C3D-4026-85E2-41DED26C4938}"
@ -454,10 +452,6 @@ 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
{03F51721-DA51-4BAE-9909-3FC88FAB7774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03F51721-DA51-4BAE-9909-3FC88FAB7774}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03F51721-DA51-4BAE-9909-3FC88FAB7774}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -543,7 +537,6 @@ Global
{9FC49D82-04E5-4170-8618-682BD3350910} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{D1318094-7907-4826-B5F3-CFFC741F235F} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{5AB7E368-1CC8-401D-9952-6CA6779305E7} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{DAE9088E-6E30-4D5D-9DF8-2188E8D386FE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{03F51721-DA51-4BAE-9909-3FC88FAB7774} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{D5733D90-8C3D-4026-85E2-41DED26C4938} = {447C8A77-E5F0-4538-8687-7383196D04EA}
EndGlobalSection

@ -16,8 +16,8 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy.Abstractions\Volo.Abp.MultiTenancy.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.Timing\Volo.Abp.Timing.csproj" />
<ProjectReference Include="..\Volo.Abp.Users\Volo.Abp.Users.csproj" />
</ItemGroup>
</Project>

@ -2,8 +2,8 @@
using Volo.Abp.Data;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security;
using Volo.Abp.Timing;
using Volo.Abp.Users;
namespace Volo.Abp.Auditing
{
@ -11,7 +11,7 @@ namespace Volo.Abp.Auditing
[DependsOn(
typeof(AbpDataModule),
typeof(AbpTimingModule),
typeof(AbpUsersModule),
typeof(AbpSecurityModule),
typeof(AbpMultiTenancyAbstractionsModule)
)]
public class AbpAuditingModule : AbpModule

@ -56,11 +56,14 @@ namespace Microsoft.Extensions.Logging
}
}
public static void LogException(this ILogger logger, Exception ex)
public static void LogException(this ILogger logger, Exception ex, LogLevel? level = null)
{
var logLevel = (ex as IHasLogLevel)?.LogLevel ?? LogLevel.Error;
logger.LogWithLevel(
level ?? (ex as IHasLogLevel)?.LogLevel ?? LogLevel.Error,
ex.Message,
ex
);
logger.LogWithLevel(logLevel, ex.Message, ex);
LogDetails(logger, ex);
}

@ -19,7 +19,7 @@
<ProjectReference Include="..\Volo.Abp.Ddd.Domain\Volo.Abp.Ddd.Domain.csproj" />
<ProjectReference Include="..\Volo.Abp.Http.Abstractions\Volo.Abp.Http.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.ObjectMapping\Volo.Abp.ObjectMapping.csproj" />
<ProjectReference Include="..\Volo.Abp.Users\Volo.Abp.Users.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.Validation\Volo.Abp.Validation.csproj" />
</ItemGroup>

@ -7,13 +7,13 @@ using Volo.Abp.Http;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Users;
using Volo.Abp.Security;
using Volo.Abp.Validation;
namespace Volo.Abp.Application
{
[DependsOn(typeof(AbpDddDomainModule))]
[DependsOn(typeof(AbpUsersModule))]
[DependsOn(typeof(AbpSecurityModule))]
[DependsOn(typeof(AbpObjectMappingModule))]
[DependsOn(typeof(AbpValidationModule))]
[DependsOn(typeof(AbpAuthorizationModule))]

@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.Users</AssemblyName>
<PackageId>Volo.Abp.Users</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.Settings\Volo.Abp.Settings.csproj" />
</ItemGroup>
</Project>

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary>

@ -1,43 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Volo.Abp.Users;
namespace Volo.Abp.Settings
{
//TODO: Consider to move to another package?
public static class UserSettingManagerExtensions
{
public static Task<string> GetOrNullForUserAsync(this ISettingManager settingManager, [NotNull] string name, Guid userId, bool fallback = true)
{
return settingManager.GetOrNullAsync(name, UserSettingValueProvider.ProviderName, userId.ToString(), fallback);
}
public static Task<string> GetOrNullForCurrentUserAsync(this ISettingManager settingManager, [NotNull] string name, bool fallback = true)
{
return settingManager.GetOrNullAsync(name, UserSettingValueProvider.ProviderName, null, fallback);
}
public static Task<List<SettingValue>> GetAllForUserAsync(this ISettingManager settingManager, Guid userId, bool fallback = true)
{
return settingManager.GetAllAsync(UserSettingValueProvider.ProviderName, userId.ToString(), fallback);
}
public static Task<List<SettingValue>> GetAllForCurrentUserAsync(this ISettingManager settingManager, bool fallback = true)
{
return settingManager.GetAllAsync(UserSettingValueProvider.ProviderName, null, fallback);
}
public static Task SetForUserAsync(this ISettingManager settingManager, Guid userId, [NotNull] string name, [CanBeNull] string value, bool forceToSet = false)
{
return settingManager.SetAsync(name, value, UserSettingValueProvider.ProviderName, userId.ToString(), forceToSet);
}
public static Task SetForCurrentUserAsync(this ISettingManager settingManager, [NotNull] string name, [CanBeNull] string value, bool forceToSet = false)
{
return settingManager.SetAsync(name, value, UserSettingValueProvider.ProviderName, null, forceToSet);
}
}
}

@ -1,22 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Security;
using Volo.Abp.Settings;
namespace Volo.Abp.Users
{
[DependsOn(typeof(AbpSecurityModule))]
[DependsOn(typeof(AbpSettingsModule))]
public class AbpUsersModule : AbpModule
{
public override void ConfigureServices(IServiceCollection services)
{
services.Configure<SettingOptions>(options =>
{
options.ValueProviders.Add<UserSettingValueProvider>();
});
services.AddAssemblyOf<AbpUsersModule>();
}
}
}

@ -1,22 +0,0 @@
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; }
}
}

@ -1,14 +0,0 @@
using System;
using System.Threading.Tasks;
namespace Volo.Abp.Users
{
public interface IUserLookupService
{
Task<IUserInfo> FindByIdAsync(Guid id);
Task<IUserInfo> FindByUserNameAsync(string userName);
//TODO: Searching users...
}
}

@ -1,21 +0,0 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Users
{
public class NullUserLookupService : IUserLookupService, ISingletonDependency
{
private static readonly Task<IUserInfo> NullUserResult = Task.FromResult((IUserInfo) null);
public Task<IUserInfo> FindByIdAsync(Guid id)
{
return NullUserResult;
}
public Task<IUserInfo> FindByUserNameAsync(string userName)
{
return NullUserResult;
}
}
}

@ -1,38 +0,0 @@
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;
}
}
}

@ -1,47 +0,0 @@
using System.Threading.Tasks;
using Volo.Abp.Settings;
namespace Volo.Abp.Users
{
//TODO: Optimization: Get all settings and cache it!
public class UserSettingValueProvider : SettingValueProvider
{
public const string ProviderName = "User";
public override string Name => ProviderName;
protected ICurrentUser CurrentUser { get; }
public UserSettingValueProvider(ISettingStore settingStore, ICurrentUser currentUser)
: base(settingStore)
{
CurrentUser = currentUser;
}
public override async Task<string> GetOrNullAsync(SettingDefinition setting, string providerKey)
{
if (providerKey == null)
{
if (CurrentUser.Id == null)
{
return null;
}
providerKey = CurrentUser.Id.ToString();
}
return await SettingStore.GetOrNullAsync(setting.Name, Name, providerKey);
}
public override Task SetAsync(SettingDefinition setting, string value, string providerKey)
{
return SettingStore.SetAsync(setting.Name, value, Name, providerKey);
}
public override Task ClearAsync(SettingDefinition setting, string providerKey)
{
return SettingStore.DeleteAsync(setting.Name, Name, providerKey);
}
}
}
Loading…
Cancel
Save