diff --git a/modules/gnode/src/Plugin/Group/RelationHandler/GroupNodePermissionProvider.php b/modules/gnode/src/Plugin/Group/RelationHandler/GroupNodePermissionProvider.php index 5703936..8713a34 100644 --- a/modules/gnode/src/Plugin/Group/RelationHandler/GroupNodePermissionProvider.php +++ b/modules/gnode/src/Plugin/Group/RelationHandler/GroupNodePermissionProvider.php @@ -31,6 +31,9 @@ class GroupNodePermissionProvider implements PermissionProviderInterface { if ($operation === 'view unpublished' && $target === 'entity' && $scope === 'any') { return "$operation $this->pluginId $target"; } + elseif ($operation === 'view') { + return "$operation $scope $this->pluginId $target"; + } return $this->parent->getPermission($operation, $target, $scope); } diff --git a/src/Plugin/Group/RelationHandlerDefault/PermissionProvider.php b/src/Plugin/Group/RelationHandlerDefault/PermissionProvider.php index 8c58ccd..0d330a2 100644 --- a/src/Plugin/Group/RelationHandlerDefault/PermissionProvider.php +++ b/src/Plugin/Group/RelationHandlerDefault/PermissionProvider.php @@ -90,12 +90,12 @@ class PermissionProvider implements PermissionProviderInterface { $permissions[$name]['restrict access'] = TRUE; } - if ($name = $provider_chain->getPermission('view', 'relationship')) { - $permissions[$name] = $this->buildPermission("$prefix View any entity relations"); - } if ($name = $provider_chain->getPermission('view', 'relationship', 'own')) { $permissions[$name] = $this->buildPermission("$prefix View own entity relations"); } + if ($name = $provider_chain->getPermission('view', 'relationship', 'any')) { + $permissions[$name] = $this->buildPermission("$prefix View any entity relations"); + } if ($name = $provider_chain->getPermission('update', 'relationship')) { $permissions[$name] = $this->buildPermission("$prefix Edit any entity relations"); } @@ -118,12 +118,12 @@ class PermissionProvider implements PermissionProviderInterface { // Provide permissions for the actual entity being added to the group. $prefix = 'Entity:'; - if ($name = $provider_chain->getPermission('view', 'entity')) { - $permissions[$name] = $this->buildPermission("$prefix View any %entity_type entities"); - } if ($name = $provider_chain->getPermission('view', 'entity', 'own')) { $permissions[$name] = $this->buildPermission("$prefix View own %entity_type entities"); } + if ($name = $provider_chain->getPermission('view', 'entity', 'any')) { + $permissions[$name] = $this->buildPermission("$prefix View any %entity_type entities"); + } if ($name = $provider_chain->getPermission('view unpublished', 'entity')) { $permissions[$name] = $this->buildPermission("$prefix View any unpublished %entity_type entities"); } @@ -164,12 +164,7 @@ class PermissionProvider implements PermissionProviderInterface { * The permission name or FALSE if it does not apply. */ protected function getRelationshipViewPermission($scope = 'any') { - // @todo Implement view own permission. - if ($scope === 'any') { - // Backwards compatible permission name for 'any' scope. - return "view $this->pluginId relationship"; - } - return FALSE; + return "view $scope $this->pluginId relationship"; } /**