Skip to content

Commit c824a28

Browse files
merge commit
2 parents 9181037 + a270c87 commit c824a28

File tree

4,998 files changed

+1113079
-9021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,998 files changed

+1113079
-9021
lines changed

src/AbpCompanyName.AbpProjectName.Application/AbpCompanyName.AbpProjectName.Application.csproj

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,36 @@
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<Reference Include="Abp, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL">
39-
<HintPath>..\packages\Abp.2.0.2\lib\net46\Abp.dll</HintPath>
38+
<Reference Include="Abp, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
39+
<HintPath>..\packages\Abp.2.3.0\lib\net46\Abp.dll</HintPath>
4040
</Reference>
41-
<Reference Include="Abp.AutoMapper, Version=2.0.2.0, Culture=neutral, processorArchitecture=MSIL">
42-
<HintPath>..\packages\Abp.AutoMapper.2.0.2\lib\net46\Abp.AutoMapper.dll</HintPath>
41+
<Reference Include="Abp.AutoMapper, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
42+
<HintPath>..\packages\Abp.AutoMapper.2.3.0\lib\net46\Abp.AutoMapper.dll</HintPath>
4343
</Reference>
44-
<Reference Include="Abp.Zero, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL">
45-
<HintPath>..\packages\Abp.Zero.2.0.1\lib\net46\Abp.Zero.dll</HintPath>
44+
<Reference Include="Abp.Zero, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
45+
<HintPath>..\packages\Abp.Zero.2.3.0\lib\net46\Abp.Zero.dll</HintPath>
4646
</Reference>
47-
<Reference Include="Abp.Zero.Common, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL">
48-
<HintPath>..\packages\Abp.Zero.Common.2.0.1\lib\net46\Abp.Zero.Common.dll</HintPath>
47+
<Reference Include="Abp.Zero.Common, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL">
48+
<HintPath>..\packages\Abp.Zero.Common.2.3.0\lib\net46\Abp.Zero.Common.dll</HintPath>
4949
</Reference>
50-
<Reference Include="AutoMapper, Version=6.0.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
51-
<HintPath>..\packages\AutoMapper.6.0.2\lib\net45\AutoMapper.dll</HintPath>
50+
<Reference Include="AutoMapper, Version=6.1.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
51+
<HintPath>..\packages\AutoMapper.6.1.1\lib\net45\AutoMapper.dll</HintPath>
5252
</Reference>
53-
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
54-
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
56-
</Reference>
57-
<Reference Include="Castle.Facilities.Logging, Version=3.4.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
58-
<HintPath>..\packages\Castle.LoggingFacility.3.4.0\lib\net45\Castle.Facilities.Logging.dll</HintPath>
53+
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
54+
<HintPath>..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll</HintPath>
5955
<Private>True</Private>
6056
</Reference>
61-
<Reference Include="Castle.Windsor, Version=3.4.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Castle.Windsor.3.4.0\lib\net45\Castle.Windsor.dll</HintPath>
57+
<Reference Include="Castle.Facilities.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
58+
<HintPath>..\packages\Castle.LoggingFacility.4.0.0\lib\net45\Castle.Facilities.Logging.dll</HintPath>
6359
<Private>True</Private>
6460
</Reference>
65-
<Reference Include="JetBrains.Annotations, Version=10.4.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
66-
<HintPath>..\packages\JetBrains.Annotations.10.4.0\lib\net\JetBrains.Annotations.dll</HintPath>
61+
<Reference Include="Castle.Windsor, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
62+
<HintPath>..\packages\Castle.Windsor.4.0.0\lib\net45\Castle.Windsor.dll</HintPath>
6763
<Private>True</Private>
6864
</Reference>
65+
<Reference Include="JetBrains.Annotations, Version=11.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
66+
<HintPath>..\packages\JetBrains.Annotations.11.0.0\lib\net20\JetBrains.Annotations.dll</HintPath>
67+
</Reference>
6968
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7069
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
7170
<Private>True</Private>
@@ -83,7 +82,7 @@
8382
<Private>True</Private>
8483
</Reference>
8584
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
86-
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
85+
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
8786
</Reference>
8887
<Reference Include="Nito.AsyncEx, Version=4.0.1.0, Culture=neutral, processorArchitecture=MSIL">
8988
<HintPath>..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll</HintPath>
@@ -105,8 +104,8 @@
105104
<Reference Include="System.ComponentModel.DataAnnotations" />
106105
<Reference Include="System.Configuration" />
107106
<Reference Include="System.Core" />
108-
<Reference Include="System.Linq.Dynamic.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
109-
<HintPath>..\packages\System.Linq.Dynamic.Core.1.0.6.13\lib\net45\System.Linq.Dynamic.Core.dll</HintPath>
107+
<Reference Include="System.Linq.Dynamic.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
108+
<HintPath>..\packages\System.Linq.Dynamic.Core.1.0.7.6\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
110109
</Reference>
111110
<Reference Include="System.Net" />
112111
<Reference Include="System.Runtime.Caching" />
@@ -120,24 +119,39 @@
120119
<ItemGroup>
121120
<Compile Include="AbpProjectNameApplicationModule.cs" />
122121
<Compile Include="AbpProjectNameAppServiceBase.cs" />
123-
<Compile Include="MultiTenancy\Dto\CreateTenantInput.cs" />
122+
<Compile Include="Authorization\Accounts\AccountAppService.cs" />
123+
<Compile Include="Authorization\Accounts\Dto\IsTenantAvailable.cs" />
124+
<Compile Include="Authorization\Accounts\Dto\IsTenantAvailableOutput.cs" />
125+
<Compile Include="Authorization\Accounts\Dto\RegisterInput.cs" />
126+
<Compile Include="Authorization\Accounts\Dto\RegisterOutput.cs" />
127+
<Compile Include="Authorization\Accounts\Dto\TenantAvailabilityState.cs" />
128+
<Compile Include="Authorization\Accounts\IAccountAppService.cs" />
129+
<Compile Include="Configuration\ConfigurationAppService.cs" />
130+
<Compile Include="Configuration\Dto\ChangeUiThemeInput.cs" />
131+
<Compile Include="Configuration\IConfigurationAppService.cs" />
132+
<Compile Include="Configuration\Ui\UiThemeInfo.cs" />
133+
<Compile Include="Configuration\Ui\UiThemes.cs" />
134+
<Compile Include="MultiTenancy\Dto\CreateTenantDto.cs" />
135+
<Compile Include="MultiTenancy\Dto\EditTenantDto.cs" />
136+
<Compile Include="MultiTenancy\Dto\TenantDto.cs" />
124137
<Compile Include="MultiTenancy\ITenantAppService.cs" />
125-
<Compile Include="MultiTenancy\Dto\TenantListDto.cs" />
126138
<Compile Include="MultiTenancy\TenantAppService.cs" />
127139
<Compile Include="Properties\AssemblyInfo.cs" />
140+
<Compile Include="Roles\Dto\CreateRoleDto.cs" />
141+
<Compile Include="Roles\Dto\PermissionDto.cs" />
142+
<Compile Include="Roles\Dto\RoleDto.cs" />
128143
<Compile Include="Roles\IRoleAppService.cs" />
129-
<Compile Include="Roles\Dto\UpdateRolePermissionsInput.cs" />
130-
<Compile Include="Users\Dto\CreateUserInput.cs" />
144+
<Compile Include="Users\Dto\CreateUserDto.cs" />
145+
<Compile Include="Users\Dto\UpdateUserDto.cs" />
146+
<Compile Include="Users\Dto\UserDto.cs" />
131147
<Compile Include="Users\IUserAppService.cs" />
132148
<Compile Include="Roles\RoleAppService.cs" />
133149
<Compile Include="Sessions\Dto\GetCurrentLoginInformationsOutput.cs" />
134150
<Compile Include="Sessions\Dto\TenantLoginInfoDto.cs" />
135151
<Compile Include="Sessions\Dto\UserLoginInfoDto.cs" />
136152
<Compile Include="Sessions\ISessionAppService.cs" />
137153
<Compile Include="Sessions\SessionAppService.cs" />
138-
<Compile Include="Users\Dto\ProhibitPermissionInput.cs" />
139154
<Compile Include="Users\UserAppService.cs" />
140-
<Compile Include="Users\Dto\UserListDto.cs" />
141155
</ItemGroup>
142156
<ItemGroup>
143157
<None Include="app.config" />

src/AbpCompanyName.AbpProjectName.Application/AbpProjectNameAppServiceBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Abp.Application.Services;
44
using Abp.IdentityFramework;
55
using Abp.Runtime.Session;
6+
using AbpCompanyName.AbpProjectName.Authorization.Users;
67
using AbpCompanyName.AbpProjectName.MultiTenancy;
78
using AbpCompanyName.AbpProjectName.Users;
89
using Microsoft.AspNet.Identity;
Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
using System.Reflection;
2+
using Abp.Authorization;
3+
using Abp.Authorization.Roles;
4+
using Abp.Authorization.Users;
25
using Abp.AutoMapper;
6+
using Abp.Domain.Repositories;
37
using Abp.Modules;
8+
using AbpCompanyName.AbpProjectName.Authorization.Roles;
9+
using AbpCompanyName.AbpProjectName.Authorization.Users;
10+
using AbpCompanyName.AbpProjectName.Roles.Dto;
11+
using AbpCompanyName.AbpProjectName.Users.Dto;
412

513
namespace AbpCompanyName.AbpProjectName
614
{
@@ -9,16 +17,28 @@ public class AbpProjectNameApplicationModule : AbpModule
917
{
1018
public override void PreInitialize()
1119
{
12-
Configuration.Modules.AbpAutoMapper().Configurators.Add(mapper =>
13-
{
14-
//Add your custom AutoMapper mappings here...
15-
//mapper.CreateMap<,>()
16-
});
1720
}
1821

1922
public override void Initialize()
2023
{
2124
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
25+
26+
// TODO: Is there somewhere else to store these, with the dto classes
27+
Configuration.Modules.AbpAutoMapper().Configurators.Add(cfg =>
28+
{
29+
// Role and permission
30+
cfg.CreateMap<Permission, string>().ConvertUsing(r => r.Name);
31+
cfg.CreateMap<RolePermissionSetting, string>().ConvertUsing(r => r.Name);
32+
33+
cfg.CreateMap<CreateRoleDto, Role>().ForMember(x => x.Permissions, opt => opt.Ignore());
34+
cfg.CreateMap<RoleDto, Role>().ForMember(x => x.Permissions, opt => opt.Ignore());
35+
36+
cfg.CreateMap<UserDto, User>();
37+
cfg.CreateMap<UserDto, User>().ForMember(x => x.Roles, opt => opt.Ignore());
38+
39+
cfg.CreateMap<CreateUserDto, User>();
40+
cfg.CreateMap<CreateUserDto, User>().ForMember(x => x.Roles, opt => opt.Ignore());
41+
});
2242
}
2343
}
2444
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Threading.Tasks;
2+
using Abp.Zero.Configuration;
3+
using AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto;
4+
using AbpCompanyName.AbpProjectName.Authorization.Users;
5+
using Abp.Configuration;
6+
7+
8+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts
9+
{
10+
public class AccountAppService : AbpProjectNameAppServiceBase, IAccountAppService
11+
{
12+
private readonly UserRegistrationManager _userRegistrationManager;
13+
14+
public AccountAppService(
15+
UserRegistrationManager userRegistrationManager)
16+
{
17+
_userRegistrationManager = userRegistrationManager;
18+
}
19+
20+
public async Task<IsTenantAvailableOutput> IsTenantAvailable(IsTenantAvailableInput input)
21+
{
22+
var tenant = await TenantManager.FindByTenancyNameAsync(input.TenancyName);
23+
if (tenant == null)
24+
{
25+
return new IsTenantAvailableOutput(TenantAvailabilityState.NotFound);
26+
}
27+
28+
if (!tenant.IsActive)
29+
{
30+
return new IsTenantAvailableOutput(TenantAvailabilityState.InActive);
31+
}
32+
33+
return new IsTenantAvailableOutput(TenantAvailabilityState.Available, tenant.Id);
34+
}
35+
36+
public async Task<RegisterOutput> Register(RegisterInput input)
37+
{
38+
var user = await _userRegistrationManager.RegisterAsync(
39+
input.Name,
40+
input.Surname,
41+
input.EmailAddress,
42+
input.UserName,
43+
input.Password,
44+
false
45+
);
46+
47+
var isEmailConfirmationRequiredForLogin = await SettingManager.GetSettingValueAsync<bool>(AbpZeroSettingNames.UserManagement.IsEmailConfirmationRequiredForLogin);
48+
49+
return new RegisterOutput
50+
{
51+
CanLogin = user.IsActive && (user.IsEmailConfirmed || !isEmailConfirmationRequiredForLogin)
52+
};
53+
}
54+
}
55+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.ComponentModel.DataAnnotations;
2+
using Abp.MultiTenancy;
3+
4+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto
5+
{
6+
public class IsTenantAvailableInput
7+
{
8+
[Required]
9+
[MaxLength(AbpTenantBase.MaxTenancyNameLength)]
10+
public string TenancyName { get; set; }
11+
}
12+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto
2+
{
3+
public class IsTenantAvailableOutput
4+
{
5+
public TenantAvailabilityState State { get; set; }
6+
7+
public int? TenantId { get; set; }
8+
9+
public IsTenantAvailableOutput()
10+
{
11+
12+
}
13+
14+
public IsTenantAvailableOutput(TenantAvailabilityState state, int? tenantId = null)
15+
{
16+
State = state;
17+
TenantId = tenantId;
18+
}
19+
}
20+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel.DataAnnotations;
3+
using Abp.Auditing;
4+
using Abp.Authorization.Users;
5+
using AbpCompanyName.AbpProjectName.Users;
6+
using AbpCompanyName.AbpProjectName.Validation;
7+
using Abp.Extensions;
8+
using AbpCompanyName.AbpProjectName.Authorization.Users;
9+
10+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto
11+
{
12+
public class RegisterInput : IValidatableObject
13+
{
14+
[Required]
15+
[StringLength(User.MaxNameLength)]
16+
public string Name { get; set; }
17+
18+
[Required]
19+
[StringLength(User.MaxSurnameLength)]
20+
public string Surname { get; set; }
21+
22+
[Required]
23+
[StringLength(AbpUserBase.MaxUserNameLength)]
24+
public string UserName { get; set; }
25+
26+
[Required]
27+
[EmailAddress]
28+
[StringLength(AbpUserBase.MaxEmailAddressLength)]
29+
public string EmailAddress { get; set; }
30+
31+
[Required]
32+
[StringLength(User.MaxPlainPasswordLength)]
33+
[DisableAuditing]
34+
public string Password { get; set; }
35+
36+
[DisableAuditing]
37+
public string CaptchaResponse { get; set; }
38+
39+
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
40+
{
41+
if (!UserName.IsNullOrEmpty())
42+
{
43+
if (!UserName.Equals(EmailAddress) && ValidationHelper.IsEmail(UserName))
44+
{
45+
yield return new ValidationResult("Username cannot be an email address unless it's same with your email address !");
46+
}
47+
}
48+
}
49+
}
50+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto
2+
{
3+
public class RegisterOutput
4+
{
5+
public bool CanLogin { get; set; }
6+
}
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto
2+
{
3+
public enum TenantAvailabilityState
4+
{
5+
Available = 1,
6+
InActive,
7+
NotFound
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Threading.Tasks;
2+
using Abp.Application.Services;
3+
using AbpCompanyName.AbpProjectName.Authorization.Accounts.Dto;
4+
5+
namespace AbpCompanyName.AbpProjectName.Authorization.Accounts
6+
{
7+
public interface IAccountAppService : IApplicationService
8+
{
9+
Task<IsTenantAvailableOutput> IsTenantAvailable(IsTenantAvailableInput input);
10+
11+
Task<RegisterOutput> Register(RegisterInput input);
12+
}
13+
}

0 commit comments

Comments
 (0)