Compare commits
No commits in common. "2aeb8fef6f41c304a1551234620858fc6c36315d" and "2d81d3f6fda69850b61eadbf7d6a4252c23b4343" have entirely different histories.
2aeb8fef6f
...
2d81d3f6fd
@ -1,14 +0,0 @@
|
||||
# Sketch UI for mailinglist subscriptions
|
||||
|
||||
```PlantUML
|
||||
@startsalt
|
||||
{{^==Mailinglist-Subscriptions
|
||||
Members-Announce: | [<color:#9a9a9a>X</color>] | ^frank.meiler@example.org^ | [Create New]
|
||||
Members-Discussion: | [X] | ^frank.meiler@example.org^ | [Create New]
|
||||
Customers-Announce: | [<color:#9a9a9a>X</color>] | ^frank.meiler@example.org^ | [Create New]
|
||||
Operations-Announce: | [<color:#9a9a9a>X</color>] | ^Default Contact Data^ | [Create New]
|
||||
Operations-Discussion: | [ ] | ^ ^ | [Create New]
|
||||
|
||||
}}
|
||||
@endsalt
|
||||
```
|
@ -26,7 +26,6 @@ public class HsOfficeRelationshipEntity implements HasUuid, Stringifyable {
|
||||
private static Stringify<HsOfficeRelationshipEntity> toString = stringify(HsOfficeRelationshipEntity.class, "rel")
|
||||
.withProp(Fields.relAnchor, HsOfficeRelationshipEntity::getRelAnchor)
|
||||
.withProp(Fields.relType, HsOfficeRelationshipEntity::getRelType)
|
||||
.withProp(Fields.relMark, HsOfficeRelationshipEntity::getRelMark)
|
||||
.withProp(Fields.relHolder, HsOfficeRelationshipEntity::getRelHolder)
|
||||
.withProp(Fields.contact, HsOfficeRelationshipEntity::getContact);
|
||||
|
||||
@ -55,9 +54,6 @@ public class HsOfficeRelationshipEntity implements HasUuid, Stringifyable {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private HsOfficeRelationshipType relType;
|
||||
|
||||
@Column(name = "relmark")
|
||||
private String relMark;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString.apply(this);
|
||||
|
@ -7,6 +7,5 @@ public enum HsOfficeRelationshipType {
|
||||
REPRESENTATIVE,
|
||||
VIP_CONTACT,
|
||||
ACCOUNTING,
|
||||
OPERATIONS,
|
||||
SUBSCRIBER
|
||||
OPERATIONS
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ components:
|
||||
- VIP_CONTACT
|
||||
- ACCOUNTING,
|
||||
- OPERATIONS
|
||||
- SUBSCRIBER
|
||||
|
||||
HsOfficeRelationship:
|
||||
type: object
|
||||
@ -26,9 +25,6 @@ components:
|
||||
$ref: './hs-office-person-schemas.yaml#/components/schemas/HsOfficePerson'
|
||||
relType:
|
||||
type: string
|
||||
relMark:
|
||||
type: string
|
||||
nullable: true
|
||||
contact:
|
||||
$ref: './hs-office-contact-schemas.yaml#/components/schemas/HsOfficeContact'
|
||||
|
||||
@ -52,8 +48,6 @@ components:
|
||||
relType:
|
||||
type: string
|
||||
nullable: true
|
||||
relMark:
|
||||
type: string
|
||||
contactUuid:
|
||||
type: string
|
||||
format: uuid
|
||||
|
@ -53,19 +53,6 @@ create table tx_journal
|
||||
create index on tx_journal (targetTable, targetUuid);
|
||||
--//
|
||||
|
||||
-- ============================================================================
|
||||
--changeset audit-TX-JOURNAL-VIEW:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
/*
|
||||
A view combining tx_journal with tx_context.
|
||||
*/
|
||||
create view tx_journal_v as
|
||||
select txc.*, txj.targettable, txj.targetop, txj.targetuuid, txj.targetdelta
|
||||
from tx_journal txj
|
||||
left join tx_context txc using (contextid)
|
||||
order by txc.txtimestamp;
|
||||
--//
|
||||
|
||||
-- ============================================================================
|
||||
--changeset audit-TX-JOURNAL-TRIGGER:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
@ -11,8 +11,7 @@ CREATE TYPE HsOfficeRelationshipType AS ENUM (
|
||||
'REPRESENTATIVE',
|
||||
'VIP_CONTACT',
|
||||
'ACCOUNTING',
|
||||
'OPERATIONS',
|
||||
'SUBSCRIBER');
|
||||
'OPERATIONS');
|
||||
|
||||
CREATE CAST (character varying as HsOfficeRelationshipType) WITH INOUT AS IMPLICIT;
|
||||
|
||||
@ -22,8 +21,7 @@ create table if not exists hs_office_relationship
|
||||
relAnchorUuid uuid not null references hs_office_person(uuid),
|
||||
relHolderUuid uuid not null references hs_office_person(uuid),
|
||||
contactUuid uuid references hs_office_contact(uuid),
|
||||
relType HsOfficeRelationshipType not null,
|
||||
relMark varchar(24)
|
||||
relType HsOfficeRelationshipType not null
|
||||
);
|
||||
--//
|
||||
|
||||
|
@ -12,8 +12,7 @@ create or replace procedure createHsOfficeRelationshipTestData(
|
||||
holderPersonName varchar,
|
||||
relationshipType HsOfficeRelationshipType,
|
||||
anchorPersonTradeName varchar,
|
||||
contactLabel varchar,
|
||||
mark varchar default null)
|
||||
contactLabel varchar)
|
||||
language plpgsql as $$
|
||||
declare
|
||||
currentTask varchar;
|
||||
@ -50,8 +49,8 @@ begin
|
||||
raise notice '- using holder person (%): %', holderPerson.uuid, holderPerson;
|
||||
raise notice '- using contact (%): %', contact.uuid, contact;
|
||||
insert
|
||||
into hs_office_relationship (uuid, relanchoruuid, relholderuuid, reltype, relmark, contactUuid)
|
||||
values (uuid_generate_v4(), anchorPerson.uuid, holderPerson.uuid, relationshipType, mark, contact.uuid);
|
||||
into hs_office_relationship (uuid, relanchoruuid, relholderuuid, reltype, contactUuid)
|
||||
values (uuid_generate_v4(), anchorPerson.uuid, holderPerson.uuid, relationshipType, contact.uuid);
|
||||
end; $$;
|
||||
--//
|
||||
|
||||
@ -98,7 +97,7 @@ do language plpgsql $$
|
||||
call createHsOfficeRelationshipTestData('Fouler', 'REPRESENTATIVE', 'Third OHG', 'third contact');
|
||||
|
||||
call createHsOfficeRelationshipTestData('Smith', 'PARTNER', 'Hostsharing eG', 'sixth contact');
|
||||
call createHsOfficeRelationshipTestData('Smith', 'SUBSCRIBER', 'Third OHG', 'third contact', 'members-announce');
|
||||
|
||||
end;
|
||||
$$;
|
||||
--//
|
||||
|
@ -33,7 +33,7 @@ create table hs_office_partner
|
||||
(
|
||||
uuid uuid unique references RbacObject (uuid) initially deferred,
|
||||
partnerNumber numeric(5),
|
||||
partnerRoleUuid uuid not null references hs_office_relationship(uuid) on delete cascade,
|
||||
partnerRoleUuid uuid not null references hs_office_relationship(uuid),
|
||||
personUuid uuid not null references hs_office_person(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
||||
contactUuid uuid not null references hs_office_contact(uuid), -- TODO: remove, replaced by partnerRoleUuid
|
||||
detailsUuid uuid not null references hs_office_partner_details(uuid) on delete cascade
|
||||
|
@ -27,17 +27,12 @@ create or replace function hsOfficePartnerRbacRolesTrigger()
|
||||
language plpgsql
|
||||
strict as $$
|
||||
declare
|
||||
oldPartnerRole hs_office_relationship;
|
||||
newPartnerRole hs_office_relationship;
|
||||
|
||||
oldPerson hs_office_person;
|
||||
newPerson hs_office_person;
|
||||
|
||||
oldContact hs_office_contact;
|
||||
newContact hs_office_contact;
|
||||
begin
|
||||
|
||||
select * from hs_office_relationship as r where r.uuid = NEW.partnerroleuuid into newPartnerRole;
|
||||
select * from hs_office_person as p where p.uuid = NEW.personUuid into newPerson;
|
||||
select * from hs_office_contact as c where c.uuid = NEW.contactUuid into newContact;
|
||||
|
||||
@ -57,7 +52,6 @@ begin
|
||||
incomingSuperRoles => array[
|
||||
hsOfficePartnerOwner(NEW)],
|
||||
outgoingSubRoles => array[
|
||||
hsOfficeRelationshipTenant(newPartnerRole),
|
||||
hsOfficePersonTenant(newPerson),
|
||||
hsOfficeContactTenant(newContact)]
|
||||
);
|
||||
@ -66,7 +60,6 @@ begin
|
||||
hsOfficePartnerAgent(NEW),
|
||||
incomingSuperRoles => array[
|
||||
hsOfficePartnerAdmin(NEW),
|
||||
hsOfficeRelationshipAdmin(newPartnerRole),
|
||||
hsOfficePersonAdmin(newPerson),
|
||||
hsOfficeContactAdmin(newContact)]
|
||||
);
|
||||
@ -76,7 +69,6 @@ begin
|
||||
incomingSuperRoles => array[
|
||||
hsOfficePartnerAgent(NEW)],
|
||||
outgoingSubRoles => array[
|
||||
hsOfficeRelationshipTenant(newPartnerRole),
|
||||
hsOfficePersonGuest(newPerson),
|
||||
hsOfficeContactGuest(newContact)]
|
||||
);
|
||||
@ -117,19 +109,6 @@ begin
|
||||
|
||||
elsif TG_OP = 'UPDATE' then
|
||||
|
||||
if OLD.partnerRoleUuid <> NEW.partnerRoleUuid then
|
||||
select * from hs_office_relationship as r where r.uuid = OLD.partnerRoleUuid into oldPartnerRole;
|
||||
|
||||
call revokeRoleFromRole(hsOfficeRelationshipTenant(oldPerson), hsOfficePartnerAdmin(OLD));
|
||||
call grantRoleToRole(hsOfficeRelationshipTenant(newPerson), hsOfficePartnerAdmin(NEW));
|
||||
|
||||
call revokeRoleFromRole(hsOfficePartnerAgent(OLD), hsOfficeRelationshipAdmin(oldPerson));
|
||||
call grantRoleToRole(hsOfficePartnerAgent(NEW), hsOfficeRelationshipAdmin(newPerson));
|
||||
|
||||
call revokeRoleFromRole(hsOfficeRelationshipGuest(oldPerson), hsOfficePartnerTenant(OLD));
|
||||
call grantRoleToRole(hsOfficeRelationshipGuest(newPerson), hsOfficePartnerTenant(NEW));
|
||||
end if;
|
||||
|
||||
if OLD.personUuid <> NEW.personUuid then
|
||||
select * from hs_office_person as p where p.uuid = OLD.personUuid into oldPerson;
|
||||
|
||||
@ -200,7 +179,7 @@ call generateRbacIdentityView('hs_office_partner', $idName$
|
||||
call generateRbacRestrictedView('hs_office_partner',
|
||||
'(select idName from hs_office_person_iv p where p.uuid = target.personUuid)',
|
||||
$updates$
|
||||
partnerRoleUuid = new.partnerRoleUuid,
|
||||
partherRoleUuid = new.partnerRoleUuid,
|
||||
personUuid = new.personUuid,
|
||||
contactUuid = new.contactUuid
|
||||
$updates$);
|
||||
@ -212,7 +191,7 @@ call generateRbacRestrictedView('hs_office_partner',
|
||||
--changeset hs-office-partner-rbac-NEW-PARTNER:1 endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
/*
|
||||
Creates a global permission for new-partner and assigns it to the Hostsharing admins role.
|
||||
Creates a global permission for new-partner and assigns it to the hostsharing admins role.
|
||||
*/
|
||||
do language plpgsql $$
|
||||
declare
|
||||
|
@ -279,8 +279,9 @@ class HsOfficeBankAccountRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_bankaccount';
|
||||
""");
|
||||
|
||||
|
@ -259,8 +259,9 @@ class HsOfficeContactRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_contact';
|
||||
""");
|
||||
|
||||
|
@ -216,8 +216,9 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_coopassetstransaction';
|
||||
""");
|
||||
|
||||
|
@ -215,8 +215,9 @@ class HsOfficeCoopSharesTransactionRepositoryIntegrationTest extends ContextBase
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_coopsharestransaction';
|
||||
""");
|
||||
|
||||
|
@ -548,9 +548,10 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
where targettable = 'hs_office_coopsharestransaction';
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_debitor';
|
||||
""");
|
||||
|
||||
// when
|
||||
|
@ -376,8 +376,9 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_membership';
|
||||
""");
|
||||
|
||||
|
@ -22,7 +22,6 @@ import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipEnti
|
||||
import net.hostsharing.hsadminng.hs.office.relationship.HsOfficeRelationshipType;
|
||||
import net.hostsharing.hsadminng.hs.office.sepamandate.HsOfficeSepaMandateEntity;
|
||||
import net.hostsharing.test.JpaAttempt;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
@ -114,17 +113,6 @@ import static org.assertj.core.api.Fail.fail;
|
||||
@ExtendWith(OrderedDependedTestsExtension.class)
|
||||
public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
private static final String[] SUBSCRIBER_ROLES = new String[] {
|
||||
"subscriber:operations-discussion",
|
||||
"subscriber:operations-announce",
|
||||
"subscriber:members-announce",
|
||||
"subscriber:members-discussion",
|
||||
"subscriber:customers-announce"
|
||||
};
|
||||
private static final String[] KNOWN_ROLES = ArrayUtils.addAll(
|
||||
new String[]{"partner", "vip-contact", "ex-partner", "billing", "contractual", "operation"},
|
||||
SUBSCRIBER_ROLES);
|
||||
|
||||
static int relationshipId = 2000000;
|
||||
|
||||
@Value("${spring.datasource.url}")
|
||||
@ -269,13 +257,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
2000004=rel(relAnchor='LP JM GmbH', relType='EX_PARTNER', relHolder='LP JM e.K.', contact='JM e.K.'),
|
||||
2000005=rel(relAnchor='LP JM GmbH', relType='OPERATIONS', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000006=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000007=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='operations-announce', relHolder='LP JM GmbH', contact='Herr Andrew Meyer-Operation , JM GmbH'),
|
||||
2000008=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000009=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='members-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000010=rel(relAnchor='LP JM GmbH', relType='SUBSCRIBER', relMark='customers-announce', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000011=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000012=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000013=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies ')
|
||||
2000007=rel(relAnchor='LP JM GmbH', relType='REPRESENTATIVE', relHolder='LP JM GmbH', contact='Herr Philip Meyer-Contract , JM GmbH'),
|
||||
2000008=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000009=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000010=rel(relAnchor='NP Mellies, Michael', relType='REPRESENTATIVE', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies ')
|
||||
}
|
||||
""");
|
||||
}
|
||||
@ -778,14 +763,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
if (containsRole(rec, "vip-contact")) {
|
||||
addRelationship(partnerPerson, contactPerson, contact, HsOfficeRelationshipType.VIP_CONTACT);
|
||||
}
|
||||
for (String subscriberRole: SUBSCRIBER_ROLES) {
|
||||
if (containsRole(rec, subscriberRole)) {
|
||||
addRelationship(partnerPerson, contactPerson, contact, HsOfficeRelationshipType.SUBSCRIBER)
|
||||
.setRelMark(subscriberRole.split(":")[1])
|
||||
;
|
||||
}
|
||||
}
|
||||
verifyContainsOnlyKnownRoles(rec.getString("roles"));
|
||||
verifyContainsOnly(rec.getString("roles"), "partner", "vip-contact", "ex-partner", "billing", "contractual", "operation");
|
||||
});
|
||||
|
||||
optionallyAddMissingContractualRelationships();
|
||||
@ -809,7 +787,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
return containsRole(rec, "partner");
|
||||
}
|
||||
|
||||
private static HsOfficeRelationshipEntity addRelationship(
|
||||
private static void addRelationship(
|
||||
final HsOfficePersonEntity partnerPerson,
|
||||
final HsOfficePersonEntity contactPerson,
|
||||
final HsOfficeContactEntity contact,
|
||||
@ -821,7 +799,6 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
.relType(representative)
|
||||
.build();
|
||||
relationships.put(relationshipId++, rel);
|
||||
return rel;
|
||||
}
|
||||
|
||||
private HsOfficePersonEntity initPerson(final HsOfficePersonEntity person, final Record contactRecord) {
|
||||
@ -866,9 +843,9 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void verifyContainsOnlyKnownRoles(final String roles) {
|
||||
final var allowedRolesSet = stream(KNOWN_ROLES).collect(Collectors.toSet());
|
||||
private void verifyContainsOnly(final String roles, final String... allowedRoles) {
|
||||
final var givenRolesSet = stream(roles.replace(" ", "").split(",")).collect(Collectors.toSet());
|
||||
final var allowedRolesSet = stream(allowedRoles).collect(Collectors.toSet());
|
||||
final var unexpectedRolesSet = new HashSet<>(givenRolesSet);
|
||||
unexpectedRolesSet.removeAll(allowedRolesSet);
|
||||
assertThat(unexpectedRolesSet).isEmpty();
|
||||
|
@ -122,7 +122,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -191,9 +191,8 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
void globalAdmin_canNotAddPartner_ifPersonDoesNotExist() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var mandantPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||
final var givenPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("fourth").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
.given()
|
||||
@ -202,22 +201,11 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.body("""
|
||||
{
|
||||
"partnerNumber": "12345",
|
||||
"partnerRole": {
|
||||
"relAnchorUuid": "%s",
|
||||
"relType": "PARTNER",
|
||||
"relHolder": "%s",
|
||||
"contact": "%s",
|
||||
},
|
||||
"personUuid": "%s",
|
||||
"contactUuid": "%s",
|
||||
"personUuid": "%s",
|
||||
"details": {}
|
||||
}
|
||||
""".formatted(
|
||||
mandantPerson.getUuid(),
|
||||
givenPersonUuid,
|
||||
givenContact.getUuid(),
|
||||
givenPersonUuid,
|
||||
givenContact.getUuid()))
|
||||
""".formatted(givenContact.getUuid(), givenPersonUuid))
|
||||
.port(port)
|
||||
.when()
|
||||
.post("http://localhost/api/hs/office/partners")
|
||||
|
@ -74,23 +74,13 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var count = partnerRepo.count();
|
||||
final var givenMandantorPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||
final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike("First GmbH").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("First GmbH").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0);
|
||||
|
||||
final var partnerRole = HsOfficeRelationshipEntity.builder()
|
||||
.relHolder(givenPartnerPerson)
|
||||
.relType(HsOfficeRelationshipType.PARTNER)
|
||||
.relAnchor(givenMandantorPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
relationshipRepo.save(partnerRole);
|
||||
|
||||
// when
|
||||
final var result = attempt(em, () -> {
|
||||
final var newPartner = toCleanup(HsOfficePartnerEntity.builder()
|
||||
.partnerRole(partnerRole)
|
||||
.person(givenPartnerPerson)
|
||||
.person(givenPerson)
|
||||
.contact(givenContact)
|
||||
.details(HsOfficePartnerDetailsEntity.builder()
|
||||
.build())
|
||||
@ -158,12 +148,11 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
.containsExactlyInAnyOrder(Array.fromFormatted(
|
||||
initialGrantNames,
|
||||
// relationship - TODO: check and cleanup
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role partner#22222:EBess-4th.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role partner#22222:EBess-4th.tenant by system and assume }",
|
||||
"{ grant role partner#22222:EBess-4th.agent to role relationship#HostsharingeG-with-PARTNER-EBess.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.owner to role global#global.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role contact#4th.admin by system and assume }",
|
||||
"{ grant role person#HostsharingeG.tenant to role person#EBess.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role person#EBess.admin by system and assume }",
|
||||
"{ grant role person#EBess.tenant to role person#HostsharingeG.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.owner to role person#HostsharingeG.admin by system and assume }",
|
||||
"{ grant role relationship#HostsharingeG-with-PARTNER-EBess.tenant to role person#HostsharingeG.admin by system and assume }",
|
||||
"{ grant perm edit on relationship#HostsharingeG-with-PARTNER-EBess to role relationship#HostsharingeG-with-PARTNER-EBess.admin by system and assume }",
|
||||
@ -322,10 +311,6 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(22222, "Erben Bessler", "ninth");
|
||||
final var newPartnerRole = em.createNativeQuery(
|
||||
"select uuid from hs_office_relationship where uuid=:partnerRoleUuid")
|
||||
.setParameter("partnerRoleUuid", givenPartner.getPartnerRole().getUuid())
|
||||
.getSingleResult();
|
||||
assertThatPartnerIsVisibleForUserWithRole(
|
||||
givenPartner,
|
||||
"hs_office_partner#22222:ErbenBesslerMelBessler-ninthcontact.agent");
|
||||
@ -427,8 +412,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// when
|
||||
final var result = jpaAttempt.transacted(() -> {
|
||||
context("superuser-alex@hostsharing.net");
|
||||
return relationshipRepo.deleteByUuid(givenPartner.getPartnerRole().getUuid());
|
||||
// return partnerRepo.deleteByUuid(givenPartner.getUuid());
|
||||
return partnerRepo.deleteByUuid(givenPartner.getUuid());
|
||||
});
|
||||
|
||||
// then
|
||||
@ -443,8 +427,9 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_partner';
|
||||
""");
|
||||
|
||||
@ -470,23 +455,11 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final Integer partnerNumber, final String person, final String contact) {
|
||||
return jpaAttempt.transacted(() -> {
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenMandantorPerson = personRepo.findPersonByOptionalNameLike("Hostsharing eG").get(0);
|
||||
final var givenPartnerPerson = personRepo.findPersonByOptionalNameLike(person).get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike(person).get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike(contact).get(0);
|
||||
|
||||
final var partnerRole = HsOfficeRelationshipEntity.builder()
|
||||
.relHolder(givenPartnerPerson)
|
||||
.relType(HsOfficeRelationshipType.PARTNER)
|
||||
.relAnchor(givenMandantorPerson)
|
||||
.contact(givenContact)
|
||||
.build();
|
||||
relationshipRepo.save(partnerRole);
|
||||
em.flush(); // TODO: why is that necessary?
|
||||
|
||||
final var newPartner = HsOfficePartnerEntity.builder()
|
||||
.partnerNumber(partnerNumber)
|
||||
.partnerRole(partnerRole)
|
||||
.person(givenPartnerPerson)
|
||||
.person(givenPerson)
|
||||
.contact(givenContact)
|
||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||
.build();
|
||||
|
@ -262,8 +262,9 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_person';
|
||||
""");
|
||||
|
||||
|
@ -19,18 +19,6 @@ class HsOfficeRelationshipEntityUnitTest {
|
||||
.givenName("Mellie")
|
||||
.build();
|
||||
|
||||
@Test
|
||||
void toStringReturnsAllProperties() {
|
||||
final var given = HsOfficeRelationshipEntity.builder()
|
||||
.relType(HsOfficeRelationshipType.SUBSCRIBER)
|
||||
.relMark("members-announce")
|
||||
.relAnchor(anchor)
|
||||
.relHolder(holder)
|
||||
.build();
|
||||
|
||||
assertThat(given.toString()).isEqualTo("rel(relAnchor='LP some trade name', relType='SUBSCRIBER', relMark='members-announce', relHolder='NP Meier, Mellie')");
|
||||
}
|
||||
|
||||
@Test
|
||||
void toShortString() {
|
||||
final var given = HsOfficeRelationshipEntity.builder()
|
||||
|
@ -370,8 +370,9 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_relationship';
|
||||
""");
|
||||
|
||||
|
@ -390,8 +390,9 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
|
||||
public void auditJournalLogIsAvailable() {
|
||||
// given
|
||||
final var query = em.createNativeQuery("""
|
||||
select currentTask, targetTable, targetOp
|
||||
from tx_journal_v
|
||||
select c.currenttask, j.targettable, j.targetop
|
||||
from tx_journal j
|
||||
join tx_context c on j.contextId = c.contextId
|
||||
where targettable = 'hs_office_sepamandate';
|
||||
""");
|
||||
|
||||
|
@ -6,8 +6,8 @@ contact_id; bp_id; salut; first_name; last_name; title; firma; co; street; zip
|
||||
# eine juristische Person mit drei separaten Ansprechpartnern, vip-contact und ex-partner
|
||||
1200; 20;; ; ; ; JM e.K.;; Wiesenweg 15; 12335; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; jm-ex-partner@example.org; ex-partner
|
||||
1201; 20; Frau; Jenny; Meyer-Billing; Dr.; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 1111111; ; +49 30 2222222; jm-billing@example.org; billing
|
||||
1202; 20; Herr; Andrew; Meyer-Operation; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 3333333; ; +49 30 4444444; am-operation@example.org; operation,vip-contact,subscriber:operations-announce
|
||||
1203; 20; Herr; Philip; Meyer-Contract; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm-partner@example.org; partner,contractual,subscriber:members-announce,subscriber:customers-announce
|
||||
1202; 20; Herr; Andrew; Meyer-Operation; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 3333333; ; +49 30 4444444; am-operation@example.org; operation,vip-contact
|
||||
1203; 20; Herr; Philip; Meyer-Contract; ; JM GmbH;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm-partner@example.org; partner,contractual
|
||||
|
||||
# eine juristische Person mit nur einem Ansprechpartner und explizitem contractual
|
||||
1301; 22; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; partner,billing,contractual,operation
|
||||
|
|
Loading…
Reference in New Issue
Block a user