Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCST-1461: Use current organization ID #27

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.811.0" />
<PackageReference Include="VirtoCommerce.NotificationsModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.841.0" />
</ItemGroup>
</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.MySql" Version="3.841.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.PostgreSql" Version="3.841.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data.SqlServer" Version="3.841.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.825.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.841.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.841.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using VirtoCommerce.CustomerModule.Core.Extensions;
using VirtoCommerce.CustomerModule.Core.Services;
using VirtoCommerce.ImportModule.Data.Authorization;
using VirtoCommerce.ImportModule.Web.Extensions;
using VirtoCommerce.Platform.Security.Authorization;

namespace VirtoCommerce.ImportModule.Web.Authorization
{
public sealed class ImportAuthorizationHandler : PermissionAuthorizationHandlerBase<ImportAuthorizationRequirement>
{
private readonly IMemberResolver _memberResolver;

public ImportAuthorizationHandler(
IMemberResolver memberResolver
)
{
_memberResolver = memberResolver;
}

protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, ImportAuthorizationRequirement requirement)
{
await base.HandleRequirementAsync(context, requirement);

var organization = await context.User.ResolveOrganization(_memberResolver);
var organizationId = context.User.GetCurrentOrganizationId();

if (organization != null && context.Resource != null && context.Resource is AuthorizationInfo authorizationInfo)
if (!string.IsNullOrEmpty(organizationId) && context.Resource != null && context.Resource is AuthorizationInfo authorizationInfo)
{
authorizationInfo.OrganizationId = organization.Id;
authorizationInfo.OrganizationId = organizationId;
}
context.Succeed(requirement);

context.Succeed(requirement);
}
}
}
4 changes: 2 additions & 2 deletions src/VirtoCommerce.ImportModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<id>VirtoCommerce.Import</id>
<version>3.806.0</version>
<version-tag></version-tag>
<platformVersion>3.825.0</platformVersion>
<platformVersion>3.841.0</platformVersion>
<dependencies>
<dependency id="VirtoCommerce.Assets" version="3.800.0" />
<dependency id="VirtoCommerce.Customer" version="3.800.0" />
<dependency id="VirtoCommerce.Customer" version="3.811.0" />
<dependency id="VirtoCommerce.Notifications" version="3.800.0" />
</dependencies>
<title>Import module</title>
Expand Down
Loading