Skip to content

Commit

Permalink
Merge pull request #6 from abpframework/master
Browse files Browse the repository at this point in the history
Merging master
  • Loading branch information
marcelo-maciel authored Feb 7, 2019
2 parents 4fa7e07 + 217e44c commit 04ff89a
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public abstract class AggregateRoot : Entity,
IHasExtraProperties,
IHasConcurrencyStamp
{
public Dictionary<string, object> ExtraProperties { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }

[DisableAuditing]
public string ConcurrencyStamp { get; set; }
public virtual string ConcurrencyStamp { get; set; }

private readonly ICollection<object> _localEvents = new Collection<object>();
private readonly ICollection<object> _distributedEvents = new Collection<object>();
Expand Down Expand Up @@ -65,10 +65,10 @@ public abstract class AggregateRoot<TKey> : Entity<TKey>,
IHasExtraProperties,
IHasConcurrencyStamp
{
public Dictionary<string, object> ExtraProperties { get; protected set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }

[DisableAuditing]
public string ConcurrencyStamp { get; set; }
public virtual string ConcurrencyStamp { get; set; }

private readonly ICollection<object> _localEvents = new Collection<object>();
private readonly ICollection<object> _distributedEvents = new Collection<object>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Users;

namespace Volo.Blogging.Users
{
public class BlogUser : AggregateRoot<Guid>, IUser, IHasExtraProperties
public class BlogUser : AggregateRoot<Guid>, IUser
{
public virtual Guid? TenantId { get; protected set; }

Expand All @@ -24,16 +22,14 @@ public class BlogUser : AggregateRoot<Guid>, IUser, IHasExtraProperties

public virtual bool PhoneNumberConfirmed { get; protected set; }

public virtual Dictionary<string, object> ExtraProperties { get; protected set; }

protected BlogUser()
{
ExtraProperties = new Dictionary<string, object>();

}

public BlogUser(IUserData user)
: base(user.Id)
{
Id = user.Id;
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
Expand All @@ -42,8 +38,17 @@ public BlogUser(IUserData user)
PhoneNumberConfirmed = user.PhoneNumberConfirmed;
UserName = user.UserName;
TenantId = user.TenantId;
}

ExtraProperties = new Dictionary<string, object>();
public void Update(IUserData user)
{
Email = user.Email;
Name = user.Name;
Surname = user.Surname;
EmailConfirmed = user.EmailConfirmed;
PhoneNumber = user.PhoneNumber;
PhoneNumberConfirmed = user.PhoneNumberConfirmed;
UserName = user.UserName;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Users;

namespace Volo.Blogging.Users
{
public class BlogUserSynchronizer :
IDistributedEventHandler<EntityUpdatedEto<UserEto>>,
ITransientDependency
{
protected IBlogUserRepository UserRepository { get; }
protected IBlogUserLookupService UserLookupService { get; }

public BlogUserSynchronizer(IBlogUserRepository userRepository, IBlogUserLookupService userLookupService)
{
UserRepository = userRepository;
UserLookupService = userLookupService;
}

public async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData)
{
var user = await UserRepository.FindAsync(eventData.Entity.Id);
if (user == null)
{
//TODO: Why needed (ask to @ebicoglu)?
user = await UserLookupService.FindByIdAsync(eventData.Entity.Id);
if (user == null)
{
return;
}
}

user.Update(eventData.Entity);
await UserRepository.UpdateAsync(user);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid bl
}

[HttpGet]
[Route("read/{id}")]
[Route("read")]
public Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
{
return _postAppService.GetForReadingAsync(input);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Acme.BookStore.Permissions;
using Acme.BookStore.Permissions;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.AutoMapper;
using Volo.Abp.Identity;
Expand All @@ -25,8 +24,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
options.AddProfile<BookStoreApplicationAutoMapperProfile>();
});

context.Services.AddAssemblyOf<BookStoreApplicationModule>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
options.DefinitionProviders.Add<BookStoreSettingDefinitionProvider>();
});

context.Services.AddAssemblyOf<BookStoreDomainModule>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
options.AddDefaultRepositories();
});

context.Services.AddAssemblyOf<BookStoreEntityFrameworkCoreModule>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
ConfigureNavigationServices();
ConfigureAutoApiControllers();
ConfigureSwaggerServices(context.Services);

context.Services.AddAssemblyOf<BookStoreWebModule>();
}

private void ConfigureDatabaseServices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
context.Services.AddAlwaysAllowAuthorization();

ConfigureInMemorySqlite(context.Services);

context.Services.AddAssemblyOf<BookStoreApplicationTestModule>();
}

private void ConfigureInMemorySqlite(IServiceCollection services)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureLocalizationServices(context.Services);
ConfigureNavigationServices(context.Services);

context.Services.AddAssemblyOf<BookStoreWebTestModule>();
}

private static void ConfigureLocalizationServices(IServiceCollection services)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;

namespace AuthServer.Host.Pages
{
public class IndexModel : PageModel
public class IndexModel : AbpPageModel
{
public void OnGet()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
@page
@using Volo.Abp.Users
@model PublicWebSite.Host.Pages.IndexModel
@inject ICurrentUser CurrentUser
<h1>Public Web Site Application</h1>
<h2 class="lead">Welcome...</h2>
<h2 class="lead">Welcome...</h2>

@if (CurrentUser.IsAuthenticated)
{
<a abp-button="Primary" asp-controller="Logout" asp-action="Index" asp-area="Account">Logout</a>
}
else
{
<form method="POST">
<input type="submit" asp-page-handler="Login" value="Login" />
</form>
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Authentication;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;

namespace PublicWebSite.Host.Pages
{
public class IndexModel : PageModel
public class IndexModel : AbpPageModel
{
public void OnGet()
{

}

public async Task OnPostLoginAsync()
{
await HttpContext.ChallengeAsync("oidc");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using MyCompanyName.ProductManagement;
using ProductManagement;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;

namespace PublicWebSite.Host.Pages
{
public class ProductsModel : PageModel
public class ProductsModel : AbpPageModel
{
public ListResultDto<ProductDto> Products { get; set; }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.MongoDB\Volo.Abp.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.EventBus.RabbitMQ\Volo.Abp.EventBus.RabbitMQ.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi.Client\Volo.Abp.Identity.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.HttpApi\Volo.Blogging.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.MongoDB\Volo.Blogging.MongoDB.csproj" />
<ProjectReference Include="..\..\..\..\modules\blogging\src\Volo.Blogging.Application\Volo.Blogging.Application.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Volo.Abp.EntityFrameworkCore.SqlServer;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
Expand All @@ -31,7 +32,8 @@ namespace BloggingService.Host
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(BloggingHttpApiModule),
typeof(BloggingMongoDbModule),
typeof(BloggingApplicationModule)
typeof(BloggingApplicationModule),
typeof(AbpIdentityHttpApiClientModule)
)]
public class BloggingServiceHostModule : AbpModule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true",
"Blogging": "mongodb://localhost|MsDemo_Blogging"
},
"RemoteServices": {
"Default": {
"BaseUrl": "http://localhost:65129/"
}
},
"Redis": {
"Configuration": "127.0.0.1"
},
Expand Down

0 comments on commit 04ff89a

Please sign in to comment.