diff options
author | crupest <crupest@outlook.com> | 2020-11-12 23:21:31 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-12 23:21:31 +0800 |
commit | 34dea0b713aaac265909fe24eeb9483c9ec8fe2a (patch) | |
tree | 2dc2706c9d7ccd0ac2e45284bd9ff707cc49f769 /BackEnd/Timeline/Controllers/UserAvatarController.cs | |
parent | e4c4a284571d51dcda373a0a1c047e634b17882d (diff) | |
download | timeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.tar.gz timeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.tar.bz2 timeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/UserAvatarController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/UserAvatarController.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/BackEnd/Timeline/Controllers/UserAvatarController.cs b/BackEnd/Timeline/Controllers/UserAvatarController.cs index bc4afa30..44d45b76 100644 --- a/BackEnd/Timeline/Controllers/UserAvatarController.cs +++ b/BackEnd/Timeline/Controllers/UserAvatarController.cs @@ -86,7 +86,7 @@ namespace Timeline.Controllers [ProducesResponseType(StatusCodes.Status403Forbidden)]
public async Task<IActionResult> Put([FromRoute][Username] string username, [FromBody] ByteData body)
{
- if (!User.IsAdministrator() && User.Identity.Name != username)
+ if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username)
{
_logger.LogInformation(Log.Format(LogPutForbid,
("Operator Username", User.Identity.Name), ("Username To Put Avatar", username)));
@@ -149,10 +149,10 @@ namespace Timeline.Controllers [Authorize]
public async Task<IActionResult> Delete([FromRoute][Username] string username)
{
- if (!User.IsAdministrator() && User.Identity.Name != username)
+ if (!this.UserHasPermission(UserPermission.UserManagement) && User.Identity!.Name != username)
{
_logger.LogInformation(Log.Format(LogDeleteForbid,
- ("Operator Username", User.Identity.Name), ("Username To Delete Avatar", username)));
+ ("Operator Username", User.Identity!.Name), ("Username To Delete Avatar", username)));
return StatusCode(StatusCodes.Status403Forbidden, ErrorResponse.Common.Forbid());
}
|