aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-12 23:21:31 +0800
committercrupest <crupest@outlook.com>2020-11-12 23:21:31 +0800
commit34dea0b713aaac265909fe24eeb9483c9ec8fe2a (patch)
tree2dc2706c9d7ccd0ac2e45284bd9ff707cc49f769 /BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
parente4c4a284571d51dcda373a0a1c047e634b17882d (diff)
downloadtimeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.tar.gz
timeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.tar.bz2
timeline-34dea0b713aaac265909fe24eeb9483c9ec8fe2a.zip
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs')
-rw-r--r--BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs b/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
index 00a65454..9096978d 100644
--- a/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
+++ b/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
@@ -2,15 +2,16 @@
using System;
using System.Security.Claims;
using Timeline.Auth;
+using Timeline.Services;
using static Timeline.Resources.Controllers.ControllerAuthExtensions;
namespace Timeline.Controllers
{
public static class ControllerAuthExtensions
{
- public static bool IsAdministrator(this ControllerBase controller)
+ public static bool UserHasPermission(this ControllerBase controller, UserPermission permission)
{
- return controller.User != null && controller.User.IsAdministrator();
+ return controller.User != null && controller.User.HasPermission(permission);
}
public static long GetUserId(this ControllerBase controller)