Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/5887/head
Alper Ebicoglu 6 years ago
parent
commit
5dfda27462
  1. 6
      docs/en/Migration-Guides/Abp-4_0.md
  2. 20
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs
  3. 5
      framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs
  4. 9
      modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs
  5. 2
      modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml
  6. 4
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml
  7. 13
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs
  8. 26
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs
  9. 6
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs

6
docs/en/Migration-Guides/Abp-4_0.md

@ -32,10 +32,6 @@ Also, added `Enabled(string)` and `Description(bool,true)` properties.
* Added `AllowedAccessTokenSigningAlgorithms (string)` and `Description (string)` and `ConsumedTime (DateTime?)` properties * Added `AllowedAccessTokenSigningAlgorithms (string)` and `Description (string)` and `ConsumedTime (DateTime?)` properties
#### ApiScope
* Before it was a property of `ApiResource`, now it becomes an independent aggregate root.
## Migrating the Database ## Migrating the Database
> Attention: **Please backup your database** before the migration! > Attention: **Please backup your database** before the migration!
@ -51,4 +47,4 @@ If you've customize your IdentityServer configuration in the database or in the
### Related Resources ### Related Resources
* https://leastprivilege.com/2020/06/19/announcing-identityserver4-v4-0/ * https://leastprivilege.com/2020/06/19/announcing-identityserver4-v4-0/
* https://github.com/IdentityServer/IdentityServer4/issues/4592 * https://github.com/IdentityServer/IdentityServer4/issues/4592

20
framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreIntegratedTestBase.cs

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -11,7 +10,7 @@ using Microsoft.Extensions.Hosting;
namespace Volo.Abp.AspNetCore.TestBase namespace Volo.Abp.AspNetCore.TestBase
{ {
public abstract class AbpAspNetCoreIntegratedTestBase<TStartup> : AbpTestBaseWithServiceProvider public abstract class AbpAspNetCoreIntegratedTestBase<TStartup> : AbpTestBaseWithServiceProvider, IDisposable
where TStartup : class where TStartup : class
{ {
protected TestServer Server { get; } protected TestServer Server { get; }
@ -20,15 +19,17 @@ namespace Volo.Abp.AspNetCore.TestBase
protected override IServiceProvider ServiceProvider { get; } protected override IServiceProvider ServiceProvider { get; }
private readonly IHost _host;
protected AbpAspNetCoreIntegratedTestBase() protected AbpAspNetCoreIntegratedTestBase()
{ {
var builder = CreateHostBuilder(); var builder = CreateHostBuilder();
var host = builder.Build(); _host = builder.Build();
host.Start(); _host.Start();
Server = host.GetTestServer(); Server = _host.GetTestServer();
Client = host.GetTestClient(); Client = _host.GetTestClient();
ServiceProvider = Server.Services; ServiceProvider = Server.Services;
@ -49,7 +50,7 @@ namespace Volo.Abp.AspNetCore.TestBase
protected virtual void ConfigureServices(HostBuilderContext context, IServiceCollection services) protected virtual void ConfigureServices(HostBuilderContext context, IServiceCollection services)
{ {
} }
#region GetUrl #region GetUrl
@ -90,5 +91,10 @@ namespace Volo.Abp.AspNetCore.TestBase
} }
#endregion #endregion
public void Dispose()
{
_host?.Dispose();
}
} }
} }

5
framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationCreationOptions.cs

@ -13,6 +13,9 @@ namespace Volo.Abp
[NotNull] [NotNull]
public PlugInSourceList PlugInSources { get; } public PlugInSourceList PlugInSources { get; }
/// <summary>
/// The options in this property only take effect when IConfiguration not registered.
/// </summary>
[NotNull] [NotNull]
public AbpConfigurationBuilderOptions Configuration {get; } public AbpConfigurationBuilderOptions Configuration {get; }
@ -23,4 +26,4 @@ namespace Volo.Abp
Configuration = new AbpConfigurationBuilderOptions(); Configuration = new AbpConfigurationBuilderOptions();
} }
} }
} }

9
modules/account/src/Volo.Abp.Account.Web/AccountModuleToolbarContributor.cs

@ -15,11 +15,10 @@ namespace Volo.Abp.Account.Web
return Task.CompletedTask; return Task.CompletedTask;
} }
//TODO: Currently disabled! if (!context.ServiceProvider.GetRequiredService<ICurrentUser>().IsAuthenticated)
//if (!context.ServiceProvider.GetRequiredService<ICurrentUser>().IsAuthenticated) {
//{ context.Toolbar.Items.Add(new ToolbarItem(typeof(UserLoginLinkViewComponent)));
// context.Toolbar.Items.Add(new ToolbarItem(typeof(UserLoginLinkViewComponent))); }
//}
return Task.CompletedTask; return Task.CompletedTask;
} }

2
modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml

@ -1,4 +1,4 @@
@using Localization.Resources.AbpUi @using Localization.Resources.AbpUi
@using Microsoft.AspNetCore.Mvc.Localization @using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<AbpUiResource> L @inject IHtmlLocalizer<AbpUiResource> L
<a href="~/Account/Login">@L["Login"]</a> <a class="nav-link" role="button" href="~/Account/Login">@L["Login"]</a>

4
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/Default.cshtml

@ -0,0 +1,4 @@
@using Microsoft.AspNetCore.Mvc.Localization
@using MyCompanyName.MyProjectName.Localization
@inject IHtmlLocalizer<MyProjectNameResource> L
<a class="nav-link" role="button" href="~/Account/Login">@L["Login"]</a>

13
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Components/Toolbar/LoginLink/LoginLinkViewComponent.cs

@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
namespace MyCompanyName.MyProjectName.Web.Components.Toolbar.LoginLink
{
public class LoginLinkViewComponent : AbpViewComponent
{
public virtual IViewComponentResult Invoke()
{
return View("~/Components/Toolbar/LoginLink/Default.cshtml");
}
}
}

26
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameToolbarContributor.cs

@ -0,0 +1,26 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using MyCompanyName.MyProjectName.Web.Components.Toolbar.LoginLink;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
using Volo.Abp.Users;
namespace MyCompanyName.MyProjectName.Web.Menus
{
public class MyProjectNameToolbarContributor : IToolbarContributor
{
public virtual Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
{
if (context.Toolbar.Name != StandardToolbars.Main)
{
return Task.CompletedTask;
}
if (!context.ServiceProvider.GetRequiredService<ICurrentUser>().IsAuthenticated)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginLinkViewComponent)));
}
return Task.CompletedTask;
}
}
}

6
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs

@ -28,6 +28,7 @@ using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
@ -182,6 +183,11 @@ namespace MyCompanyName.MyProjectName.Web
{ {
options.MenuContributors.Add(new MyProjectNameMenuContributor(configuration)); options.MenuContributors.Add(new MyProjectNameMenuContributor(configuration));
}); });
Configure<AbpToolbarOptions>(options =>
{
options.Contributors.Add(new MyProjectNameToolbarContributor());
});
} }
private void ConfigureSwaggerServices(IServiceCollection services) private void ConfigureSwaggerServices(IServiceCollection services)

Loading…
Cancel
Save