-
Notifications
You must be signed in to change notification settings - Fork 1
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 #1323 from DFE-Digital/create-case-delete-button
Create case delete button
- Loading branch information
Showing
133 changed files
with
4,606 additions
and
5,346 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...Work.API.Contracts/Case/CloseCaseError.cs → ...API.Contracts/Case/CaseValidationError.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
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ public enum CasePermission | |
{ | ||
None = 0, | ||
View = 1, | ||
Edit = 2 | ||
Edit = 2, | ||
EditAndDelete = 3 | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
ConcernsCaseWork/ConcernsCaseWork.API/Features/Permissions/IsCaseDeletableStrategy.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,34 @@ | ||
using Ardalis.GuardClauses; | ||
using ConcernsCaseWork.API.Contracts.Permissions; | ||
using ConcernsCaseWork.Data.Models; | ||
using ConcernsCaseWork.UserContext; | ||
|
||
namespace ConcernsCaseWork.API.Features.Permissions; | ||
|
||
/// <summary> | ||
/// A strategy for inspecting a case and user and determining if the user is permitted to delete the case & entities. | ||
/// </summary> | ||
public class IsCaseDeletableStrategy : ICaseActionPermissionStrategy | ||
{ | ||
/// <summary> | ||
/// Inspects the case and user info passed and determines if the user should be permitted to delete the case & entities. | ||
/// </summary> | ||
/// <param name="concernsCase">The case to be considered. If null then none permission will be returned</param> | ||
/// <param name="userInfo">The user info to be considered. If null then an exception will be thrown</param> | ||
/// <returns></returns> | ||
public CasePermission GetAllowedActionPermission(ConcernsCase concernsCase, UserInfo userInfo) | ||
{ | ||
// Deletable if user is delete case admin group. | ||
// Otherwise not deletable | ||
|
||
if (concernsCase == null) | ||
return CasePermission.None; | ||
|
||
Guard.Against.Null(userInfo); | ||
|
||
if (userInfo.IsInCaseDeleteGroup()) | ||
return CasePermission.EditAndDelete; | ||
|
||
return CasePermission.None; | ||
} | ||
} |
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
Oops, something went wrong.