From 0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 5 May 2021 15:58:40 +0800 Subject: refactor: ... --- BackEnd/Timeline/Controllers/UserAvatarController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'BackEnd/Timeline/Controllers/UserAvatarController.cs') diff --git a/BackEnd/Timeline/Controllers/UserAvatarController.cs b/BackEnd/Timeline/Controllers/UserAvatarController.cs index 47d46a54..376e1f11 100644 --- a/BackEnd/Timeline/Controllers/UserAvatarController.cs +++ b/BackEnd/Timeline/Controllers/UserAvatarController.cs @@ -18,7 +18,7 @@ namespace Timeline.Controllers /// [ApiController] [ProducesErrorResponseType(typeof(CommonResponse))] - public class UserAvatarController : Controller + public class UserAvatarController : MyControllerBase { private readonly IUserService _userService; private readonly IUserAvatarService _service; @@ -62,9 +62,9 @@ namespace Timeline.Controllers [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task Put([FromRoute][Username] string username, [FromBody] ByteData body) { - if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username) + if (!UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username) { - return this.ForbidWithMessage(Resource.MessageForbidNotAdministratorOrOwner); + return ForbidWithCommonResponse(Resource.MessageForbidNotAdministratorOrOwner); } long id = await _userService.GetUserIdByUsernameAsync(username); @@ -105,9 +105,9 @@ namespace Timeline.Controllers [Authorize] public async Task Delete([FromRoute][Username] string username) { - if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username) + if (!UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username) { - return this.ForbidWithMessage(Resource.MessageForbidNotAdministratorOrOwner); + return ForbidWithCommonResponse(Resource.MessageForbidNotAdministratorOrOwner); } long id = await _userService.GetUserIdByUsernameAsync(username); -- cgit v1.2.3