From d3a1bf5f2939049f11e77f91ad9ddea30d8acd64 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Thu, 31 Oct 2019 00:56:46 +0800 Subject: Continue to construct feature and tests. --- Timeline/Auth/Attribute.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Timeline/Auth/Attribute.cs (limited to 'Timeline/Auth/Attribute.cs') diff --git a/Timeline/Auth/Attribute.cs b/Timeline/Auth/Attribute.cs new file mode 100644 index 00000000..86d0109b --- /dev/null +++ b/Timeline/Auth/Attribute.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Authorization; +using Timeline.Entities; + +namespace Timeline.Auth +{ + public class AdminAuthorizeAttribute : AuthorizeAttribute + { + public AdminAuthorizeAttribute() + { + Roles = UserRoles.Admin; + } + } + + public class UserAuthorizeAttribute : AuthorizeAttribute + { + public UserAuthorizeAttribute() + { + Roles = UserRoles.User; + } + } +} -- cgit v1.2.3