Put most things behind administrator authorization. Update access denied page.
This commit is contained in:
parent
bbdb1dcb7a
commit
a0d7134af3
8 changed files with 24 additions and 9 deletions
|
@ -1,10 +1,23 @@
|
||||||
@page
|
@page
|
||||||
@model AccessDeniedModel
|
@model AccessDeniedModel
|
||||||
|
@{ Layout = "/Views/Shared/_LayoutBasic.cshtml"; }
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Access denied";
|
ViewData["Title"] = "Access denied";
|
||||||
}
|
}
|
||||||
|
|
||||||
<header>
|
<div class="page page-center">
|
||||||
<h1 class="text-danger">@ViewData["Title"]</h1>
|
<div class="container py-4">
|
||||||
<p class="text-danger">You do not have access to this resource.</p>
|
<div class="empty">
|
||||||
</header>
|
<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>
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = "Administrator")]
|
||||||
public class ArchivesController : Controller
|
public class ArchivesController : Controller
|
||||||
{
|
{
|
||||||
private readonly DatabaseContext Context;
|
private readonly DatabaseContext Context;
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = "Administrator")]
|
||||||
public class CompaniesController : Controller
|
public class CompaniesController : Controller
|
||||||
{
|
{
|
||||||
private readonly DatabaseContext _context;
|
private readonly DatabaseContext _context;
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = "Administrator")]
|
||||||
public class GamesController : Controller
|
public class GamesController : Controller
|
||||||
{
|
{
|
||||||
private readonly DatabaseContext Context;
|
private readonly DatabaseContext Context;
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
using LANCommander.Data;
|
using LANCommander.Data;
|
||||||
using LANCommander.Data.Models;
|
using LANCommander.Data.Models;
|
||||||
using LANCommander.Models;
|
using LANCommander.Models;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
|
[Authorize]
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = "Administrator")]
|
||||||
public class TagsController : Controller
|
public class TagsController : Controller
|
||||||
{
|
{
|
||||||
private readonly DatabaseContext _context;
|
private readonly DatabaseContext _context;
|
||||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace LANCommander.Controllers
|
namespace LANCommander.Controllers
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize(Roles = "Administrator")]
|
||||||
public class UploadController : Controller
|
public class UploadController : Controller
|
||||||
{
|
{
|
||||||
private const string UploadDirectory = "Upload";
|
private const string UploadDirectory = "Upload";
|
||||||
|
|
BIN
wwwroot/static/access-denied.mp3
Normal file
BIN
wwwroot/static/access-denied.mp3
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue