From c84faf2b8f5a55ae170e92ead6516e573a318e65 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Tue, 23 Jul 2019 18:01:04 +0800 Subject: WIP: Change UserController. --- Timeline/Authenticate/Attribute.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Timeline/Authenticate/Attribute.cs (limited to 'Timeline/Authenticate/Attribute.cs') diff --git a/Timeline/Authenticate/Attribute.cs b/Timeline/Authenticate/Attribute.cs new file mode 100644 index 00000000..50b2681d --- /dev/null +++ b/Timeline/Authenticate/Attribute.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Authorization; +using Timeline.Models; + +namespace Timeline.Authenticate +{ + public class AdminAuthorizeAttribute : AuthorizeAttribute + { + public AdminAuthorizeAttribute() + { + Roles = UserRoles.Admin; + } + } + + public class UserAuthorizeAttribute : AuthorizeAttribute + { + public UserAuthorizeAttribute() + { + Roles = UserRoles.User; + } + } +} -- cgit v1.2.3