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 | 4b413d32ef7b21bc2e35086ae0e695438eec6d43 (patch) | |
tree | a5e99c70ca24e827730b15f3ea3aa8664badc24d /BackEnd/Timeline/Controllers/ControllerAuthExtensions.cs | |
parent | cc6d33511a6a4c43630a36b13d03db57f432520c (diff) | |
download | timeline-4b413d32ef7b21bc2e35086ae0e695438eec6d43.tar.gz timeline-4b413d32ef7b21bc2e35086ae0e695438eec6d43.tar.bz2 timeline-4b413d32ef7b21bc2e35086ae0e695438eec6d43.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();
- }
- }
-}
|