fix: library IDs stay hidden without library access (ruling P13)

Outline, node-get, write outlines, the render summary and replace-text's
opaque-node match name no library ID unless the library group is visible
and the user has divi_library; read-only still names them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 15:00:39 +02:00
co-authored by Claude Opus 5.5
parent 06f13799de
commit c7ce924e5a
19 changed files with 351 additions and 28 deletions
@@ -123,4 +123,25 @@ final class DiviIntegrationTest extends TestCase
self::assertInstanceOf(WP_Error::class, $refusal);
self::assertToolError($refusal, 'not_found');
}
/**
* Ruling P13: library IDs follow the integration's library access – hidden with the group disabled
* and without the library right (no Divi in unit tests: DiviRoles allows nothing). The positive
* cases, "nur lesen" included, are in LibraryAccessTest (defining et_pb_is_allowed here would leak).
*/
public function testLibraryIdsFollowTheLibraryAccess(): void
{
LibraryFixtures::given([]);
$schema = Mockery::mock(ContentSchema::class);
$asked = 0;
$hidden = new DiviIntegration($schema, FakeChangeLog::forbidden(), libraryVisible: static function () use (&$asked): bool {
++$asked;
return false;
});
self::assertFalse($hidden->libraryIdsVisible());
self::assertSame(1, $asked);
self::assertFalse((new DiviIntegration($schema, FakeChangeLog::forbidden()))->libraryIdsVisible());
}
}