Skip to content

Commit afa65e3

Browse files
Merge branch 'dev' into feat/VCST-3596
2 parents b7894ab + f7af5d7 commit afa65e3

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<!-- These properties will be shared for all projects -->
44
<PropertyGroup>
5-
<VersionPrefix>3.918.0</VersionPrefix>
5+
<VersionPrefix>3.919.0</VersionPrefix>
66
<VersionSuffix></VersionSuffix>
77
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
88
</PropertyGroup>

src/VirtoCommerce.Xapi.Core/Services/ILoadUserToEvalContextService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ namespace VirtoCommerce.Xapi.Core.Services
66
public interface ILoadUserToEvalContextService
77
{
88
Task SetShopperDataFromMember(EvaluationContextBase evalContextBase, string customerId);
9+
10+
Task SetShopperDataFromOrganization(EvaluationContextBase evalContextBase, string organizationId);
911
}
1012
}

src/VirtoCommerce.Xapi.Data/Services/LoadUserToEvalContextService.cs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,37 @@ public virtual async Task SetShopperDataFromMember(EvaluationContextBase evalCon
4343

4444
evalContextBase.GeoTimeZone = contact.TimeZone;
4545

46-
evalContextBase.UserGroups = contact.Groups?.ToArray();
46+
var userGroups = new List<string>();
4747

48-
if (!contact.Organizations.IsNullOrEmpty())
48+
if (!evalContextBase.UserGroups.IsNullOrEmpty())
4949
{
50-
var userGroups = new List<string>();
51-
52-
if (!evalContextBase.UserGroups.IsNullOrEmpty())
53-
{
54-
userGroups.AddRange(evalContextBase.UserGroups);
55-
}
50+
userGroups.AddRange(evalContextBase.UserGroups);
51+
}
5652

57-
var organizations = await _memberService.GetByIdsAsync(contact.Organizations.ToArray(), MemberResponseGroup.WithGroups.ToString());
58-
userGroups.AddRange(organizations.OfType<Organization>().SelectMany(x => x.Groups));
53+
userGroups.AddRange(contact.Groups?.ToArray());
5954

60-
evalContextBase.UserGroups = userGroups.Distinct().ToArray();
61-
}
55+
evalContextBase.UserGroups = userGroups.Distinct().ToArray();
6256
}
6357
}
6458

59+
public async Task SetShopperDataFromOrganization(EvaluationContextBase evalContextBase, string organizationId)
60+
{
61+
if (organizationId.IsNullOrEmpty())
62+
{
63+
return;
64+
}
65+
66+
var userGroups = new List<string>();
67+
68+
if (!evalContextBase.UserGroups.IsNullOrEmpty())
69+
{
70+
userGroups.AddRange(evalContextBase.UserGroups);
71+
}
72+
73+
var organizations = await _memberService.GetByIdsAsync([organizationId], MemberResponseGroup.WithGroups.ToString());
74+
userGroups.AddRange(organizations.OfType<Organization>().SelectMany(x => x.Groups));
75+
76+
evalContextBase.UserGroups = userGroups.Distinct().ToArray();
77+
}
6578
}
6679
}

src/VirtoCommerce.Xapi.Web/module.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<module>
33
<id>VirtoCommerce.Xapi</id>
4-
<version>3.918.0</version>
4+
<version>3.919.0</version>
55
<version-tag></version-tag>
66

77
<platformVersion>3.895.0</platformVersion>

0 commit comments

Comments
 (0)