File tree Expand file tree Collapse file tree 11 files changed +32
-23
lines changed
AbpCompanyName.AbpProjectName.Application/Users
AbpCompanyName.AbpProjectName.Web.Mvc
wwwroot/view-resources/Views Expand file tree Collapse file tree 11 files changed +32
-23
lines changed Original file line number Diff line number Diff line change 22using Abp . Auditing ;
33using Abp . Authorization . Users ;
44using Abp . AutoMapper ;
5-
65using AbpCompanyName . AbpProjectName . Authorization . Users ;
76
87namespace AbpCompanyName . AbpProjectName . Users . Dto
@@ -35,10 +34,5 @@ public class CreateUserDto
3534 [ StringLength ( AbpUserBase . MaxPlainPasswordLength ) ]
3635 [ DisableAuditing ]
3736 public string Password { get ; set ; }
38-
39- [ Required ]
40- [ StringLength ( AbpUserBase . MaxPlainPasswordLength ) ]
41- [ DisableAuditing ]
42- public string ConfirmPassword { get ; set ; }
4337 }
4438}
Original file line number Diff line number Diff line change 11using System ;
22using System . ComponentModel . DataAnnotations ;
3-
43using Abp . Application . Services . Dto ;
54using Abp . Authorization . Users ;
65using Abp . AutoMapper ;
7-
86using AbpCompanyName . AbpProjectName . Authorization . Users ;
97
108namespace AbpCompanyName . AbpProjectName . Users . Dto
@@ -17,11 +15,11 @@ public class UserDto : EntityDto<long>
1715 public string UserName { get ; set ; }
1816
1917 [ Required ]
20- [ StringLength ( User . MaxNameLength ) ]
18+ [ StringLength ( AbpUserBase . MaxNameLength ) ]
2119 public string Name { get ; set ; }
2220
2321 [ Required ]
24- [ StringLength ( User . MaxSurnameLength ) ]
22+ [ StringLength ( AbpUserBase . MaxSurnameLength ) ]
2523 public string Surname { get ; set ; }
2624
2725 [ Required ]
@@ -30,8 +28,11 @@ public class UserDto : EntityDto<long>
3028 public string EmailAddress { get ; set ; }
3129
3230 public bool IsActive { get ; set ; }
31+
3332 public string FullName { get ; set ; }
33+
3434 public DateTime ? LastLoginTime { get ; set ; }
35+
3536 public DateTime CreationTime { get ; set ; }
3637
3738 public string [ ] Roles { get ; set ; }
Original file line number Diff line number Diff line change 88using AbpCompanyName . AbpProjectName . Users . Dto ;
99using Microsoft . AspNetCore . Identity ;
1010using System . Linq ;
11+ using Abp . Collections . Extensions ;
1112using Microsoft . EntityFrameworkCore ;
1213using Abp . IdentityFramework ;
1314using AbpCompanyName . AbpProjectName . Authorization . Roles ;
@@ -47,7 +48,11 @@ public override async Task<UserDto> Create(CreateUserDto input)
4748 user . IsEmailConfirmed = true ;
4849
4950 CheckErrors ( await _userManager . CreateAsync ( user ) ) ;
50- CheckErrors ( await _userManager . SetRoles ( user , input . Roles ) ) ;
51+
52+ if ( input . Roles != null )
53+ {
54+ CheckErrors ( await _userManager . SetRoles ( user , input . Roles ) ) ;
55+ }
5156
5257 CurrentUnitOfWork . SaveChanges ( ) ;
5358
@@ -63,8 +68,12 @@ public override async Task<UserDto> Update(UserDto input)
6368 MapToEntity ( input , user ) ;
6469
6570 CheckErrors ( await _userManager . UpdateAsync ( user ) ) ;
66- CheckErrors ( await _userManager . SetRoles ( user , input . Roles ) ) ;
67-
71+
72+ if ( input . Roles != null )
73+ {
74+ CheckErrors ( await _userManager . SetRoles ( user , input . Roles ) ) ;
75+ }
76+
6877 return await Get ( input ) ;
6978 }
7079
Original file line number Diff line number Diff line change 1- using Abp . Application . Services . Dto ;
1+ using System . Threading . Tasks ;
2+ using Abp . Application . Services . Dto ;
23using Abp . AspNetCore . Mvc . Authorization ;
34using AbpCompanyName . AbpProjectName . Authorization ;
45using AbpCompanyName . AbpProjectName . Controllers ;
@@ -17,9 +18,9 @@ public TenantsController(ITenantAppService tenantAppService)
1718 _tenantAppService = tenantAppService ;
1819 }
1920
20- public ActionResult Index ( )
21+ public async Task < ActionResult > Index ( )
2122 {
22- var output = _tenantAppService . GetAll ( new PagedResultRequestDto ( ) ) ;
23+ var output = await _tenantAppService . GetAll ( new PagedResultRequestDto { MaxResultCount = int . MaxValue } ) ; //Paging not implemented yet
2324 return View ( output ) ;
2425 }
2526 }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public UsersController(IUserAppService userAppService)
2020
2121 public async Task < ActionResult > Index ( )
2222 {
23- var output = await _userAppService . GetAll ( new PagedResultRequestDto ( ) ) ;
23+ var output = await _userAppService . GetAll ( new PagedResultRequestDto { MaxResultCount = int . MaxValue } ) ; //Paging not implemented yet
2424 return View ( output ) ;
2525 }
2626 }
Original file line number Diff line number Diff line change 22@using Abp .MultiTenancy
33@using AbpCompanyName .AbpProjectName .MultiTenancy
44@using AbpCompanyName .AbpProjectName .Web .Startup
5- @model Abp .Application .Services .Dto .ListResultDto <AbpCompanyName .AbpProjectName .MultiTenancy .Dto .TenantDto >
5+ @model Abp .Application .Services .Dto .PagedResultDto <AbpCompanyName .AbpProjectName .MultiTenancy .Dto .TenantDto >
66@{
77 ViewBag .CurrentPageName = PageNames .Tenants ; // The menu item will be active for this page.
88}
9696 <label class =" form-label" >@L( "AdminEmailAddress")</label >
9797 </div >
9898 </div >
99+ <div class =" checkbox" >
100+ <input type =" checkbox" name =" IsActive" value =" true" id =" CreateTenantIsActive" class =" filled-in" checked />
101+ <label for =" CreateTenantIsActive" >@L( "IsActive")</label >
102+ </div >
99103 <p >@L( "DefaultPasswordIs", AbpCompanyName.AbpProjectName.Authorization.Users.User.DefaultPassword)</p >
100104 </div >
101105 <div class =" modal-footer" >
Original file line number Diff line number Diff line change 11@using Abp .Authorization .Users
22@using AbpCompanyName .AbpProjectName .Web .Startup
3- @model Abp .Application .Services .Dto .ListResultDto <AbpCompanyName .AbpProjectName .Users .Dto .UserDto >
3+ @model Abp .Application .Services .Dto .PagedResultDto <AbpCompanyName .AbpProjectName .Users .Dto .UserDto >
44@{
55 ViewBag .CurrentPageName = PageNames .Users ; // The menu item will be active for this page.
66}
Original file line number Diff line number Diff line change 1717 var tenant = _$form . serializeFormToObject ( ) ; //serializeFormToObject is defined in main.js
1818
1919 abp . ui . setBusy ( _$modal ) ;
20- _tenantService . createTenant ( tenant ) . done ( function ( ) {
20+ _tenantService . create ( tenant ) . done ( function ( ) {
2121 _$modal . modal ( 'hide' ) ;
2222 location . reload ( true ) ; //reload page to see new tenant!
2323 } ) . always ( function ( ) {
Original file line number Diff line number Diff line change 1717 var user = _$form . serializeFormToObject ( ) ; //serializeFormToObject is defined in main.js
1818
1919 abp . ui . setBusy ( _$modal ) ;
20- _userService . createUser ( user ) . done ( function ( ) {
20+ _userService . create ( user ) . done ( function ( ) {
2121 _$modal . modal ( 'hide' ) ;
2222 location . reload ( true ) ; //reload page to see new user!
2323 } ) . always ( function ( ) {
You can’t perform that action at this time.
0 commit comments