mirror of https://github.com/abpframework/abp.git
626 changed files with 65540 additions and 3348 deletions
@ -0,0 +1,26 @@ |
|||||
|
# Nightly Builds |
||||
|
|
||||
|
All framework & module packages are deployed to MyGet every night in weekdays. So, you can use or test the latest code without waiting the next release. |
||||
|
|
||||
|
## Configure Visual Studio |
||||
|
|
||||
|
> Requires Visual Studio 2017+ |
||||
|
|
||||
|
1. Go to `Tools > Options > NuGet Package Manager > Package Source`. |
||||
|
2. Click the green `+` icon. |
||||
|
3. Set `ABP Nightly` as *Name* and `https://www.myget.org/F/abp-nightly/api/v3/index.json` as the *Source* as shown below: |
||||
|
 |
||||
|
4. Click the `Update` button. |
||||
|
5. Click the `OK` button to save changes. |
||||
|
|
||||
|
## Install Package |
||||
|
|
||||
|
Now, you can install preview / nightly packages to your project from Nuget Browser or Package Manager Console. |
||||
|
|
||||
|
 |
||||
|
|
||||
|
1. In the nuget browser, select "Include prereleases". |
||||
|
2. Change package source to "All". |
||||
|
3. Search a package. You will see prereleases of the package formatted as `(VERSION)-preview(DATE)` (like *v0.16.0-preview20190401* in this sample). |
||||
|
4. You can click to the `Install` button to add package to your project. |
||||
|
|
||||
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 29 KiB |
@ -1,9 +1,11 @@ |
|||||
{ |
{ |
||||
"culture": "pt-BR", |
"culture": "pt-BR", |
||||
"texts": { |
"texts": { |
||||
"GivenTenantIsNotAvailable": "Tenant não está disponível: {0}", |
"GivenTenantIsNotAvailable": "Inquilino não está disponível: {0}", |
||||
"SwitchTenant": "Trocar tenant", |
"Tenant": "Inquilino", |
||||
|
"Switch": "trocar", |
||||
"Name": "Nome", |
"Name": "Nome", |
||||
"SwitchTenantHint": "Deixe o campo de nome em branco para alternar para o lado do host." |
"SwitchTenantHint": "Deixe o campo de nome em branco para alternar para o lado do host.", |
||||
|
"NotSelected": "Não selecionado" |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.Caching |
||||
|
{ |
||||
|
public interface IDistributedCacheSerializer |
||||
|
{ |
||||
|
byte[] Serialize<T>(T obj); |
||||
|
|
||||
|
T Deserialize<T>(byte[] bytes); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
using System.Text; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Json; |
||||
|
|
||||
|
namespace Volo.Abp.Caching |
||||
|
{ |
||||
|
public class Utf8JsonDistributedCacheSerializer : IDistributedCacheSerializer, ITransientDependency |
||||
|
{ |
||||
|
protected IJsonSerializer JsonSerializer { get; } |
||||
|
|
||||
|
public Utf8JsonDistributedCacheSerializer(IJsonSerializer jsonSerializer) |
||||
|
{ |
||||
|
JsonSerializer = jsonSerializer; |
||||
|
} |
||||
|
|
||||
|
public byte[] Serialize<T>(T obj) |
||||
|
{ |
||||
|
return Encoding.UTF8.GetBytes(JsonSerializer.Serialize(obj)); |
||||
|
} |
||||
|
|
||||
|
public T Deserialize<T>(byte[] bytes) |
||||
|
{ |
||||
|
return (T)JsonSerializer.Deserialize(typeof(T), Encoding.UTF8.GetString(bytes)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,18 +1,14 @@ |
|||||
namespace Volo.Abp.Emailing |
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Volo.Abp.Emailing |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Defines configurations used while sending emails.
|
/// Defines configurations used while sending emails.
|
||||
/// </summary>
|
/// </summary>
|
||||
public interface IEmailSenderConfiguration |
public interface IEmailSenderConfiguration |
||||
{ |
{ |
||||
/// <summary>
|
Task<string> GetDefaultFromAddressAsync(); |
||||
/// Default from address.
|
|
||||
/// </summary>
|
|
||||
string DefaultFromAddress { get; } |
|
||||
|
|
||||
/// <summary>
|
Task<string> GetDefaultFromDisplayNameAsync(); |
||||
/// Default display name.
|
|
||||
/// </summary>
|
|
||||
string DefaultFromDisplayName { get; } |
|
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using System.Security.Claims; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace System.Security.Principal |
||||
|
{ |
||||
|
public static class AbpMultiTenancyClaimsIdentityExtensions |
||||
|
{ |
||||
|
public static MultiTenancySides GetMultiTenancySide([NotNull] this IIdentity identity) |
||||
|
{ |
||||
|
var tenantId = identity.FindTenantId(); |
||||
|
return tenantId.HasValue |
||||
|
? MultiTenancySides.Tenant |
||||
|
: MultiTenancySides.Host; |
||||
|
} |
||||
|
|
||||
|
public static MultiTenancySides GetMultiTenancySide([NotNull] this ClaimsPrincipal principal) |
||||
|
{ |
||||
|
var tenantId = principal.FindTenantId(); |
||||
|
return tenantId.HasValue |
||||
|
? MultiTenancySides.Tenant |
||||
|
: MultiTenancySides.Host; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,28 +0,0 @@ |
|||||
using System.Linq; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Security.Claims; |
|
||||
|
|
||||
namespace Volo.Abp.MultiTenancy |
|
||||
{ |
|
||||
public class CurrentClaimsPrincipalTenantResolveContributor : TenantResolveContributorBase |
|
||||
{ |
|
||||
public const string ContributorName = "CurrentClaims"; |
|
||||
|
|
||||
public override string Name => ContributorName; |
|
||||
|
|
||||
public override void Resolve(ITenantResolveContext context) |
|
||||
{ |
|
||||
var principal = context.ServiceProvider.GetRequiredService<ICurrentPrincipalAccessor>().Principal; |
|
||||
if (principal?.Identity?.IsAuthenticated != true) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
context.Handled = true; |
|
||||
context.TenantIdOrName = principal |
|
||||
.Claims |
|
||||
.FirstOrDefault(c => c.Type == AbpClaimTypes.TenantId) |
|
||||
?.Value; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,24 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Volo.Abp.MultiTenancy |
||||
|
{ |
||||
|
public class CurrentUserTenantResolveContributor : TenantResolveContributorBase |
||||
|
{ |
||||
|
public const string ContributorName = "CurrentUser"; |
||||
|
|
||||
|
public override string Name => ContributorName; |
||||
|
|
||||
|
public override void Resolve(ITenantResolveContext context) |
||||
|
{ |
||||
|
var currentUser = context.ServiceProvider.GetRequiredService<ICurrentUser>(); |
||||
|
if (currentUser.IsAuthenticated != true) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
context.Handled = true; |
||||
|
context.TenantIdOrName = currentUser.TenantId?.ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,9 +1,10 @@ |
|||||
using Volo.Abp.MultiTenancy; |
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.AspNetCore.MultiTenancy |
namespace Volo.Abp.MultiTenancy |
||||
{ |
{ |
||||
public interface ITenantResolveResultAccessor |
public interface ITenantResolveResultAccessor |
||||
{ |
{ |
||||
|
[CanBeNull] |
||||
TenantResolveResult Result { get; set; } |
TenantResolveResult Result { get; set; } |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.Abp.MultiTenancy |
||||
|
{ |
||||
|
public class NullTenantResolveResultAccessor : ITenantResolveResultAccessor, ISingletonDependency |
||||
|
{ |
||||
|
public TenantResolveResult Result |
||||
|
{ |
||||
|
get => null; |
||||
|
set { } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,9 +1,10 @@ |
|||||
using JetBrains.Annotations; |
using System.Threading.Tasks; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
namespace Volo.Abp.Ui.Navigation.Urls |
namespace Volo.Abp.Ui.Navigation.Urls |
||||
{ |
{ |
||||
public interface IAppUrlProvider |
public interface IAppUrlProvider |
||||
{ |
{ |
||||
string GetUrl([NotNull] string appName, [CanBeNull] string urlName = null); |
Task<string> GetUrlAsync([NotNull] string appName, [CanBeNull] string urlName = null); |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,6 +1,7 @@ |
|||||
{ |
{ |
||||
"culture": "pt-BR", |
"culture": "pt-BR", |
||||
"texts": { |
"texts": { |
||||
"BirthDate": "Aniversário" |
"BirthDate": "Aniversário", |
||||
|
"Value1": "Valor Um" |
||||
} |
} |
||||
} |
} |
||||
@ -1,6 +1,7 @@ |
|||||
{ |
{ |
||||
"culture": "en", |
"culture": "en", |
||||
"texts": { |
"texts": { |
||||
"USA": "United States of America" |
"USA": "United States of America", |
||||
|
"Brazil": "Brasil" |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Volo.Abp.AuditLogging.EntityFrameworkCore |
||||
|
{ |
||||
|
public class AuditLogRepository_Tests : AuditLogRepository_Tests<AbpAuditLoggingEntityFrameworkCoreTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Volo.Abp.AuditLogging.MongoDB |
||||
|
{ |
||||
|
public class AuditLogRepository_Tests : AuditLogRepository_Tests<AbpAuditLoggingMongoDbTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,232 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Net; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Volo.Abp.Auditing; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.AuditLogging |
||||
|
{ |
||||
|
public abstract class AuditLogRepository_Tests<TStartupModule> : AuditLoggingTestBase<TStartupModule> |
||||
|
where TStartupModule : IAbpModule |
||||
|
{ |
||||
|
protected IAuditLogRepository AuditLogRepository { get; } |
||||
|
protected IGuidGenerator GuidGenerator { get; } |
||||
|
|
||||
|
protected AuditLogRepository_Tests() |
||||
|
{ |
||||
|
AuditLogRepository = GetRequiredService<IAuditLogRepository>(); |
||||
|
GuidGenerator = GetRequiredService<IGuidGenerator>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task GetListAsync() |
||||
|
{ |
||||
|
// Arrange
|
||||
|
var userId = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06"); |
||||
|
var userId2 = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06"); |
||||
|
var ipAddress = "153.1.7.61"; |
||||
|
var firstComment = "first Comment"; |
||||
|
|
||||
|
var log1 = new AuditLogInfo |
||||
|
{ |
||||
|
UserId = userId, |
||||
|
ImpersonatorUserId = Guid.NewGuid(), |
||||
|
ImpersonatorTenantId = Guid.NewGuid(), |
||||
|
ExecutionTime = DateTime.Today, |
||||
|
ExecutionDuration = 42, |
||||
|
ClientIpAddress = ipAddress, |
||||
|
ClientName = "MyDesktop", |
||||
|
BrowserInfo = "Chrome", |
||||
|
Comments = new List<string> { firstComment, "Second Comment" }, |
||||
|
UserName = "Douglas", |
||||
|
EntityChanges = { |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
var log2 = new AuditLogInfo |
||||
|
{ |
||||
|
UserId = userId2, |
||||
|
ImpersonatorUserId = Guid.NewGuid(), |
||||
|
ImpersonatorTenantId = Guid.NewGuid(), |
||||
|
ExecutionTime = DateTime.Today, |
||||
|
ExecutionDuration = 42, |
||||
|
ClientIpAddress = ipAddress, |
||||
|
ClientName = "MyDesktop", |
||||
|
BrowserInfo = "Chrome", |
||||
|
Comments = new List<string> { firstComment, "Second Comment" }, |
||||
|
HttpStatusCode = (int?)HttpStatusCode.BadGateway, |
||||
|
EntityChanges = { |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
AuditLogRepository.Insert(new AuditLog(GuidGenerator, log1)); |
||||
|
AuditLogRepository.Insert(new AuditLog(GuidGenerator, log2)); |
||||
|
|
||||
|
//Assert
|
||||
|
var logs = await AuditLogRepository.GetListAsync(); |
||||
|
logs.ShouldNotBeNull(); |
||||
|
logs.ShouldContain(x => x.UserId == userId); |
||||
|
logs.ShouldContain(x => x.UserId == userId2); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task GetCountAsync() |
||||
|
{ |
||||
|
// Arrange
|
||||
|
var userId = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06"); |
||||
|
var userId2 = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06"); |
||||
|
var ipAddress = "153.1.7.61"; |
||||
|
var firstComment = "first Comment"; |
||||
|
|
||||
|
var log1 = new AuditLogInfo |
||||
|
{ |
||||
|
UserId = userId, |
||||
|
ImpersonatorUserId = Guid.NewGuid(), |
||||
|
ImpersonatorTenantId = Guid.NewGuid(), |
||||
|
ExecutionTime = DateTime.Today, |
||||
|
ExecutionDuration = 42, |
||||
|
ClientIpAddress = ipAddress, |
||||
|
ClientName = "MyDesktop", |
||||
|
BrowserInfo = "Chrome", |
||||
|
Comments = new List<string> { firstComment, "Second Comment" }, |
||||
|
UserName = "Douglas", |
||||
|
EntityChanges = { |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
var log2 = new AuditLogInfo |
||||
|
{ |
||||
|
UserId = userId2, |
||||
|
ImpersonatorUserId = Guid.NewGuid(), |
||||
|
ImpersonatorTenantId = Guid.NewGuid(), |
||||
|
ExecutionTime = DateTime.Today, |
||||
|
ExecutionDuration = 42, |
||||
|
ClientIpAddress = ipAddress, |
||||
|
ClientName = "MyDesktop", |
||||
|
BrowserInfo = "Chrome", |
||||
|
Comments = new List<string> { firstComment, "Second Comment" }, |
||||
|
HttpStatusCode = (int?)HttpStatusCode.BadGateway, |
||||
|
EntityChanges = { |
||||
|
new EntityChangeInfo |
||||
|
{ |
||||
|
EntityId = Guid.NewGuid().ToString(), |
||||
|
EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", |
||||
|
ChangeType = EntityChangeType.Created, |
||||
|
ChangeTime = DateTime.Now, |
||||
|
PropertyChanges = new List<EntityPropertyChangeInfo> |
||||
|
{ |
||||
|
new EntityPropertyChangeInfo |
||||
|
{ |
||||
|
PropertyTypeFullName = typeof(string).FullName, |
||||
|
PropertyName = "Name", |
||||
|
NewValue = "New value", |
||||
|
OriginalValue = null |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
AuditLogRepository.Insert(new AuditLog(GuidGenerator, log1)); |
||||
|
AuditLogRepository.Insert(new AuditLog(GuidGenerator, log2)); |
||||
|
|
||||
|
//Assert
|
||||
|
var logs = await AuditLogRepository.GetCountAsync(); |
||||
|
logs.ShouldBe(2); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace Volo.Abp.AuditLogging |
||||
|
{ |
||||
|
public class AuditLogging_Repository_Resolve_Tests<TStartupModule> : AuditLoggingTestBase<TStartupModule> |
||||
|
where TStartupModule : IAbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue