aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-05-05 15:58:40 +0800
committercrupest <crupest@outlook.com>2021-05-05 15:58:40 +0800
commit0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5 (patch)
tree6877c4815b54eddda828d3d89752ab964d17d1bf /BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
parent1c4be4a43c4acd2ee46e37685e9153d9c5b34233 (diff)
downloadtimeline-0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5.tar.gz
timeline-0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5.tar.bz2
timeline-0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5.zip
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs')
-rw-r--r--BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs25
1 files changed, 0 insertions, 25 deletions
diff --git a/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs b/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
deleted file mode 100644
index cd2bdadf..00000000
--- a/BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System;
-using Timeline.Auth;
-using Timeline.Services.User;
-
-namespace Timeline.Controllers
-{
- public static class ControllerAuthExtensions
- {
- public static bool UserHasPermission(this ControllerBase controller, UserPermission permission)
- {
- return controller.User.HasPermission(permission);
- }
-
- public static long GetUserId(this ControllerBase controller)
- {
- return controller.GetOptionalUserId() ?? throw new InvalidOperationException(Resource.ExceptionNoUserId);
- }
-
- public static long? GetOptionalUserId(this ControllerBase controller)
- {
- return controller.User.GetUserId();
- }
- }
-}