Merge pull request #39 from rbkmoney/ft/bouncer_context

add party in bouncer context
This commit is contained in:
Gregory 2021-05-13 11:05:22 +03:00 committed by GitHub
commit f45ee31f53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -30,6 +30,7 @@ public class BouncerContextConverter {
return new Organization() return new Organization()
.setId(entity.getId()) .setId(entity.getId())
.setOwner(new Entity().setId(entity.getOwner())) .setOwner(new Entity().setId(entity.getOwner()))
.setParty(new Entity().setId(entity.getId()))
.setRoles(CollectionUtils.isEmpty(roles) ? null : .setRoles(CollectionUtils.isEmpty(roles) ? null :
roles.stream() roles.stream()
.filter(memberRoleEntity -> memberRoleEntity.getOrganizationId().equals(entity.getId())) .filter(memberRoleEntity -> memberRoleEntity.getOrganizationId().equals(entity.getId()))

View File

@ -81,6 +81,7 @@ class BouncerContextConverterTest {
assertEquals(organizationEntity.getId(), organization.getId()); assertEquals(organizationEntity.getId(), organization.getId());
assertEquals(organizationEntity.getOwner(), organization.getOwner().getId()); assertEquals(organizationEntity.getOwner(), organization.getOwner().getId());
assertEquals(organizationEntity.getId(), organization.getParty().getId());
assertTrue(organization.getRoles().isEmpty()); assertTrue(organization.getRoles().isEmpty());
} }
@ -94,6 +95,7 @@ class BouncerContextConverterTest {
assertEquals(organizationEntity.getId(), organization.getId()); assertEquals(organizationEntity.getId(), organization.getId());
assertEquals(organizationEntity.getOwner(), organization.getOwner().getId()); assertEquals(organizationEntity.getOwner(), organization.getOwner().getId());
assertEquals(organizationEntity.getId(), organization.getParty().getId());
assertEquals(memberRoleEntity.getRoleId(), organization.getRoles().iterator().next().getId()); assertEquals(memberRoleEntity.getRoleId(), organization.getRoles().iterator().next().getId());
} }