Skip to content

Commit

Permalink
Updated packages and removed not needed dependencies..
Browse files Browse the repository at this point in the history
  • Loading branch information
mgernand committed Oct 12, 2022
1 parent a03618a commit 607f442
Show file tree
Hide file tree
Showing 54 changed files with 236 additions and 198 deletions.
1 change: 1 addition & 0 deletions samples/SamplePermissions/InvoicesDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace SamplePermissions
{
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ValueGeneration;
using SamplePermissions.Model;
Expand Down
2 changes: 2 additions & 0 deletions samples/SamplePermissions/Model/Invoice.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace SamplePermissions.Model
{
using System;

public class Invoice
{
public Guid Id { get; set; }
Expand Down
7 changes: 4 additions & 3 deletions samples/SamplePermissions/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ namespace SamplePermissions.Pages
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
private readonly ILogger<ErrorModel> _logger;
private readonly ILogger<ErrorModel> logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public string? RequestId { get; set; }
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId);

Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
namespace SamplePermissions.Pages
{
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly ILogger<IndexModel> logger;

public IndexModel(ILogger<IndexModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public void OnGet()
Expand Down
7 changes: 5 additions & 2 deletions samples/SamplePermissions/Pages/InvoiceDelete.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
namespace SamplePermissions.Pages
{
using System;
using System.Linq;
using AspNetCore.Authorization.Permissions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using SamplePermissions.Model;

[HasPermission("Invoice.Delete")]
public class InvoiceDeleteModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoiceDeleteModel(ILogger<InvoiceReadModel> logger, InvoicesDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/InvoicePayment.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
{
using AspNetCore.Authorization.Permissions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[HasPermission("Invoice.Payment")]
public class InvoicePaymentModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoicePaymentModel(ILogger<InvoiceReadModel> logger, ApplicationDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand Down
8 changes: 4 additions & 4 deletions samples/SamplePermissions/Pages/InvoiceRead.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
namespace SamplePermissions.Pages
{
using AspNetCore.Authorization.Permissions.Abstractions;
using Fluxera.Utilities.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

// [HasPermission("Invoice.Read")]
public class InvoiceReadModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoiceReadModel(ILogger<InvoiceReadModel> logger, InvoicesDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand All @@ -22,7 +22,7 @@ public IActionResult OnGet()
{
if(!this.User.HasPermission("Invoice.Read"))
{
if(this.User.IsAuthenticated())
if(this.User.Identity != null && this.User.Identity.IsAuthenticated)
{
return this.Forbid();
}
Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/InvoiceSend.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
{
using AspNetCore.Authorization.Permissions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[HasPermission("Invoice.Send")]
public class InvoiceSendModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoiceSendModel(ILogger<InvoiceReadModel> logger, ApplicationDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/InvoiceWrite.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
{
using AspNetCore.Authorization.Permissions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using SamplePermissions.Model;

[HasPermission("Invoice.Write")]
public class InvoiceWriteModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoiceWriteModel(ILogger<InvoiceReadModel> logger, InvoicesDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/Invoices.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
{
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[Authorize]
public class InvoicesModel : PageModel
{
private readonly ILogger<InvoicesModel> _logger;
private readonly ILogger<InvoicesModel> logger;

public InvoicesModel(ILogger<InvoicesModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public void OnGet()
Expand Down
5 changes: 3 additions & 2 deletions samples/SamplePermissions/Pages/Permissions.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
{
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[Authorize]
public class PermissionsModel : PageModel
{
private readonly ILogger<PermissionsModel> _logger;
private readonly ILogger<PermissionsModel> logger;

public PermissionsModel(ILogger<PermissionsModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public void OnGet()
Expand Down
5 changes: 2 additions & 3 deletions samples/SamplePermissions/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using Fluxera.Utilities.Extensions
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand All @@ -23,7 +22,7 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
@if(this.User.IsAuthenticated())
@if (this.User.Identity != null && this.User.Identity.IsAuthenticated)
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Invoices">Invoices</a>
Expand Down
6 changes: 3 additions & 3 deletions samples/SamplePermissions/Pages/Shared/_LoginPartial.cshtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@using AspNetCore.Authorization.Permissions.Identity
@using Microsoft.AspNetCore.Identity
@inject SignInManager<PermissionsIdentityUser> SignInManager
@inject UserManager<PermissionsIdentityUser> UserManager
@inject SignInManager<PermissionsIdentityUser> signInManager
@inject UserManager<PermissionsIdentityUser> userManager

<ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User))
@if (signInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity?.Name!</a>
Expand Down
2 changes: 2 additions & 0 deletions samples/SamplePermissions/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using AspNetCore.Authorization.Permissions;
using AspNetCore.Authorization.Permissions.Identity;
using AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using SamplePermissions;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
Expand Down
56 changes: 28 additions & 28 deletions samples/SamplePermissions/SamplePermissions.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>disable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.5" />
</ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore\AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\AspNetCore.Authorization.Permissions.Identity\AspNetCore.Authorization.Permissions.Identity.csproj" />
<ProjectReference Include="..\..\src\AspNetCore.Authorization.Permissions\AspNetCore.Authorization.Permissions.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup>
<ProjectReference
Include="..\..\src\AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore\AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore.csproj" />
<ProjectReference
Include="..\..\src\AspNetCore.Authorization.Permissions.Identity\AspNetCore.Authorization.Permissions.Identity.csproj" />
<ProjectReference
Include="..\..\src\AspNetCore.Authorization.Permissions\AspNetCore.Authorization.Permissions.csproj" />
</ItemGroup>

</Project>
</Project>
1 change: 1 addition & 0 deletions samples/SampleTenant/InvoicesDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace SampleTenant
{
using System;
using AspNetCore.Authorization.Permissions.Abstractions;
using AspNetCore.Authorization.Permissions.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
Expand Down
1 change: 1 addition & 0 deletions samples/SampleTenant/Model/Invoice.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace SampleTenant.Model
{
using System;
using AspNetCore.Authorization.Permissions.Abstractions;

public class Invoice : ITenantObject
Expand Down
7 changes: 4 additions & 3 deletions samples/SampleTenant/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ namespace SampleTenant.Pages
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
private readonly ILogger<ErrorModel> _logger;
private readonly ILogger<ErrorModel> logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public string? RequestId { get; set; }
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId);

Expand Down
5 changes: 3 additions & 2 deletions samples/SampleTenant/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
namespace SampleTenant.Pages
{
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;

public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly ILogger<IndexModel> logger;

public IndexModel(ILogger<IndexModel> logger)
{
this._logger = logger;
this.logger = logger;
}

public void OnGet()
Expand Down
7 changes: 5 additions & 2 deletions samples/SampleTenant/Pages/InvoiceDelete.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
namespace SampleTenant.Pages
{
using System;
using System.Linq;
using AspNetCore.Authorization.Permissions;
using AspNetCore.Authorization.Permissions.Abstractions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using SampleTenant.Model;

[HasPermission("Invoice.Delete")]
public class InvoiceDeleteModel : PageModel
{
private readonly ILogger<InvoiceReadModel> _logger;
private readonly ILogger<InvoiceReadModel> logger;

public InvoiceDeleteModel(ILogger<InvoiceReadModel> logger, InvoicesDbContext context)
{
this._logger = logger;
this.logger = logger;
this.Context = context;
}

Expand Down
Loading

0 comments on commit 607f442

Please sign in to comment.