From 52e0539028e669007370115926188381b719f459 Mon Sep 17 00:00:00 2001 From: Kevin BEAUGRAND <9513635+kbeaugrand@users.noreply.github.com> Date: Sun, 23 Jan 2022 21:45:14 +0100 Subject: [PATCH] remove role management in solution (#91) Co-authored-by: Beaugrand, Kevin --- src/AzureIoTHub.Portal/Client/Pages/Users/Delete.razor | 1 - src/AzureIoTHub.Portal/Client/Pages/Users/Invite.razor | 1 - src/AzureIoTHub.Portal/Client/Pages/Users/Users.razor | 1 - src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor | 5 +---- .../Server/Controllers/CommandsController.cs | 1 - .../Server/Controllers/ConfigsController.cs | 1 - .../Server/Controllers/DeviceModelsController.cs | 1 - .../Server/Controllers/DevicesController.cs | 1 - .../Server/Controllers/GatewaysController.cs | 1 - src/AzureIoTHub.Portal/Server/Controllers/UsersController.cs | 1 - src/AzureIoTHub.Portal/Server/Startup.cs | 1 - 11 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/AzureIoTHub.Portal/Client/Pages/Users/Delete.razor b/src/AzureIoTHub.Portal/Client/Pages/Users/Delete.razor index 21b94a59f..7fec9f54f 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Users/Delete.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Users/Delete.razor @@ -6,7 +6,6 @@ @using AzureIoTHub.Portal.Shared.Security -@attribute [Authorize(Roles = RoleNames.Admin)] @inject HttpClient Http @inject IJSRuntime JS diff --git a/src/AzureIoTHub.Portal/Client/Pages/Users/Invite.razor b/src/AzureIoTHub.Portal/Client/Pages/Users/Invite.razor index b1c36d72e..46d3dcc25 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Users/Invite.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Users/Invite.razor @@ -5,7 +5,6 @@ @using AzureIoTHub.Portal.Shared.Security @using AzureIoTHub.Portal.Shared.UserManagement -@attribute [Authorize(Roles = RoleNames.Admin)] @inject HttpClient Http @inject IJSRuntime JS diff --git a/src/AzureIoTHub.Portal/Client/Pages/Users/Users.razor b/src/AzureIoTHub.Portal/Client/Pages/Users/Users.razor index 367826f97..629ca73bd 100644 --- a/src/AzureIoTHub.Portal/Client/Pages/Users/Users.razor +++ b/src/AzureIoTHub.Portal/Client/Pages/Users/Users.razor @@ -7,7 +7,6 @@ @using Blazored.Modal @using Blazored.Modal.Services -@attribute [Authorize(Roles = RoleNames.Admin)] @inject HttpClient Http @inject IModalService modal @inject IJSRuntime JS diff --git a/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor b/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor index e748aac10..b6be53972 100644 --- a/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor +++ b/src/AzureIoTHub.Portal/Client/Shared/NavMenu.razor @@ -7,10 +7,7 @@ Devices - @if (context.User.IsInRole(RoleNames.Admin)) - { - Users - } + Users Overview Configuration diff --git a/src/AzureIoTHub.Portal/Server/Controllers/CommandsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/CommandsController.cs index b39fed79e..5e8c4284e 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/CommandsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/CommandsController.cs @@ -23,7 +23,6 @@ namespace AzureIoTHub.Portal.Server.Controllers [Authorize] [ApiController] [Route("api/[controller]")] - [Authorize(Roles = RoleNames.Admin)] public class CommandsController : ControllerBase { private readonly ITableClientFactory tableClientFactory; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/ConfigsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/ConfigsController.cs index b83cf0c34..241c12712 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/ConfigsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/ConfigsController.cs @@ -27,7 +27,6 @@ namespace AzureIoTHub.Portal.Server.Controllers [Authorize] [ApiController] [Route("api/[controller]")] - [Authorize(Roles = RoleNames.Admin)] public class ConfigsController : ControllerBase { diff --git a/src/AzureIoTHub.Portal/Server/Controllers/DeviceModelsController.cs b/src/AzureIoTHub.Portal/Server/Controllers/DeviceModelsController.cs index 01e564e2e..b6020911c 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/DeviceModelsController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/DeviceModelsController.cs @@ -23,7 +23,6 @@ namespace AzureIoTHub.Portal.Server.Controllers [Authorize] [ApiController] [Route("api/[controller]")] - [Authorize(Roles = RoleNames.Admin)] public class DeviceModelsController : ControllerBase { private const string DefaultPartitionKey = "0"; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/DevicesController.cs b/src/AzureIoTHub.Portal/Server/Controllers/DevicesController.cs index c164ea224..88412013f 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/DevicesController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/DevicesController.cs @@ -23,7 +23,6 @@ namespace AzureIoTHub.Portal.Server.Controllers using Microsoft.Azure.Devices.Shared; using Microsoft.Extensions.Logging; - [Authorize(Roles = RoleNames.Admin)] [ApiController] [Route("api/[controller]")] public class DevicesController : ControllerBase diff --git a/src/AzureIoTHub.Portal/Server/Controllers/GatewaysController.cs b/src/AzureIoTHub.Portal/Server/Controllers/GatewaysController.cs index 32d925adf..232ec9dba 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/GatewaysController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/GatewaysController.cs @@ -29,7 +29,6 @@ namespace AzureIoTHub.Portal.Server.Controllers [Authorize] [ApiController] [Route("api/[controller]")] - [Authorize(Roles = RoleNames.Admin)] public class GatewaysController : ControllerBase { private readonly ILogger logger; diff --git a/src/AzureIoTHub.Portal/Server/Controllers/UsersController.cs b/src/AzureIoTHub.Portal/Server/Controllers/UsersController.cs index 5fa883c5a..35652ad8b 100644 --- a/src/AzureIoTHub.Portal/Server/Controllers/UsersController.cs +++ b/src/AzureIoTHub.Portal/Server/Controllers/UsersController.cs @@ -18,7 +18,6 @@ namespace AzureIoTHub.Portal.Server.Controllers [ApiController] [Route("api/[controller]")] - [Authorize(Roles = RoleNames.Admin)] public class UsersController : Controller { private readonly GraphServiceClient graphClient; diff --git a/src/AzureIoTHub.Portal/Server/Startup.cs b/src/AzureIoTHub.Portal/Server/Startup.cs index 35a8bcff5..094bae4ac 100644 --- a/src/AzureIoTHub.Portal/Server/Startup.cs +++ b/src/AzureIoTHub.Portal/Server/Startup.cs @@ -63,7 +63,6 @@ public void ConfigureServices(IServiceCollection services) .AddMicrosoftIdentityWebApi( jwtOopts => { - jwtOopts.TokenValidationParameters.RoleClaimType = "extension_Role"; }, identityOpts => {