Skip to content
Snippets Groups Projects
Commit 1a420eb0 authored by Kristiaan Van den Eynde's avatar Kristiaan Van den Eynde
Browse files

Issue #3295748 by kristiaanvandeneynde: Disable config wrappers as plugin targets

parent 68be2424
No related branches found
No related tags found
No related merge requests found
......@@ -132,6 +132,9 @@ class GroupRelationTypeManager extends DefaultPluginManager implements GroupRela
if ($entity_type_id === 'group_content') {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('The "%s" plugin tries to group group_content entities, which is simply not possible.', $plugin_id));
}
elseif ($entity_type_id === 'group_config_wrapper') {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('The "%s" plugin tries to group group_config_wrapper entities, which is simply not possible.', $plugin_id));
}
elseif ($definition->definesEntityAccess() && $entity_type_id === 'group') {
throw new InvalidPluginDefinitionException($plugin_id, sprintf('The "%s" plugin defines entity access over group entities. This should be dealt with by altering the group permissions of the current user.', $plugin_id));
}
......
......@@ -188,6 +188,24 @@ class GroupRelationTypeManagerTest extends UnitTestCase {
$this->groupRelationTypeManager->getDefinitions();
}
/**
* Tests that you may not define a plugin for group_content entities.
*
* @covers ::processDefinition
*/
public function testPluginForConfigWrapperException() {
$this->setUpPluginDefinitions(
['some_plugin' => (new GroupRelationType([
'id' => 'some_plugin',
'entity_type_id' => 'group_config_wrapper',
]))->setClass(GroupRelationTypeInterface::class)]
);
$this->expectException(InvalidPluginDefinitionException::class);
$this->expectExceptionMessage('The "some_plugin" plugin tries to group group_config_wrapper entities, which is simply not possible.');
$this->groupRelationTypeManager->getDefinitions();
}
/**
* Tests that definitions are flagged as serving config entity types.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment