From 67b6f46a4fe712b55d00a54059bbfdbb52745e9a Mon Sep 17 00:00:00 2001 From: Kjetil Haugland Date: Thu, 5 Dec 2024 14:11:58 +0100 Subject: [PATCH] Remove unused files --- .../AuthorizationServiceExtensions.cs | 18 ------------------ .../Authorization/Policies.cs | 16 ---------------- 2 files changed, 34 deletions(-) delete mode 100644 backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs delete mode 100644 backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs diff --git a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs b/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs deleted file mode 100644 index 7f62318ee..000000000 --- a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using System.Security.Claims; - -namespace Equinor.ProjectExecutionPortal.WebApi.Authorization.Extensions -{ - public static class AuthorizationServiceExtensions - { - public static async Task RequireAuthorizationAsync(this IAuthorizationService authorizationService, ClaimsPrincipal user, object? resource, string policy) - { - var result = await authorizationService.AuthorizeAsync(user, resource, policy); - - if (!result.Succeeded) - { - throw new UnauthorizedAccessException("User is not authorized"); - } - } - } -} diff --git a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs b/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs deleted file mode 100644 index 8cab161b6..000000000 --- a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs +++ /dev/null @@ -1,16 +0,0 @@ -public static class Policies -{ - public static class ProjectPortal - { - public const string Admin = "ProjectPortal.Admin"; - - public static class Portal - { - public const string List = "ProjectPortal.Portal.List"; - public const string Read = "ProjectPortal.Portal.Read"; - public const string Create = "ProjectPortal.Portal.Create"; - public const string Update = "ProjectPortal.Portal.Update"; - public const string Delete = "ProjectPortal.Portal.Delete"; - } - } -}