From 531d23599b40ad48fcfc7cd94f35ba8215047089 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 18 May 2019 03:02:49 +0100 Subject: [PATCH] Set all admin controllers as requiring authorization. --- .../Admin/Controllers/BrowserTestsController.cs | 11 +++-------- .../Controllers/CompanyDescriptionsController.cs | 2 ++ cicm_web/Areas/Admin/Controllers/GpusController.cs | 2 ++ .../InstructionSetExtensionsController.cs | 12 ++++-------- .../Admin/Controllers/InstructionSetsController.cs | 12 ++++-------- .../Admin/Controllers/MachineFamiliesController.cs | 2 ++ .../Areas/Admin/Controllers/MachinesController.cs | 2 ++ .../Admin/Controllers/MemoryByMachinesController.cs | 2 ++ cicm_web/Areas/Admin/Controllers/NewsController.cs | 12 ++++-------- .../Controllers/ProcessorsByMachinesController.cs | 2 ++ .../Areas/Admin/Controllers/ProcessorsController.cs | 2 ++ .../Areas/Admin/Controllers/ResolutionsController.cs | 12 ++++-------- .../Areas/Admin/Controllers/SoundSynthsController.cs | 2 ++ .../Admin/Controllers/StorageByMachinesController.cs | 2 ++ 14 files changed, 37 insertions(+), 40 deletions(-) diff --git a/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs b/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs index 1ac9d6b8..7d1cb782 100644 --- a/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs +++ b/cicm_web/Areas/Admin/Controllers/BrowserTestsController.cs @@ -38,6 +38,7 @@ using Microsoft.EntityFrameworkCore; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class BrowserTestsController : Controller { readonly cicmContext _context; @@ -48,10 +49,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/BrowserTests - public async Task Index() - { - return View(await _context.BrowserTests.ToListAsync()); - } + public async Task Index() => View(await _context.BrowserTests.ToListAsync()); // GET: Admin/BrowserTests/Details/5 public async Task Details(int? id) @@ -65,10 +63,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/BrowserTests/Create - public IActionResult Create() - { - return View(); - } + public IActionResult Create() => View(); // POST: Admin/BrowserTests/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for diff --git a/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs b/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs index 03135a14..0506e667 100644 --- a/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs +++ b/cicm_web/Areas/Admin/Controllers/CompanyDescriptionsController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class CompanyDescriptionsController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/GpusController.cs b/cicm_web/Areas/Admin/Controllers/GpusController.cs index 2518e9aa..2ecc8e8f 100644 --- a/cicm_web/Areas/Admin/Controllers/GpusController.cs +++ b/cicm_web/Areas/Admin/Controllers/GpusController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class GpusController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/InstructionSetExtensionsController.cs b/cicm_web/Areas/Admin/Controllers/InstructionSetExtensionsController.cs index f50d364f..b73b6d75 100644 --- a/cicm_web/Areas/Admin/Controllers/InstructionSetExtensionsController.cs +++ b/cicm_web/Areas/Admin/Controllers/InstructionSetExtensionsController.cs @@ -31,12 +31,14 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class InstructionSetExtensionsController : Controller { readonly cicmContext _context; @@ -47,10 +49,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/InstructionSetExtensions - public async Task Index() - { - return View(await _context.InstructionSetExtensions.ToListAsync()); - } + public async Task Index() => View(await _context.InstructionSetExtensions.ToListAsync()); // GET: Admin/InstructionSetExtensions/Details/5 public async Task Details(int? id) @@ -65,10 +64,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/InstructionSetExtensions/Create - public IActionResult Create() - { - return View(); - } + public IActionResult Create() => View(); // POST: Admin/InstructionSetExtensions/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for diff --git a/cicm_web/Areas/Admin/Controllers/InstructionSetsController.cs b/cicm_web/Areas/Admin/Controllers/InstructionSetsController.cs index 617a1ca9..09a45413 100644 --- a/cicm_web/Areas/Admin/Controllers/InstructionSetsController.cs +++ b/cicm_web/Areas/Admin/Controllers/InstructionSetsController.cs @@ -31,12 +31,14 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class InstructionSetsController : Controller { readonly cicmContext _context; @@ -47,10 +49,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/InstructionSets - public async Task Index() - { - return View(await _context.InstructionSets.ToListAsync()); - } + public async Task Index() => View(await _context.InstructionSets.ToListAsync()); // GET: Admin/InstructionSets/Details/5 public async Task Details(int? id) @@ -64,10 +63,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/InstructionSets/Create - public IActionResult Create() - { - return View(); - } + public IActionResult Create() => View(); // POST: Admin/InstructionSets/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for diff --git a/cicm_web/Areas/Admin/Controllers/MachineFamiliesController.cs b/cicm_web/Areas/Admin/Controllers/MachineFamiliesController.cs index 923be28b..c6adc0f8 100644 --- a/cicm_web/Areas/Admin/Controllers/MachineFamiliesController.cs +++ b/cicm_web/Areas/Admin/Controllers/MachineFamiliesController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class MachineFamiliesController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/MachinesController.cs b/cicm_web/Areas/Admin/Controllers/MachinesController.cs index 43c5ca63..2f17e189 100644 --- a/cicm_web/Areas/Admin/Controllers/MachinesController.cs +++ b/cicm_web/Areas/Admin/Controllers/MachinesController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class MachinesController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/MemoryByMachinesController.cs b/cicm_web/Areas/Admin/Controllers/MemoryByMachinesController.cs index da458fae..5265a0fd 100644 --- a/cicm_web/Areas/Admin/Controllers/MemoryByMachinesController.cs +++ b/cicm_web/Areas/Admin/Controllers/MemoryByMachinesController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class MemoryByMachinesController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/NewsController.cs b/cicm_web/Areas/Admin/Controllers/NewsController.cs index 99c0be4f..af6f1ef7 100644 --- a/cicm_web/Areas/Admin/Controllers/NewsController.cs +++ b/cicm_web/Areas/Admin/Controllers/NewsController.cs @@ -31,12 +31,14 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class NewsController : Controller { readonly cicmContext _context; @@ -47,10 +49,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/News - public async Task Index() - { - return View(await _context.News.ToListAsync()); - } + public async Task Index() => View(await _context.News.ToListAsync()); // GET: Admin/News/Details/5 public async Task Details(int? id) @@ -64,10 +63,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/News/Create - public IActionResult Create() - { - return View(); - } + public IActionResult Create() => View(); // POST: Admin/News/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for diff --git a/cicm_web/Areas/Admin/Controllers/ProcessorsByMachinesController.cs b/cicm_web/Areas/Admin/Controllers/ProcessorsByMachinesController.cs index 1b5a8126..061a1867 100644 --- a/cicm_web/Areas/Admin/Controllers/ProcessorsByMachinesController.cs +++ b/cicm_web/Areas/Admin/Controllers/ProcessorsByMachinesController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class ProcessorsByMachinesController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/ProcessorsController.cs b/cicm_web/Areas/Admin/Controllers/ProcessorsController.cs index c98f7223..b9e39b68 100644 --- a/cicm_web/Areas/Admin/Controllers/ProcessorsController.cs +++ b/cicm_web/Areas/Admin/Controllers/ProcessorsController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class ProcessorsController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/ResolutionsController.cs b/cicm_web/Areas/Admin/Controllers/ResolutionsController.cs index 0d13173b..f2cdbeb3 100644 --- a/cicm_web/Areas/Admin/Controllers/ResolutionsController.cs +++ b/cicm_web/Areas/Admin/Controllers/ResolutionsController.cs @@ -31,12 +31,14 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class ResolutionsController : Controller { readonly cicmContext _context; @@ -47,10 +49,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/Resolutions - public async Task Index() - { - return View(await _context.Resolutions.ToListAsync()); - } + public async Task Index() => View(await _context.Resolutions.ToListAsync()); // GET: Admin/Resolutions/Details/5 public async Task Details(int? id) @@ -64,10 +63,7 @@ namespace cicm_web.Areas.Admin.Controllers } // GET: Admin/Resolutions/Create - public IActionResult Create() - { - return View(); - } + public IActionResult Create() => View(); // POST: Admin/Resolutions/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for diff --git a/cicm_web/Areas/Admin/Controllers/SoundSynthsController.cs b/cicm_web/Areas/Admin/Controllers/SoundSynthsController.cs index 85127521..545496f0 100644 --- a/cicm_web/Areas/Admin/Controllers/SoundSynthsController.cs +++ b/cicm_web/Areas/Admin/Controllers/SoundSynthsController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class SoundSynthsController : Controller { readonly cicmContext _context; diff --git a/cicm_web/Areas/Admin/Controllers/StorageByMachinesController.cs b/cicm_web/Areas/Admin/Controllers/StorageByMachinesController.cs index d8553c73..0713d369 100644 --- a/cicm_web/Areas/Admin/Controllers/StorageByMachinesController.cs +++ b/cicm_web/Areas/Admin/Controllers/StorageByMachinesController.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Threading.Tasks; using Cicm.Database.Models; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; @@ -39,6 +40,7 @@ using Microsoft.EntityFrameworkCore.Query; namespace cicm_web.Areas.Admin.Controllers { [Area("Admin")] + [Authorize] public class StorageByMachinesController : Controller { readonly cicmContext _context;