Skip to content

Organisation merge never re-points modules and catalog services (findAllForType ignores _register/_schema) #1217

Description

@SudoThijn

Found while reviewing the beta release PR #1026 (head ae22b32).

#1026 adds module and catalogService to MergeOrganisatieService::FIELD_RELATION_TYPES (and the matching ownership entries), so a merged-away supplier's applications and services move to the target. All of them are collected through findAllForType() (lib/Service/MergeOrganisatieService.php:799), which calls:

$objectService->findAll(config: ['_register' => …, '_schema' => …, 'limit' => 10000]);

OpenRegister's ObjectService::prepareFindAllConfig() only reads filters.register / filters.schema (openregister/lib/Service/ObjectService.php:1522,1530) and otherwise uses the current register/schema context. Without a context MagicMapper::findAll() logs a warning and returns []; with a context left over from an earlier call it returns the wrong schema's objects. _rbac / _multitenancy also default to true, which limits results to the admin's active organisation.

Impact: the merge reports 0 re-pointed modules/services, tombstones the source organisation, and leaves its applications pointing at the merged-away supplier. The root cause also affects the pre-existing relation types. The unit test doesn't catch it because its mock keys on $config['_schema'] (tests/Unit/Service/MergeOrganisatieServiceTest.php:740).

Suggested fix: $objectService->setRegister($registerId)->setSchema($schemaId)->findAll(['limit' => …], _rbac: false, _multitenancy: false) (or searchObjects with @self.register / @self.schema plus a filter on the relation field), paginate instead of capping at 10000, and make the test mock fail on unknown config keys.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triageAwaiting triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions