Require authorization for most controllers

dashboard
Pat Hartl 2023-01-04 00:37:01 -06:00
parent d65ef4a280
commit 2fc43f3f34
4 changed files with 9 additions and 1 deletions

View File

@ -7,9 +7,11 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using LANCommander.Data;
using LANCommander.Data.Models;
using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
public class CompaniesController : Controller
{
private readonly DatabaseContext _context;

View File

@ -7,9 +7,11 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using LANCommander.Data;
using LANCommander.Data.Models;
using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
public class GamesController : Controller
{
private readonly DatabaseContext Context;
@ -156,7 +158,7 @@ namespace LANCommander.Controllers
{
if (Context.Games == null)
{
return Problem("Entity set 'DatabaseContext.Games' is null.");
return Problem("Entity set 'DatabaseContext.Games' is null.");
}
var game = await Context.Games.FindAsync(id);
if (game != null)

View File

@ -7,9 +7,11 @@ using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using LANCommander.Data;
using LANCommander.Data.Models;
using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
public class TagsController : Controller
{
private readonly DatabaseContext _context;

View File

@ -1,9 +1,11 @@
using LANCommander.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace LANCommander.Controllers
{
[Authorize]
public class UploadController : Controller
{
private const string UploadDirectory = "Upload";