Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 41a7ec7

Browse files
committed
alfa
1 parent 42d7259 commit 41a7ec7

9 files changed

Lines changed: 4094 additions & 18 deletions

File tree

src/Backend/Jp.Domain/CommandHandlers/RoleCommandHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class RoleCommandHandler : CommandHandler,
1313
IRequestHandler<RemoveRoleCommand>,
1414
IRequestHandler<SaveRoleCommand>,
1515
IRequestHandler<UpdateRoleCommand>,
16-
IRequestHandler<RemoveUserFromRoleCommand>
16+
IRequestHandler<RemoveUserFromRoleCommand>
1717
{
1818
private readonly IRoleService _roleService;
1919
private readonly IUserService _userService;
@@ -38,9 +38,9 @@ public async Task Handle(RemoveRoleCommand request, CancellationToken cancellati
3838
}
3939

4040
// Businness logic here
41-
await _roleService.Remove(request.Name);
41+
var result = await _roleService.Remove(request.Name);
4242

43-
if (Commit())
43+
if (result)
4444
{
4545
await Bus.RaiseEvent(new RoleRemovedEvent(request.Name));
4646
}

src/Backend/Jp.Domain/Interfaces/IRoleService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Jp.Domain.Interfaces
77
public interface IRoleService
88
{
99
Task<IEnumerable<Role>> GetAllRoles();
10-
Task Remove(string name);
10+
Task<bool> Remove(string name);
1111
Task<Role> Details(string name);
1212
Task<bool> Save(string name);
1313
Task<bool> Update(string name, string oldName);

src/Backend/Jp.Infra.CrossCutting.Identity/Services/RoleService.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ public async Task<IEnumerable<Role>> GetAllRoles()
3535
return roles.Select(s => new Role() { Id = s.Id, Name = s.Name }).ToList();
3636
}
3737

38-
public async Task Remove(string name)
38+
public async Task<bool> Remove(string name)
3939
{
4040
var roleClaim = await _roleManager.Roles.Where(x => x.Name == name).SingleOrDefaultAsync();
41+
var result = await _roleManager.DeleteAsync(roleClaim);
42+
foreach (var error in result.Errors)
43+
{
44+
await _bus.RaiseEvent(new DomainNotification(result.ToString(), error.Description));
45+
}
4146

42-
await _roleManager.DeleteAsync(roleClaim);
47+
return result.Succeeded;
4348
}
4449

4550
public async Task<Role> Details(string name)
@@ -72,6 +77,6 @@ public async Task<bool> Update(string name, string oldName)
7277
return result.Succeeded;
7378
}
7479

75-
80+
7681
}
7782
}

src/Backend/Jp.UserManagement/Controllers/RolesController.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
1+
using System.Collections.Generic;
42
using System.Threading.Tasks;
53
using Jp.Application.Interfaces;
6-
using Jp.Application.ViewModels;
74
using Jp.Application.ViewModels.RoleViewModels;
85
using Jp.Domain.Core.Bus;
96
using Jp.Domain.Core.Notifications;

src/Backend/Jp.UserManagement/jpProject_sso_log.txt

Lines changed: 1587 additions & 0 deletions
Large diffs are not rendered by default.

src/Frontend/Jp.AdminUI/src/app/panel/roles/list/roles-list.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
<div class="container-fluid" *ngIf="roles">
1717
<div class="col-xl-12 col-md-12 col-lg-12">
1818
<div class="card">
19-
<div class="card-header">
20-
<a class="btn btn-outline-primary mb-3" [routerLink]="[ '/roles/add' ]"><i class="fa fa-plus-circle"></i>
21-
{{ 'roles.new-role' | translate }}</a>
22-
</div>
19+
<div class="card-header">
20+
<a class="btn btn-outline-primary mb-3" [routerLink]="[ '/roles/add' ]"><i class="fa fa-plus-circle"></i>
21+
{{ 'roles.new-role' | translate }}</a>
22+
</div>
2323
<div class="card-body">
2424
<div class="table-responsive">
2525
<table class="table table-striped">
@@ -56,7 +56,7 @@
5656
</div>
5757

5858

59-
<div class="container-fluid" *ngIf="users$">
59+
<div class="container-fluid" *ngIf="users$ || selectedRole">
6060
<div class="col-xl-12 col-md-12 col-lg-12">
6161
<div class="card">
6262
<div class="card-header">

src/Frontend/Jp.AdminUI/src/app/panel/roles/list/roles-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class RolesListComponent implements OnInit {
5757
closeOnCancel: false
5858
}, (isConfirm) => {
5959
if (isConfirm) {
60-
60+
this.selectedRole = null;
6161
this.roleService.remove(name).subscribe(
6262
registerResult => {
6363
if (registerResult.data) {

src/Frontend/Jp.UI.SSO/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void Main(string[] args)
3030
var host = CreateWebHostBuilder(args).Build();
3131

3232
// Uncomment this to seed upon startup, alternatively pass in `dotnet run / seed` to seed using CLI
33-
Task.WaitAll(DbMigrationHelpers.EnsureSeedData(host));
33+
//Task.WaitAll(DbMigrationHelpers.EnsureSeedData(host));
3434

3535
host.Run();
3636
}

src/Frontend/Jp.UI.SSO/jpProject_sso_log.txt

Lines changed: 2487 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)