Skip to content

Commit

Permalink
Moved ExtraAuthorize to separate project
Browse files Browse the repository at this point in the history
  • Loading branch information
JonPSmith committed Dec 13, 2018
1 parent 2844581 commit 621b5b1
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 7 deletions.
21 changes: 21 additions & 0 deletions DataLayer/DataLayer.csproj
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PermissionParts\PermissionParts.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.EntityFrameworkCore">
<HintPath>..\..\..\..\.nuget\packages\microsoft.entityframeworkcore\2.1.4\lib\netstandard2.0\Microsoft.EntityFrameworkCore.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Expand Up @@ -5,7 +5,7 @@
using System.ComponentModel.DataAnnotations;
using PermissionParts;

namespace TestWebApp.Data
namespace DataLayer.EfClasses
{
/// <summary>
/// This holds what modules a user can access, using the user's email as the key
Expand Down
Expand Up @@ -7,7 +7,7 @@
using System.Linq;
using PermissionParts;

namespace TestWebApp.Data
namespace DataLayer.EfClasses
{
public class RoleToPermissions
{
Expand Down
@@ -1,9 +1,10 @@
// Copyright (c) 2018 Jon P Smith, GitHub: JonPSmith, web: http://www.thereformedprogrammer.net/
// Licensed under MIT license. See License.txt in the project root for license information.

using DataLayer.EfClasses;
using Microsoft.EntityFrameworkCore;

namespace TestWebApp.Data
namespace DataLayer.EfCode
{
public class ExtraAuthorizeDbContext : DbContext
{
Expand Down
10 changes: 8 additions & 2 deletions PermissionAccessControl.sln
Expand Up @@ -8,9 +8,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PermissionParts", "PermissionParts\PermissionParts.csproj", "{02633708-C1E3-45D1-9016-0499134BC581}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PermissionParts", "PermissionParts\PermissionParts.csproj", "{02633708-C1E3-45D1-9016-0499134BC581}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWebApp", "TestWebApp\TestWebApp.csproj", "{9EE2BC43-3AC9-4D97-8E5E-15099A20C440}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWebApp", "TestWebApp\TestWebApp.csproj", "{9EE2BC43-3AC9-4D97-8E5E-15099A20C440}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataLayer", "DataLayer\DataLayer.csproj", "{DBA80257-4697-480E-85C6-87C23047E415}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -26,6 +28,10 @@ Global
{9EE2BC43-3AC9-4D97-8E5E-15099A20C440}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EE2BC43-3AC9-4D97-8E5E-15099A20C440}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EE2BC43-3AC9-4D97-8E5E-15099A20C440}.Release|Any CPU.Build.0 = Release|Any CPU
{DBA80257-4697-480E-85C6-87C23047E415}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBA80257-4697-480E-85C6-87C23047E415}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBA80257-4697-480E-85C6-87C23047E415}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBA80257-4697-480E-85C6-87C23047E415}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions PermissionParts/PaidForModules.cs
Expand Up @@ -7,6 +7,7 @@ namespace PermissionParts
{
/// <summary>
/// This is an example of how you would manage what optional parts of your system a user can access
/// NOTE: You can add Display attributes (as done on Permissions) to give more information about a module
/// </summary>
[Flags]
public enum PaidForModules : long
Expand Down
2 changes: 1 addition & 1 deletion PermissionParts/PermissionParts.csproj
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions TestWebApp/AddedCode/AuthCookieValidate.cs
Expand Up @@ -6,6 +6,7 @@
using System.Reflection;
using System.Security.Claims;
using System.Threading.Tasks;
using DataLayer.EfCode;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using PermissionParts;
Expand Down
2 changes: 2 additions & 0 deletions TestWebApp/AddedCode/StartupExtensions.cs
Expand Up @@ -4,6 +4,8 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using DataLayer.EfClasses;
using DataLayer.EfCode;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
Expand Down
1 change: 1 addition & 0 deletions TestWebApp/Controllers/HomeController.cs
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using DataLayer.EfCode;
using Microsoft.AspNetCore.Mvc;
using TestWebApp.Data;
using TestWebApp.DisplayCode;
Expand Down
1 change: 1 addition & 0 deletions TestWebApp/Controllers/UsersController.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataLayer.EfCode;
using Microsoft.AspNetCore.Mvc;
using PermissionParts;
using TestWebApp.Data;
Expand Down
1 change: 1 addition & 0 deletions TestWebApp/DisplayCode/ListRoles.cs
Expand Up @@ -5,6 +5,7 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using DataLayer.EfCode;
using PermissionParts;
using TestWebApp.Data;

Expand Down
1 change: 1 addition & 0 deletions TestWebApp/DisplayCode/ListUsers.cs
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataLayer.EfCode;
using PermissionParts;
using TestWebApp.Data;

Expand Down
1 change: 1 addition & 0 deletions TestWebApp/Startup.cs
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DataLayer.EfCode;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
Expand Down
1 change: 1 addition & 0 deletions TestWebApp/TestWebApp.csproj
Expand Up @@ -14,6 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DataLayer\DataLayer.csproj" />
<ProjectReference Include="..\PermissionParts\PermissionParts.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion TestWebApp/Views/Users/Roles.cshtml
@@ -1,4 +1,4 @@
@model IEnumerable<TestWebApp.Data.RoleToPermissions>
@model IEnumerable<DataLayer.EfClasses.RoleToPermissions>

@{
ViewData["Title"] = "Roles";
Expand Down

0 comments on commit 621b5b1

Please sign in to comment.