fix(api): 403 instead of 401 on API v1 member routes
This commit is contained in:
parent
375758206e
commit
f13c60a841
@ -84,7 +84,7 @@ public class MemberController: ControllerBase
|
|||||||
if (member == null) return NotFound("Member not found.");
|
if (member == null) return NotFound("Member not found.");
|
||||||
|
|
||||||
var res = await _auth.AuthorizeAsync(User, member, "EditMember");
|
var res = await _auth.AuthorizeAsync(User, member, "EditMember");
|
||||||
if (!res.Succeeded) return Unauthorized($"Member '{hid}' is not part of your system.");
|
if (!res.Succeeded) return StatusCode(StatusCodes.Status403Forbidden, $"Member '{hid}' is not part of your system.");
|
||||||
|
|
||||||
var patch = MemberPatch.FromJSON(changes);
|
var patch = MemberPatch.FromJSON(changes);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public class MemberController: ControllerBase
|
|||||||
if (member == null) return NotFound("Member not found.");
|
if (member == null) return NotFound("Member not found.");
|
||||||
|
|
||||||
var res = await _auth.AuthorizeAsync(User, member, "EditMember");
|
var res = await _auth.AuthorizeAsync(User, member, "EditMember");
|
||||||
if (!res.Succeeded) return Unauthorized($"Member '{hid}' is not part of your system.");
|
if (!res.Succeeded) return StatusCode(StatusCodes.Status403Forbidden, $"Member '{hid}' is not part of your system.");
|
||||||
|
|
||||||
await _repo.DeleteMember(member.Id);
|
await _repo.DeleteMember(member.Id);
|
||||||
return Ok();
|
return Ok();
|
||||||
|
Loading…
Reference in New Issue
Block a user