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 2
2
using Abp . Auditing ;
3
3
using Abp . Authorization . Users ;
4
4
using Abp . AutoMapper ;
5
-
6
5
using AbpCompanyName . AbpProjectName . Authorization . Users ;
7
6
8
7
namespace AbpCompanyName . AbpProjectName . Users . Dto
@@ -35,10 +34,5 @@ public class CreateUserDto
35
34
[ StringLength ( AbpUserBase . MaxPlainPasswordLength ) ]
36
35
[ DisableAuditing ]
37
36
public string Password { get ; set ; }
38
-
39
- [ Required ]
40
- [ StringLength ( AbpUserBase . MaxPlainPasswordLength ) ]
41
- [ DisableAuditing ]
42
- public string ConfirmPassword { get ; set ; }
43
37
}
44
38
}
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . ComponentModel . DataAnnotations ;
3
-
4
3
using Abp . Application . Services . Dto ;
5
4
using Abp . Authorization . Users ;
6
5
using Abp . AutoMapper ;
7
-
8
6
using AbpCompanyName . AbpProjectName . Authorization . Users ;
9
7
10
8
namespace AbpCompanyName . AbpProjectName . Users . Dto
@@ -17,11 +15,11 @@ public class UserDto : EntityDto<long>
17
15
public string UserName { get ; set ; }
18
16
19
17
[ Required ]
20
- [ StringLength ( User . MaxNameLength ) ]
18
+ [ StringLength ( AbpUserBase . MaxNameLength ) ]
21
19
public string Name { get ; set ; }
22
20
23
21
[ Required ]
24
- [ StringLength ( User . MaxSurnameLength ) ]
22
+ [ StringLength ( AbpUserBase . MaxSurnameLength ) ]
25
23
public string Surname { get ; set ; }
26
24
27
25
[ Required ]
@@ -30,8 +28,11 @@ public class UserDto : EntityDto<long>
30
28
public string EmailAddress { get ; set ; }
31
29
32
30
public bool IsActive { get ; set ; }
31
+
33
32
public string FullName { get ; set ; }
33
+
34
34
public DateTime ? LastLoginTime { get ; set ; }
35
+
35
36
public DateTime CreationTime { get ; set ; }
36
37
37
38
public string [ ] Roles { get ; set ; }
Original file line number Diff line number Diff line change 8
8
using AbpCompanyName . AbpProjectName . Users . Dto ;
9
9
using Microsoft . AspNetCore . Identity ;
10
10
using System . Linq ;
11
+ using Abp . Collections . Extensions ;
11
12
using Microsoft . EntityFrameworkCore ;
12
13
using Abp . IdentityFramework ;
13
14
using AbpCompanyName . AbpProjectName . Authorization . Roles ;
@@ -47,7 +48,11 @@ public override async Task<UserDto> Create(CreateUserDto input)
47
48
user . IsEmailConfirmed = true ;
48
49
49
50
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
+ }
51
56
52
57
CurrentUnitOfWork . SaveChanges ( ) ;
53
58
@@ -63,8 +68,12 @@ public override async Task<UserDto> Update(UserDto input)
63
68
MapToEntity ( input , user ) ;
64
69
65
70
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
+
68
77
return await Get ( input ) ;
69
78
}
70
79
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 ;
2
3
using Abp . AspNetCore . Mvc . Authorization ;
3
4
using AbpCompanyName . AbpProjectName . Authorization ;
4
5
using AbpCompanyName . AbpProjectName . Controllers ;
@@ -17,9 +18,9 @@ public TenantsController(ITenantAppService tenantAppService)
17
18
_tenantAppService = tenantAppService ;
18
19
}
19
20
20
- public ActionResult Index ( )
21
+ public async Task < ActionResult > Index ( )
21
22
{
22
- var output = _tenantAppService . GetAll ( new PagedResultRequestDto ( ) ) ;
23
+ var output = await _tenantAppService . GetAll ( new PagedResultRequestDto { MaxResultCount = int . MaxValue } ) ; //Paging not implemented yet
23
24
return View ( output ) ;
24
25
}
25
26
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public UsersController(IUserAppService userAppService)
20
20
21
21
public async Task < ActionResult > Index ( )
22
22
{
23
- var output = await _userAppService . GetAll ( new PagedResultRequestDto ( ) ) ;
23
+ var output = await _userAppService . GetAll ( new PagedResultRequestDto { MaxResultCount = int . MaxValue } ) ; //Paging not implemented yet
24
24
return View ( output ) ;
25
25
}
26
26
}
Original file line number Diff line number Diff line change 2
2
@using Abp .MultiTenancy
3
3
@using AbpCompanyName .AbpProjectName .MultiTenancy
4
4
@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 >
6
6
@{
7
7
ViewBag .CurrentPageName = PageNames .Tenants ; // The menu item will be active for this page.
8
8
}
96
96
<label class =" form-label" >@L( "AdminEmailAddress")</label >
97
97
</div >
98
98
</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 >
99
103
<p >@L( "DefaultPasswordIs", AbpCompanyName.AbpProjectName.Authorization.Users.User.DefaultPassword)</p >
100
104
</div >
101
105
<div class =" modal-footer" >
Original file line number Diff line number Diff line change 1
1
@using Abp .Authorization .Users
2
2
@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 >
4
4
@{
5
5
ViewBag .CurrentPageName = PageNames .Users ; // The menu item will be active for this page.
6
6
}
Original file line number Diff line number Diff line change 17
17
var tenant = _$form . serializeFormToObject ( ) ; //serializeFormToObject is defined in main.js
18
18
19
19
abp . ui . setBusy ( _$modal ) ;
20
- _tenantService . createTenant ( tenant ) . done ( function ( ) {
20
+ _tenantService . create ( tenant ) . done ( function ( ) {
21
21
_$modal . modal ( 'hide' ) ;
22
22
location . reload ( true ) ; //reload page to see new tenant!
23
23
} ) . always ( function ( ) {
Original file line number Diff line number Diff line change 17
17
var user = _$form . serializeFormToObject ( ) ; //serializeFormToObject is defined in main.js
18
18
19
19
abp . ui . setBusy ( _$modal ) ;
20
- _userService . createUser ( user ) . done ( function ( ) {
20
+ _userService . create ( user ) . done ( function ( ) {
21
21
_$modal . modal ( 'hide' ) ;
22
22
location . reload ( true ) ; //reload page to see new user!
23
23
} ) . always ( function ( ) {
You can’t perform that action at this time.
0 commit comments