Browse Source

Merge branch 'master' of https://github.com/volosoft/abp

pull/977/head
Yunus Emre Kalkan 7 years ago
parent
commit
aa9fc92d69
  1. 4
      abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/HomePageLayout.cshtml
  2. 4
      abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/Layout.cshtml
  3. 4
      abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/LayoutEmpty.cshtml
  4. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
  5. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
  6. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
  7. 20
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs
  8. 1
      framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj
  9. 9
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs
  10. 62
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
  11. 9
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheSerializer.cs
  12. 26
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/Utf8JsonDistributedCacheSerializer.cs
  13. 4
      framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
  14. 25
      framework/src/Volo.Abp.MultiTenancy/System/Security/Principal/AbpClaimsIdentityExtensions.cs
  15. 4
      framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/_Layout.cshtml
  16. 22
      modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs
  17. 2
      modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
  18. 9
      modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs
  19. 3
      modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestPermissionDefinitionProvider.cs
  20. 16
      modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs
  21. 1227
      samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190404130536_Make_IDS4_Entities_Audited.Designer.cs
  22. 347
      samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190404130536_Make_IDS4_Entities_Audited.cs
  23. 87
      samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs

4
abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/HomePageLayout.cshtml

@ -17,7 +17,7 @@
<title>@(ViewBag.Title == null ? "abp.io" : ViewBag.Title)</title>
@await Component.InvokeAsync(typeof(StandardMetaViewComponent))
<abp-style-bundle name="@AbpIoBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body>
@ -47,7 +47,7 @@
gtag('config', 'UA-49982725-4');
</script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

4
abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/Layout.cshtml

@ -17,7 +17,7 @@
<title>@(ViewBag.Title == null ? "abp.io" : ViewBag.Title)</title>
@await Component.InvokeAsync(typeof(StandardMetaViewComponent))
<abp-style-bundle name="@AbpIoBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body>
@ -58,7 +58,7 @@
gtag('config', 'UA-49982725-4');
</script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

4
abp_io/src/Volo.AbpWebSite.Web/Pages/Shared/LayoutEmpty.cshtml

@ -18,7 +18,7 @@
<title>@(ViewBag.Title == null ? "abp.io" : ViewBag.Title)</title>
@await Component.InvokeAsync(typeof(StandardMetaViewComponent))
<abp-style-bundle name="@StandardBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body class="abp-empty-layout">
@ -41,7 +41,7 @@
gtag('config', 'UA-49982725-4');
</script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml

@ -33,7 +33,7 @@
<abp-style-bundle name="@BasicThemeBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body class="abp-account-layout">
@ -71,7 +71,7 @@
<script type="text/javascript" src="~/Abp/ApplicationConfigurationScript"></script>
<script type="text/javascript" src="~/Abp/ServiceProxyScript"></script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml

@ -23,7 +23,7 @@
<abp-style-bundle name="@BasicThemeBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body class="abp-application-layout">
@ -39,7 +39,7 @@
<script type="text/javascript" src="~/Abp/ApplicationConfigurationScript"></script>
<script type="text/javascript" src="~/Abp/ServiceProxyScript"></script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml

@ -22,7 +22,7 @@
<abp-style-bundle name="@BasicThemeBundles.Styles.Global" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body class="abp-empty-layout">
@ -36,7 +36,7 @@
<script type="text/javascript" src="~/Abp/ApplicationConfigurationScript"></script>
<script type="text/javascript" src="~/Abp/ServiceProxyScript"></script>
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

20
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs

@ -4,8 +4,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace Volo.Abp.Authorization.Permissions
@ -18,6 +20,8 @@ namespace Volo.Abp.Authorization.Permissions
protected ICurrentPrincipalAccessor PrincipalAccessor { get; }
protected ICurrentTenant CurrentTenant { get; }
protected PermissionOptions Options { get; }
private readonly Lazy<List<IPermissionValueProvider>> _lazyProviders;
@ -26,10 +30,12 @@ namespace Volo.Abp.Authorization.Permissions
IOptions<PermissionOptions> options,
IServiceProvider serviceProvider,
ICurrentPrincipalAccessor principalAccessor,
IPermissionDefinitionManager permissionDefinitionManager)
IPermissionDefinitionManager permissionDefinitionManager,
ICurrentTenant currentTenant)
{
PrincipalAccessor = principalAccessor;
PermissionDefinitionManager = permissionDefinitionManager;
CurrentTenant = currentTenant;
Options = options.Value;
_lazyProviders = new Lazy<List<IPermissionValueProvider>>(
@ -50,9 +56,17 @@ namespace Volo.Abp.Authorization.Permissions
{
Check.NotNull(name, nameof(name));
var isGranted = false;
var permission = PermissionDefinitionManager.Get(name);
var multiTenancySide = claimsPrincipal?.GetMultiTenancySide()
?? CurrentTenant.GetMultiTenancySide();
if (!permission.MultiTenancySide.HasFlag(multiTenancySide))
{
return false;
}
var isGranted = false;
var context = new PermissionValueCheckContext(permission, claimsPrincipal);
foreach (var provider in ValueProviders)
{

1
framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj

@ -18,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\Volo.Abp.Serialization\Volo.Abp.Serialization.csproj" />
<ProjectReference Include="..\Volo.Abp.Threading\Volo.Abp.Threading.csproj" />

9
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/AbpCachingModule.cs

@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using Volo.Abp.Json;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Serialization;
@ -7,9 +8,11 @@ using Volo.Abp.Threading;
namespace Volo.Abp.Caching
{
[DependsOn(typeof(AbpThreadingModule))]
[DependsOn(typeof(AbpSerializationModule))]
[DependsOn(typeof(AbpMultiTenancyModule))]
[DependsOn(
typeof(AbpThreadingModule),
typeof(AbpSerializationModule),
typeof(AbpMultiTenancyModule),
typeof(AbpJsonModule))]
public class AbpCachingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

62
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

@ -25,11 +25,12 @@ namespace Volo.Abp.Caching
protected ICancellationTokenProvider CancellationTokenProvider { get; }
protected IObjectSerializer ObjectSerializer { get; }
//TODO: Create IDistributedCacheSerializer
protected IDistributedCacheSerializer Serializer { get; }
protected ICurrentTenant CurrentTenant { get; }
protected AsyncLock AsyncLock { get; } = new AsyncLock();
//protected AsyncLock AsyncLock { get; } = new AsyncLock();
protected DistributedCacheEntryOptions DefaultCacheOptions;
@ -42,8 +43,7 @@ namespace Volo.Abp.Caching
IOptions<DistributedCacheOptions> distributedCacheOption,
IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider,
IObjectSerializer objectSerializer,
IDistributedCacheSerializer serializer,
ICurrentTenant currentTenant)
{
_distributedCacheOption = distributedCacheOption.Value;
@ -51,13 +51,15 @@ namespace Volo.Abp.Caching
Cache = cache;
CancellationTokenProvider = cancellationTokenProvider;
Logger = NullLogger<DistributedCache<TCacheItem>>.Instance;
ObjectSerializer = objectSerializer;
Serializer = serializer;
CurrentTenant = currentTenant;
SetDefaultOptions();
}
public virtual TCacheItem Get(string key, bool? hideErrors = null)
public virtual TCacheItem Get(
string key,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -83,10 +85,13 @@ namespace Volo.Abp.Caching
return null;
}
return ObjectSerializer.Deserialize<TCacheItem>(cachedBytes);
return Serializer.Deserialize<TCacheItem>(cachedBytes);
}
public virtual async Task<TCacheItem> GetAsync(string key, bool? hideErrors = null, CancellationToken token = default)
public virtual async Task<TCacheItem> GetAsync(
string key,
bool? hideErrors = null,
CancellationToken token = default)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -115,7 +120,7 @@ namespace Volo.Abp.Caching
return null;
}
return ObjectSerializer.Deserialize<TCacheItem>(cachedBytes);
return Serializer.Deserialize<TCacheItem>(cachedBytes);
}
public TCacheItem GetOrAdd(
@ -130,7 +135,7 @@ namespace Volo.Abp.Caching
return value;
}
using (AsyncLock.Lock(CancellationTokenProvider.Token))
//using (AsyncLock.Lock(CancellationTokenProvider.Token))
{
value = Get(key, hideErrors);
if (value != null)
@ -159,7 +164,7 @@ namespace Volo.Abp.Caching
return value;
}
using (await AsyncLock.LockAsync(token))
//using (await AsyncLock.LockAsync(token))
{
value = await GetAsync(key, hideErrors, token);
if (value != null)
@ -174,7 +179,11 @@ namespace Volo.Abp.Caching
return value;
}
public virtual void Set(string key, TCacheItem value, DistributedCacheEntryOptions options = null, bool? hideErrors = null)
public virtual void Set(
string key,
TCacheItem value,
DistributedCacheEntryOptions options = null,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -182,7 +191,7 @@ namespace Volo.Abp.Caching
{
Cache.Set(
NormalizeKey(key),
ObjectSerializer.Serialize(value),
Serializer.Serialize(value),
options ?? DefaultCacheOptions
);
}
@ -198,7 +207,12 @@ namespace Volo.Abp.Caching
}
}
public virtual async Task SetAsync(string key, TCacheItem value, DistributedCacheEntryOptions options = null, bool? hideErrors = null, CancellationToken token = default)
public virtual async Task SetAsync(
string key,
TCacheItem value,
DistributedCacheEntryOptions options = null,
bool? hideErrors = null,
CancellationToken token = default)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -206,7 +220,7 @@ namespace Volo.Abp.Caching
{
await Cache.SetAsync(
NormalizeKey(key),
ObjectSerializer.Serialize(value),
Serializer.Serialize(value),
options ?? DefaultCacheOptions,
CancellationTokenProvider.FallbackToProvider(token)
);
@ -223,7 +237,9 @@ namespace Volo.Abp.Caching
}
}
public virtual void Refresh(string key, bool? hideErrors = null)
public virtual void Refresh(
string key,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -243,7 +259,10 @@ namespace Volo.Abp.Caching
}
}
public virtual async Task RefreshAsync(string key, bool? hideErrors = null, CancellationToken token = default)
public virtual async Task RefreshAsync(
string key,
bool? hideErrors = null,
CancellationToken token = default)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -263,7 +282,9 @@ namespace Volo.Abp.Caching
}
}
public virtual void Remove(string key, bool? hideErrors = null)
public virtual void Remove(
string key,
bool? hideErrors = null)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;
@ -282,7 +303,10 @@ namespace Volo.Abp.Caching
}
}
public virtual async Task RemoveAsync(string key, bool? hideErrors = null, CancellationToken token = default)
public virtual async Task RemoveAsync(
string key,
bool? hideErrors = null,
CancellationToken token = default)
{
hideErrors = hideErrors ?? _distributedCacheOption.HideErrors;

9
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCacheSerializer.cs

@ -0,0 +1,9 @@
namespace Volo.Abp.Caching
{
public interface IDistributedCacheSerializer
{
byte[] Serialize<T>(T obj);
T Deserialize<T>(byte[] bytes);
}
}

26
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/Utf8JsonDistributedCacheSerializer.cs

@ -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));
}
}
}

4
framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="JetBrains.Annotations" Version="2018.3.0" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="1.0.2" />
<PackageReference Include="Nito.AsyncEx.Context" Version="1.1.0" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.0.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.0.0" />
</ItemGroup>
</Project>

25
framework/src/Volo.Abp.MultiTenancy/System/Security/Principal/AbpClaimsIdentityExtensions.cs

@ -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;
}
}
}

4
framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/_Layout.cshtml

@ -20,7 +20,7 @@
<abp-style-bundle name="@StandardBundles.Styles.Global" />
<link href="~/css/demo.min.css" rel="stylesheet" />
@RenderSection("styles", false)
@await RenderSectionAsync("styles", false)
</head>
<body>
@ -30,7 +30,7 @@
<abp-script-bundle name="@StandardBundles.Scripts.Global" />
@RenderSection("scripts", false)
@await RenderSectionAsync("scripts", false)
</body>
</html>

22
modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs

@ -1,4 +1,7 @@
using Volo.Abp.IdentityServer;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Identity.AspNetCore;
using Volo.Abp.IdentityServer;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
@ -10,12 +13,29 @@ namespace Volo.Abp.Account.Web
)]
public class AbpAccountWebIdentityServerModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.PreConfigure<AbpIdentityAspNetCoreOptions>(options =>
{
options.ConfigureAuthentication = false;
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<VirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpAccountWebIdentityServerModule>("Volo.Abp.Account.Web");
});
//TODO: Try to reuse from AbpIdentityAspNetCoreModule
context.Services
.AddAuthentication(o =>
{
o.DefaultScheme = IdentityConstants.ApplicationScheme;
o.DefaultSignInScheme = IdentityConstants.ExternalScheme;
})
.AddIdentityCookies();
}
}
}

2
modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs

@ -1,7 +1,6 @@
using Localization.Resources.AbpUi;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Account.Web.Localization;
using Volo.Abp.Account.Web.Settings;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
@ -9,7 +8,6 @@ using Volo.Abp.Identity.AspNetCore;
using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity;
using Volo.Abp.Settings;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;

9
modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs

@ -29,6 +29,15 @@ namespace Volo.Abp.PermissionManagement
User1Id.ToString()
)
);
_permissionGrantRepository.Insert(
new PermissionGrant(
_guidGenerator.Create(),
"MyPermission3",
UserPermissionValueProvider.ProviderName,
User1Id.ToString()
)
);
}
}
}

3
modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestPermissionDefinitionProvider.cs

@ -1,4 +1,5 @@
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.PermissionManagement
{
@ -12,6 +13,8 @@ namespace Volo.Abp.PermissionManagement
var myPermission2 = testGroup.AddPermission("MyPermission2");
myPermission2.AddChild("MyPermission2.ChildPermission1");
testGroup.AddPermission("MyPermission3", multiTenancySide: MultiTenancySides.Host);
}
}
}

16
modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs

@ -44,7 +44,16 @@ namespace Volo.Abp.PermissionManagement
)).ShouldBeFalse();
}
private static ClaimsPrincipal CreatePrincipal(Guid? userId)
[Fact]
public async Task Should_Not_Allow_Host_Permission_To_Tenant_User_Even_Granted_Before()
{
(await _permissionChecker.IsGrantedAsync(
CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()),
"MyPermission3"
)).ShouldBeFalse();
}
private static ClaimsPrincipal CreatePrincipal(Guid? userId, Guid? tenantId = null)
{
var claimsIdentity = new ClaimsIdentity();
@ -53,6 +62,11 @@ namespace Volo.Abp.PermissionManagement
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, userId.ToString()));
}
if (tenantId != null)
{
claimsIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, tenantId.ToString()));
}
return new ClaimsPrincipal(claimsIdentity);
}
}

1227
samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190404130536_Make_IDS4_Entities_Audited.Designer.cs

File diff suppressed because it is too large

347
samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190404130536_Make_IDS4_Entities_Audited.cs

@ -0,0 +1,347 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AuthServer.Host.Migrations
{
public partial class Make_IDS4_Entities_Audited : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "IdentityServerIdentityResources",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatorId",
table: "IdentityServerIdentityResources",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "IdentityServerIdentityResources",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "IdentityServerIdentityResources",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "IdentityServerIdentityResources",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastModificationTime",
table: "IdentityServerIdentityResources",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "LastModifierId",
table: "IdentityServerIdentityResources",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "LogoUri",
table: "IdentityServerClients",
maxLength: 300,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FrontChannelLogoutUri",
table: "IdentityServerClients",
maxLength: 300,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ClientUri",
table: "IdentityServerClients",
maxLength: 300,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2000,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BackChannelLogoutUri",
table: "IdentityServerClients",
maxLength: 300,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 2000,
oldNullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "IdentityServerClients",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatorId",
table: "IdentityServerClients",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "IdentityServerClients",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "IdentityServerClients",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "IdentityServerClients",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastModificationTime",
table: "IdentityServerClients",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "LastModifierId",
table: "IdentityServerClients",
nullable: true);
//migrationBuilder.AlterColumn<string>(
// name: "RedirectUri",
// table: "IdentityServerClientRedirectUris",
// maxLength: 200,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 2000);
//migrationBuilder.AlterColumn<string>(
// name: "Value",
// table: "IdentityServerClientProperties",
// maxLength: 128,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 2000);
//migrationBuilder.AlterColumn<string>(
// name: "Key",
// table: "IdentityServerClientProperties",
// maxLength: 64,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 250);
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "IdentityServerApiResources",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<Guid>(
name: "CreatorId",
table: "IdentityServerApiResources",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "DeleterId",
table: "IdentityServerApiResources",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "DeletionTime",
table: "IdentityServerApiResources",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsDeleted",
table: "IdentityServerApiResources",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "LastModificationTime",
table: "IdentityServerApiResources",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "LastModifierId",
table: "IdentityServerApiResources",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "EntityTenantId",
table: "AbpEntityChanges",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "TenantName",
table: "AbpAuditLogs",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CreationTime",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "CreatorId",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "LastModificationTime",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "LastModifierId",
table: "IdentityServerIdentityResources");
migrationBuilder.DropColumn(
name: "CreationTime",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "CreatorId",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "LastModificationTime",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "LastModifierId",
table: "IdentityServerClients");
migrationBuilder.DropColumn(
name: "CreationTime",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "CreatorId",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "DeleterId",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "DeletionTime",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "LastModificationTime",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "LastModifierId",
table: "IdentityServerApiResources");
migrationBuilder.DropColumn(
name: "EntityTenantId",
table: "AbpEntityChanges");
migrationBuilder.DropColumn(
name: "TenantName",
table: "AbpAuditLogs");
migrationBuilder.AlterColumn<string>(
name: "LogoUri",
table: "IdentityServerClients",
maxLength: 2000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 300,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FrontChannelLogoutUri",
table: "IdentityServerClients",
maxLength: 2000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 300,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ClientUri",
table: "IdentityServerClients",
maxLength: 2000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 300,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "BackChannelLogoutUri",
table: "IdentityServerClients",
maxLength: 2000,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 300,
oldNullable: true);
//migrationBuilder.AlterColumn<string>(
// name: "RedirectUri",
// table: "IdentityServerClientRedirectUris",
// maxLength: 2000,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 200);
//migrationBuilder.AlterColumn<string>(
// name: "Value",
// table: "IdentityServerClientProperties",
// maxLength: 2000,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 128);
//migrationBuilder.AlterColumn<string>(
// name: "Key",
// table: "IdentityServerClientProperties",
// maxLength: 250,
// nullable: false,
// oldClrType: typeof(string),
// oldMaxLength: 64);
}
}
}

87
samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs

@ -82,6 +82,8 @@ namespace AuthServer.Host.Migrations
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId");
b.Property<string>("TenantName");
b.Property<string>("Url")
.HasColumnName("Url")
.HasMaxLength(256);
@ -161,6 +163,8 @@ namespace AuthServer.Host.Migrations
.HasColumnName("EntityId")
.HasMaxLength(128);
b.Property<Guid?>("EntityTenantId");
b.Property<string>("EntityTypeFullName")
.IsRequired()
.HasColumnName("EntityTypeFullName")
@ -520,6 +524,18 @@ namespace AuthServer.Host.Migrations
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -531,6 +547,17 @@ namespace AuthServer.Host.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);
@ -639,7 +666,7 @@ namespace AuthServer.Host.Migrations
b.Property<bool>("BackChannelLogoutSessionRequired");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000);
.HasMaxLength(300);
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200);
@ -652,12 +679,24 @@ namespace AuthServer.Host.Migrations
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasMaxLength(2000);
.HasMaxLength(300);
b.Property<string>("ConcurrencyStamp");
b.Property<int?>("ConsentLifetime");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -671,14 +710,25 @@ namespace AuthServer.Host.Migrations
b.Property<bool>("FrontChannelLogoutSessionRequired");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000);
.HasMaxLength(300);
b.Property<int>("IdentityTokenLifetime");
b.Property<bool>("IncludeJwtId");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("LogoUri")
.HasMaxLength(2000);
.HasMaxLength(300);
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200);
@ -777,11 +827,11 @@ namespace AuthServer.Host.Migrations
b.Property<Guid>("ClientId");
b.Property<string>("Key")
.HasMaxLength(250);
.HasMaxLength(64);
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000);
.HasMaxLength(128);
b.HasKey("ClientId", "Key");
@ -793,7 +843,7 @@ namespace AuthServer.Host.Migrations
b.Property<Guid>("ClientId");
b.Property<string>("RedirectUri")
.HasMaxLength(2000);
.HasMaxLength(200);
b.HasKey("ClientId", "RedirectUri");
@ -888,6 +938,18 @@ namespace AuthServer.Host.Migrations
b.Property<string>("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasMaxLength(1000);
@ -901,6 +963,17 @@ namespace AuthServer.Host.Migrations
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200);

Loading…
Cancel
Save