From 17ef86c81c24c1cda900d0c05feb2265acc2524b Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 11 Mar 2020 17:25:39 +0800 Subject: New logic for HasPostModifyPermission --- Timeline/Controllers/TimelineController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Timeline/Controllers') diff --git a/Timeline/Controllers/TimelineController.cs b/Timeline/Controllers/TimelineController.cs index 440b0d19..d21603cd 100644 --- a/Timeline/Controllers/TimelineController.cs +++ b/Timeline/Controllers/TimelineController.cs @@ -189,12 +189,12 @@ namespace Timeline.Controllers [Authorize] public async Task> PostDelete([FromRoute][GeneralTimelineName] string name, [FromRoute] long id) { + if (!this.IsAdministrator() && !await _service.HasPostModifyPermission(name, id, this.GetUserId())) + { + return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + } try { - if (!this.IsAdministrator() && !await _service.HasPostModifyPermission(name, id, this.GetUserId())) - { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); - } await _service.DeletePost(name, id); return CommonDeleteResponse.Delete(); } -- cgit v1.2.3