Put most things behind administrator authorization. Update access denied page.

dashboard
Pat Hartl 2023-01-04 01:45:54 -06:00
parent bbdb1dcb7a
commit a0d7134af3
8 changed files with 24 additions and 9 deletions

View File

@ -1,10 +1,23 @@
@page
@model AccessDeniedModel
@{ Layout = "/Views/Shared/_LayoutBasic.cshtml"; }
@{
ViewData["Title"] = "Access denied";
}
<header>
<h1 class="text-danger">@ViewData["Title"]</h1>
<p class="text-danger">You do not have access to this resource.</p>
</header>
<div class="page page-center">
<div class="container py-4">
<div class="empty">
<div class="empty-header">Access Denied</div>
<p class="empty-title">You're not allowed to enter this area</p>
<p class="empty-subtitle text-muted">Your account does not have permission to access this area. Contact an administrator.</p>
<div class="empty-action">
<a asp-action="Index" asp-controller="Home" class="btn btn-primary" onclick="history.go(-1)">Take me back</a>
</div>
</div>
</div>
</div>
<audio autoplay>
<source src="~/static/access-denied.mp3" type="audio/mp3" />
</audio>

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
namespace LANCommander.Controllers
{
[Authorize]
[Authorize(Roles = "Administrator")]
public class ArchivesController : Controller
{
private readonly DatabaseContext Context;

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
[Authorize(Roles = "Administrator")]
public class CompaniesController : Controller
{
private readonly DatabaseContext _context;

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
[Authorize(Roles = "Administrator")]
public class GamesController : Controller
{
private readonly DatabaseContext Context;

View File

@ -2,11 +2,13 @@
using LANCommander.Data;
using LANCommander.Data.Models;
using LANCommander.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
namespace LANCommander.Controllers
{
[Authorize]
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
namespace LANCommander.Controllers
{
[Authorize]
[Authorize(Roles = "Administrator")]
public class TagsController : Controller
{
private readonly DatabaseContext _context;

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
namespace LANCommander.Controllers
{
[Authorize]
[Authorize(Roles = "Administrator")]
public class UploadController : Controller
{
private const string UploadDirectory = "Upload";

Binary file not shown.