-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from BeniceSoft/dev/feat-sso-clientapp
Dev/feat sso clientapp
- Loading branch information
Showing
17 changed files
with
97 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "AdminUI"] | ||
path = AdminUI | ||
url = https://github.com/BeniceSoft/OpenAuthing-AdminUI.git | ||
Submodule AdminUI
deleted from
a6e324
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/BeniceSoft.OpenAuthing.Application/Commands/Departments/DeleteDepartmentCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using MediatR; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.Departments; | ||
|
||
public class DeleteDepartmentCommand : IRequest<bool> | ||
{ | ||
public DeleteDepartmentCommand(Guid departmentId) | ||
{ | ||
DepartmentId = departmentId; | ||
} | ||
|
||
public Guid DepartmentId { get; private set; } | ||
} |
37 changes: 37 additions & 0 deletions
37
...BeniceSoft.OpenAuthing.Application/Commands/Departments/DeleteDepartmentCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using BeniceSoft.OpenAuthing.Entities.Departments; | ||
using MediatR; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Domain.Entities; | ||
using Volo.Abp.Domain.Repositories; | ||
|
||
namespace BeniceSoft.OpenAuthing.Commands.Departments; | ||
|
||
public class DeleteDepartmentCommandHandler : IRequestHandler<DeleteDepartmentCommand, bool>, ITransientDependency | ||
{ | ||
private readonly IRepository<Department,Guid> _departmentRepository; | ||
|
||
public DeleteDepartmentCommandHandler(IRepository<Department, Guid> departmentRepository) | ||
{ | ||
_departmentRepository = departmentRepository; | ||
} | ||
|
||
public async Task<bool> Handle(DeleteDepartmentCommand request, CancellationToken cancellationToken) | ||
{ | ||
// 删除部门及子部门 | ||
var department = await _departmentRepository.GetAsync(request.DepartmentId, cancellationToken: cancellationToken); | ||
if (department == null) | ||
{ | ||
throw new EntityNotFoundException(typeof(Department), request.DepartmentId); | ||
} | ||
// 删除当前部门 | ||
await _departmentRepository.DeleteAsync(department, cancellationToken: cancellationToken); | ||
// 删除当前部门下的子部门,使用部门上的 path 字段判断 | ||
var children = await _departmentRepository.GetListAsync(x => x.Path.StartsWith(department.Path), cancellationToken: cancellationToken); | ||
foreach (var child in children) | ||
{ | ||
await _departmentRepository.DeleteAsync(child, cancellationToken: cancellationToken); | ||
} | ||
|
||
return true; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/BeniceSoft.OpenAuthing.SSO/ServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters