Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b6ea53f

Browse files
committed
update: check by token & admin
1 parent 5345cff commit b6ea53f

File tree

4 files changed

+40
-62
lines changed

4 files changed

+40
-62
lines changed

‎.idea/.idea.Web-Series-API--ASP.NET/.idea/workspace.xml‎

Lines changed: 30 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Web-Series-API--ASP.NET/Auth/AdminChecker.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override void OnAuthorization(HttpActionContext actionContext)
1919
{
2020
if (TokenService.GetLoginByToken(header.ToString()).Equals("Admin"))
2121
{
22-
22+
2323
}
2424
else
2525
{

‎Web-Series-API--ASP.NET/Auth/TokenChecker.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override void OnAuthorization(HttpActionContext actionContext)
2222
{
2323
if (AuthService.isAuthenticated((header.ToString())))
2424
{
25-
25+
2626
}
2727
else
2828
{

‎Web-Series-API--ASP.NET/Controllers/UserController.cs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace Web_Series_API__ASP.NET.Controllers
1313
{
14-
// [TokenChecker]
14+
[TokenChecker]
1515
[EnableCors("*", "*", "*")]
1616
public class UserController : ApiController
1717
{
18-
// [AdminChecker]
18+
[AdminChecker]
1919
[Route("api/users")]
2020
[HttpGet]
2121
public HttpResponseMessage Get()
@@ -31,7 +31,7 @@ public HttpResponseMessage Get()
3131
}
3232
}
3333

34-
34+
[AdminChecker]
3535
[Route("api/user/{id}")]
3636
[HttpGet]
3737
public HttpResponseMessage Get(int id)
@@ -46,7 +46,8 @@ public HttpResponseMessage Get(int id)
4646
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Error user not found", e);
4747
}
4848
}
49-
49+
50+
[AdminChecker]
5051
[Route("api/user/create")]
5152
[HttpPost]
5253
public HttpResponseMessage Post(UserModel user)
@@ -63,6 +64,7 @@ public HttpResponseMessage Post(UserModel user)
6364
}
6465
}
6566

67+
[AdminChecker]
6668
[Route("api/user/edit")]
6769
[HttpPut]
6870
public HttpResponseMessage Put(UserModel user)
@@ -78,6 +80,8 @@ public HttpResponseMessage Put(UserModel user)
7880
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Error updating user", e);
7981
}
8082
}
83+
84+
[AdminChecker]
8185
[Route("api/user/remove/{id}")]
8286
[HttpDelete]
8387
public HttpResponseMessage Delete(int id)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /