From 441fdb7f62a85581985b7950ff3f567f37ca16c1 Mon Sep 17 00:00:00 2001 From: Austin Wise Date: Sat, 13 May 2023 17:47:46 -0700 Subject: [PATCH] Require login to view any data. --- src/DkpWeb/Controllers/AnalyseController.cs | 13 ++++++++----- src/DkpWeb/Controllers/BillSplitController.cs | 11 ++++------- src/DkpWeb/Controllers/HomeController.cs | 6 +----- src/DkpWeb/Controllers/MyDebtController.cs | 3 +++ src/DkpWeb/Controllers/PeopleController.cs | 1 + src/DkpWeb/Controllers/TransactionController.cs | 14 ++++++-------- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/DkpWeb/Controllers/AnalyseController.cs b/src/DkpWeb/Controllers/AnalyseController.cs index 5a2be04..952548d 100644 --- a/src/DkpWeb/Controllers/AnalyseController.cs +++ b/src/DkpWeb/Controllers/AnalyseController.cs @@ -1,13 +1,16 @@ -using System.Linq; -using Austin.DkpLib; -using System.IO; -using Microsoft.AspNetCore.Mvc; +using Austin.DkpLib; using DkpWeb.Data; using DkpWeb.Models.AnalyzeViewModels; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Data; +using System.IO; +using System.Linq; namespace DkpWeb.Controllers { - public class AnalyseController : Controller + [Authorize(Roles = "DKP")] + public class AnalyseController : Controller { ApplicationDbContext dc; diff --git a/src/DkpWeb/Controllers/BillSplitController.cs b/src/DkpWeb/Controllers/BillSplitController.cs index 6348104..635b652 100644 --- a/src/DkpWeb/Controllers/BillSplitController.cs +++ b/src/DkpWeb/Controllers/BillSplitController.cs @@ -1,15 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Austin.DkpLib; -using DkpWeb.Data; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Http; +using DkpWeb.Data; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using System.Linq; namespace DkpWeb.Controllers { + [Authorize(Roles = "DKP")] public class BillSplitController : Controller { readonly ApplicationDbContext mData; diff --git a/src/DkpWeb/Controllers/HomeController.cs b/src/DkpWeb/Controllers/HomeController.cs index efcf01f..2150dc3 100644 --- a/src/DkpWeb/Controllers/HomeController.cs +++ b/src/DkpWeb/Controllers/HomeController.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; namespace DkpWeb.Controllers { diff --git a/src/DkpWeb/Controllers/MyDebtController.cs b/src/DkpWeb/Controllers/MyDebtController.cs index f2c6c83..dee8d11 100644 --- a/src/DkpWeb/Controllers/MyDebtController.cs +++ b/src/DkpWeb/Controllers/MyDebtController.cs @@ -2,15 +2,18 @@ using DkpWeb.Data; using DkpWeb.Models; using DkpWeb.Models.MyDebtViewModels; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; +using System.Data; using System.IO; using System.Linq; namespace DkpWeb.Controllers { + [Authorize(Roles = "DKP")] public class MyDebtController : Controller { readonly ApplicationDbContext mData; diff --git a/src/DkpWeb/Controllers/PeopleController.cs b/src/DkpWeb/Controllers/PeopleController.cs index 517f0e2..2a9e6b1 100644 --- a/src/DkpWeb/Controllers/PeopleController.cs +++ b/src/DkpWeb/Controllers/PeopleController.cs @@ -8,6 +8,7 @@ namespace DkpWeb.Controllers { + [Authorize(Roles = "DKP")] public class PeopleController : Controller { private ApplicationDbContext mData; diff --git a/src/DkpWeb/Controllers/TransactionController.cs b/src/DkpWeb/Controllers/TransactionController.cs index b54098e..9f15f97 100644 --- a/src/DkpWeb/Controllers/TransactionController.cs +++ b/src/DkpWeb/Controllers/TransactionController.cs @@ -1,16 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; using DkpWeb.Data; using DkpWeb.Models; using Microsoft.AspNetCore.Authorization; -using Sakura.AspNetCore; +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Sakura.AspNetCore; +using System; +using System.Linq; +using System.Threading.Tasks; namespace DkpWeb.Controllers { + [Authorize(Roles = "DKP")] public class TransactionController : Controller { // @@ -70,7 +70,6 @@ public ActionResult TopScore() return View(q); } - [Authorize(Roles = "DKP")] public ActionResult Add() { ViewBag.People = mData.ActivePeopleOrderedByName.ToList(); @@ -90,7 +89,6 @@ public async Task Delete(Guid id) } [HttpPost] - [Authorize(Roles = "DKP")] [ValidateAntiForgeryToken] public async Task Add(NewTransactionModel model) {