From 5bd826d47c30f6e6ac6eded4fefb99f26786c3bc Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 30 Apr 2021 17:53:40 +0800 Subject: refactor: ... --- BackEnd/Timeline/Controllers/TimelinePostController.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BackEnd/Timeline/Controllers/TimelinePostController.cs') diff --git a/BackEnd/Timeline/Controllers/TimelinePostController.cs b/BackEnd/Timeline/Controllers/TimelinePostController.cs index 70f672d1..21102400 100644 --- a/BackEnd/Timeline/Controllers/TimelinePostController.cs +++ b/BackEnd/Timeline/Controllers/TimelinePostController.cs @@ -69,7 +69,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId())) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } var posts = await _postService.GetPostsAsync(timelineId, modifiedSince, includeDeleted ?? false); @@ -94,7 +94,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId())) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } var post = await _postService.GetPostAsync(timelineId, postId); @@ -140,7 +140,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _timelineService.HasReadPermissionAsync(timelineId, this.GetOptionalUserId())) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } return await DataCacheHelper.GenerateActionResult(this, @@ -176,7 +176,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _timelineService.IsMemberOfAsync(timelineId, userId)) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } var createRequest = new TimelinePostCreateRequest() @@ -235,7 +235,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _postService.HasPostModifyPermissionAsync(timelineId, post, this.GetUserId(), true)) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } var entity = await _postService.PatchPostAsync(timelineId, post, new TimelinePostPatchRequest { Time = body.Time, Color = body.Color }); @@ -262,7 +262,7 @@ namespace Timeline.Controllers if (!UserHasAllTimelineManagementPermission && !await _postService.HasPostModifyPermissionAsync(timelineId, post, this.GetUserId(), true)) { - return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid()); + return this.ForbidWithMessage(); } await _postService.DeletePostAsync(timelineId, post); -- cgit v1.2.3