diff options
author | crupest <crupest@outlook.com> | 2021-05-05 15:58:40 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-05 15:58:40 +0800 |
commit | 0accc9f09d0aaf2292cb94e3c4e438c3f76f89e5 (patch) | |
tree | 6877c4815b54eddda828d3d89752ab964d17d1bf /BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs | |
parent | 1c4be4a43c4acd2ee46e37685e9153d9c5b34233 (diff) | |
download | timeline-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.cs | 25 |
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();
- }
- }
-}
|