aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Controllers/UserDetailController.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-31 00:56:46 +0800
committer杨宇千 <crupest@outlook.com>2019-10-31 00:56:46 +0800
commitd3a1bf5f2939049f11e77f91ad9ddea30d8acd64 (patch)
tree7d034bb824b50d892136c6f1225a15e8baa30741 /Timeline/Controllers/UserDetailController.cs
parent006d799d2fe5f081c188f95a8590c4b75a93caae (diff)
downloadtimeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.tar.gz
timeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.tar.bz2
timeline-d3a1bf5f2939049f11e77f91ad9ddea30d8acd64.zip
Continue to construct feature and tests.
Diffstat (limited to 'Timeline/Controllers/UserDetailController.cs')
-rw-r--r--Timeline/Controllers/UserDetailController.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Timeline/Controllers/UserDetailController.cs b/Timeline/Controllers/UserDetailController.cs
index ef13b462..9de9899e 100644
--- a/Timeline/Controllers/UserDetailController.cs
+++ b/Timeline/Controllers/UserDetailController.cs
@@ -4,6 +4,7 @@ using Timeline.Filters;
using Timeline.Models.Validation;
using Timeline.Services;
using System.ComponentModel.DataAnnotations;
+using Microsoft.AspNetCore.Authorization;
namespace Timeline.Controllers
{
@@ -25,6 +26,8 @@ namespace Timeline.Controllers
}
[HttpPut("users/{username}/nickname")]
+ [Authorize]
+ [SelfOrAdmin]
[CatchUserNotExistException]
public async Task<ActionResult> PutNickname([FromRoute][Username] string username,
[FromBody][StringLength(10, MinimumLength = 1)] string body)
@@ -34,6 +37,8 @@ namespace Timeline.Controllers
}
[HttpDelete("users/{username}/nickname")]
+ [Authorize]
+ [SelfOrAdmin]
[CatchUserNotExistException]
public async Task<ActionResult> DeleteNickname([FromRoute][Username] string username)
{