mirror of https://github.com/Squidex/squidex.git
Browse Source
* Improvements to teams. * Fixes * Fixes api * Fixes to teams. * Simplify some interfaces. * Teemp * Fix tests and type names.pull/925/head
committed by
GitHub
56 changed files with 682 additions and 618 deletions
@ -0,0 +1,32 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
namespace Squidex.Areas.Api.Controllers.Plans.Models |
|||
{ |
|||
public enum PlansLockedReason |
|||
{ |
|||
/// <summary>
|
|||
/// The user can change the plan
|
|||
/// </summary>
|
|||
None, |
|||
|
|||
/// <summary>
|
|||
/// The user is not the owner.
|
|||
/// </summary>
|
|||
NotOwner, |
|||
|
|||
/// <summary>
|
|||
/// The user does not have permission to change the plan
|
|||
/// </summary>
|
|||
NoPermission, |
|||
|
|||
/// <summary>
|
|||
/// The plan is managed by the team.
|
|||
/// </summary>
|
|||
ManagedByTeam |
|||
} |
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.AspNetCore.Authentication; |
|||
using Microsoft.AspNetCore.Authentication.Cookies; |
|||
using Microsoft.AspNetCore.Authentication.OpenIdConnect; |
|||
|
|||
namespace Squidex.Areas.Portal.Middlewares |
|||
{ |
|||
public sealed class PortalDashboardAuthenticationMiddleware |
|||
{ |
|||
private readonly RequestDelegate next; |
|||
|
|||
public PortalDashboardAuthenticationMiddleware(RequestDelegate next) |
|||
{ |
|||
this.next = next; |
|||
} |
|||
|
|||
public async Task InvokeAsync(HttpContext context) |
|||
{ |
|||
var authentication = await context.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationScheme); |
|||
|
|||
if (!authentication.Succeeded) |
|||
{ |
|||
var properties = new AuthenticationProperties |
|||
{ |
|||
RedirectUri = context.Request.PathBase + context.Request.Path |
|||
}; |
|||
|
|||
await context.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, properties); |
|||
} |
|||
else |
|||
{ |
|||
context.User = authentication.Principal!; |
|||
|
|||
await next(context); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,37 +0,0 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using System.Security.Claims; |
|||
using Squidex.Domain.Apps.Entities.Billing; |
|||
|
|||
namespace Squidex.Areas.Portal.Middlewares |
|||
{ |
|||
public sealed class PortalRedirectMiddleware |
|||
{ |
|||
private readonly IBillingManager billingManager; |
|||
|
|||
public PortalRedirectMiddleware(RequestDelegate next, IBillingManager billingManager) |
|||
{ |
|||
this.billingManager = billingManager; |
|||
} |
|||
|
|||
public async Task Invoke(HttpContext context) |
|||
{ |
|||
if (context.Request.Path == "/") |
|||
{ |
|||
var userIdClaim = context.User.FindFirst(ClaimTypes.NameIdentifier); |
|||
|
|||
if (userIdClaim != null) |
|||
{ |
|||
var portalLink = await billingManager.GetPortalLinkAsync(userIdClaim.Value, context.RequestAborted); |
|||
|
|||
context.Response.Redirect(portalLink); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue