authorize?

This commit is contained in:
2017-03-06 03:05:27 +01:00
parent a863aed34c
commit a7e2ed8c74

View File

@ -1,12 +1,15 @@
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Yavsc.Exceptions;
using Yavsc.Models; using Yavsc.Models;
using YavscLib; using YavscLib;
namespace Yavsc.Controllers.Generic namespace Yavsc.Controllers.Generic
{ {
[Authorize]
public abstract class SettingsController<TSettings> : Controller where TSettings : class, ISpecializationSettings, new() public abstract class SettingsController<TSettings> : Controller where TSettings : class, ISpecializationSettings, new()
{ {
protected ApplicationDbContext _context; protected ApplicationDbContext _context;
@ -20,6 +23,7 @@ namespace Yavsc.Controllers.Generic
{ {
_context = context; _context = context;
dbSet=_context.GetDbSet<TSettings>(); dbSet=_context.GetDbSet<TSettings>();
if (dbSet==null) throw new InvalidWorkflowModelException(this.GetType().Name);
} }
public async Task<IActionResult> Index() public async Task<IActionResult> Index()