Browse Source

Move IProfileAppService to account module

pull/10378/head
liangshiwei 5 years ago
parent
commit
159e48374f
  1. 3
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ChangePasswordInput.cs
  2. 3
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/IProfileAppService.cs
  3. 2
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ProfileDto.cs
  4. 7
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/UpdateProfileDto.cs
  5. 8
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModule.cs
  6. 16
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs
  7. 5
      modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs
  8. 2
      modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/ProfileClientProxy.Generated.cs
  9. 2
      modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/ProfileClientProxy.cs
  10. 103
      modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json
  11. 9
      modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs
  12. 1
      modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs
  13. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js
  14. 2
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js
  15. 32
      modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js
  16. 6
      modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs
  17. 103
      modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json
  18. 32
      modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js

3
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ChangePasswordInput.cs → modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ChangePasswordInput.cs

@ -1,8 +1,9 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Auditing;
using Volo.Abp.Identity;
using Volo.Abp.Validation;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
public class ChangePasswordInput
{

3
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IProfileAppService.cs → modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/IProfileAppService.cs

@ -1,7 +1,8 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
public interface IProfileAppService : IApplicationService
{

2
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/ProfileDto.cs → modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/ProfileDto.cs

@ -1,7 +1,7 @@
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
public class ProfileDto : ExtensibleObject, IHasConcurrencyStamp
{

7
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/UpdateProfileDto.cs → modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/UpdateProfileDto.cs

@ -1,9 +1,8 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Identity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
public class UpdateProfileDto : ExtensibleObject
{
@ -24,4 +23,4 @@ namespace Volo.Abp.Identity
public string ConcurrencyStamp { get; set; }
}
}
}

8
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.Emailing;
using Volo.Abp.AutoMapper;
using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
@ -22,6 +23,11 @@ namespace Volo.Abp.Account
options.FileSets.AddEmbedded<AbpAccountApplicationModule>();
});
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpAccountApplicationModuleAutoMapperProfile>(validate: true);
});
Configure<AppUrlOptions>(options =>
{
options.Applications["MVC"].Urls[AccountUrlNames.PasswordReset] = "Account/ResetPassword";

16
modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModuleAutoMapperProfile.cs

@ -0,0 +1,16 @@
using AutoMapper;
using Volo.Abp.Identity;
namespace Volo.Abp.Account
{
public class AbpAccountApplicationModuleAutoMapperProfile : Profile
{
public AbpAccountApplicationModuleAutoMapperProfile()
{
CreateMap<IdentityUser, ProfileDto>()
.ForMember(dest => dest.HasPassword,
op => op.MapFrom(src => src.PasswordHash != null))
.MapExtraProperties();
}
}
}

5
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs → modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/ProfileAppService.cs

@ -1,16 +1,17 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Volo.Abp.Data;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Settings;
using Volo.Abp.Settings;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Settings;
using Volo.Abp.Users;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
[Authorize]
public class ProfileAppService : IdentityAppServiceBase, IProfileAppService

2
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/ProfileClientProxy.Generated.cs → modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/ProfileClientProxy.Generated.cs

@ -9,7 +9,7 @@ using Volo.Abp.Http.Client.ClientProxying;
using Volo.Abp.Identity;
// ReSharper disable once CheckNamespace
namespace Volo.Abp.Identity.ClientProxies
namespace Volo.Abp.Account.ClientProxies
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IProfileAppService), typeof(ProfileClientProxy))]

2
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/ProfileClientProxy.cs → modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/ProfileClientProxy.cs

@ -1,6 +1,6 @@
// This file is part of ProfileClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.Abp.Identity.ClientProxies
namespace Volo.Abp.Account.ClientProxies
{
public partial class ProfileClientProxy
{

103
modules/account/src/Volo.Abp.Account.HttpApi.Client/ClientProxies/account-generate-proxy.json

@ -223,9 +223,110 @@
"implementFrom": "Volo.Abp.Account.Web.Areas.Account.Controllers.AccountController"
}
}
},
"Volo.Abp.Account.ProfileController": {
"controllerName": "Profile",
"controllerGroupName": "Profile",
"type": "Volo.Abp.Account.ProfileController",
"interfaces": [
{
"type": "Volo.Abp.Account.IProfileAppService"
}
],
"actions": {
"GetAsync": {
"uniqueName": "GetAsync",
"name": "GetAsync",
"httpMethod": "GET",
"url": "api/account/my-profile",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
"type": "Volo.Abp.Account.ProfileDto",
"typeSimple": "Volo.Abp.Account.ProfileDto"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Account.IProfileAppService"
},
"UpdateAsyncByInput": {
"uniqueName": "UpdateAsyncByInput",
"name": "UpdateAsync",
"httpMethod": "PUT",
"url": "api/account/my-profile",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Abp.Account.UpdateProfileDto, Volo.Abp.Account.Application.Contracts",
"type": "Volo.Abp.Account.UpdateProfileDto",
"typeSimple": "Volo.Abp.Account.UpdateProfileDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.Abp.Account.UpdateProfileDto",
"typeSimple": "Volo.Abp.Account.UpdateProfileDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "Volo.Abp.Account.ProfileDto",
"typeSimple": "Volo.Abp.Account.ProfileDto"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Account.IProfileAppService"
},
"ChangePasswordAsyncByInput": {
"uniqueName": "ChangePasswordAsyncByInput",
"name": "ChangePasswordAsync",
"httpMethod": "POST",
"url": "api/account/my-profile/change-password",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Abp.Account.ChangePasswordInput, Volo.Abp.Account.Application.Contracts",
"type": "Volo.Abp.Account.ChangePasswordInput",
"typeSimple": "Volo.Abp.Account.ChangePasswordInput",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.Abp.Account.ChangePasswordInput",
"typeSimple": "Volo.Abp.Account.ChangePasswordInput",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "System.Void",
"typeSimple": "System.Void"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Account.IProfileAppService"
}
}
}
}
}
},
"types": {}
}
}

9
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs → modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/ProfileController.cs

@ -1,13 +1,14 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
namespace Volo.Abp.Identity
namespace Volo.Abp.Account
{
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[Area("identity")]
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
[Area("account")]
[ControllerName("Profile")]
[Route("/api/identity/my-profile")]
[Route("/api/account/my-profile")]
public class ProfileController : AbpControllerBase, IProfileAppService
{
protected IProfileAppService ProfileAppService { get; }

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

@ -82,6 +82,7 @@ namespace Volo.Abp.Account.Web
.Configure(typeof(ManageModel).FullName,
configuration =>
{
configuration.AddFiles("/client-proxies/account-proxy.js");
configuration.AddFiles("/Pages/Account/Components/ProfileManagementGroup/Password/Default.js");
configuration.AddFiles("/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js");
});

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/Password/Default.js

@ -23,7 +23,7 @@
return;
}
volo.abp.identity.profile.changePassword(input).then(function (result) {
volo.abp.account.profile.changePassword(input).then(function (result) {
abp.message.success(l('PasswordChanged'));
});
});

2
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js

@ -11,7 +11,7 @@
var input = $('#PersonalSettingsForm').serializeFormToObject();
volo.abp.identity.profile.update(input).then(function (result) {
volo.abp.account.profile.update(input).then(function (result) {
abp.notify.success(l('PersonalSettingsSaved'));
});
});

32
modules/account/src/Volo.Abp.Account.Web/wwwroot/client-proxies/account-proxy.js

@ -71,6 +71,38 @@
})();
// controller volo.abp.account.profile
(function(){
abp.utils.createNamespace(window, 'volo.abp.account.profile');
volo.abp.account.profile.get = function(ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/account/my-profile',
type: 'GET'
}, ajaxParams));
};
volo.abp.account.profile.update = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/account/my-profile',
type: 'PUT',
data: JSON.stringify(input)
}, ajaxParams));
};
volo.abp.account.profile.changePassword = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/account/my-profile/change-password',
type: 'POST',
dataType: null,
data: JSON.stringify(input)
}, ajaxParams));
};
})();
})();

6
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs

@ -1,5 +1,4 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
namespace Volo.Abp.Identity
{
@ -12,11 +11,6 @@ namespace Volo.Abp.Identity
CreateMap<IdentityRole, IdentityRoleDto>()
.MapExtraProperties();
CreateMap<IdentityUser, ProfileDto>()
.ForMember(dest => dest.HasPassword,
op => op.MapFrom(src => src.PasswordHash != null))
.MapExtraProperties();
}
}
}

103
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json

@ -903,110 +903,9 @@
"implementFrom": "Volo.Abp.Identity.IIdentityUserLookupAppService"
}
}
},
"Volo.Abp.Identity.ProfileController": {
"controllerName": "Profile",
"controllerGroupName": "Profile",
"type": "Volo.Abp.Identity.ProfileController",
"interfaces": [
{
"type": "Volo.Abp.Identity.IProfileAppService"
}
],
"actions": {
"GetAsync": {
"uniqueName": "GetAsync",
"name": "GetAsync",
"httpMethod": "GET",
"url": "api/identity/my-profile",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
"type": "Volo.Abp.Identity.ProfileDto",
"typeSimple": "Volo.Abp.Identity.ProfileDto"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Identity.IProfileAppService"
},
"UpdateAsyncByInput": {
"uniqueName": "UpdateAsyncByInput",
"name": "UpdateAsync",
"httpMethod": "PUT",
"url": "api/identity/my-profile",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Abp.Identity.UpdateProfileDto, Volo.Abp.Identity.Application.Contracts",
"type": "Volo.Abp.Identity.UpdateProfileDto",
"typeSimple": "Volo.Abp.Identity.UpdateProfileDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.Abp.Identity.UpdateProfileDto",
"typeSimple": "Volo.Abp.Identity.UpdateProfileDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "Volo.Abp.Identity.ProfileDto",
"typeSimple": "Volo.Abp.Identity.ProfileDto"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Identity.IProfileAppService"
},
"ChangePasswordAsyncByInput": {
"uniqueName": "ChangePasswordAsyncByInput",
"name": "ChangePasswordAsync",
"httpMethod": "POST",
"url": "api/identity/my-profile/change-password",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Abp.Identity.ChangePasswordInput, Volo.Abp.Identity.Application.Contracts",
"type": "Volo.Abp.Identity.ChangePasswordInput",
"typeSimple": "Volo.Abp.Identity.ChangePasswordInput",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "Volo.Abp.Identity.ChangePasswordInput",
"typeSimple": "Volo.Abp.Identity.ChangePasswordInput",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "System.Void",
"typeSimple": "System.Void"
},
"allowAnonymous": null,
"implementFrom": "Volo.Abp.Identity.IProfileAppService"
}
}
}
}
}
},
"types": {}
}
}

32
modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js

@ -177,38 +177,6 @@
})();
// controller volo.abp.identity.profile
(function(){
abp.utils.createNamespace(window, 'volo.abp.identity.profile');
volo.abp.identity.profile.get = function(ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/identity/my-profile',
type: 'GET'
}, ajaxParams));
};
volo.abp.identity.profile.update = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/identity/my-profile',
type: 'PUT',
data: JSON.stringify(input)
}, ajaxParams));
};
volo.abp.identity.profile.changePassword = function(input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/identity/my-profile/change-password',
type: 'POST',
dataType: null,
data: JSON.stringify(input)
}, ajaxParams));
};
})();
})();

Loading…
Cancel
Save