diff --git a/src/Plugin/GroupContentPermissionProvider.php b/src/Plugin/GroupContentPermissionProvider.php index 014f374..34b47f5 100644 --- a/src/Plugin/GroupContentPermissionProvider.php +++ b/src/Plugin/GroupContentPermissionProvider.php @@ -161,6 +161,46 @@ class GroupContentPermissionProvider extends GroupContentHandlerBase implements return FALSE; } + /** + * {@inheritdoc} + */ + public function getEntityViewAllRevisionsPermission(){ + if ($this->definesEntityPermissions) { + return "view $this->pluginId revisions"; + } + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function getEntityViewRevisionPermission(){ + if ($this->definesEntityPermissions) { + return "view $this->pluginId revision"; + } + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function getEntityRevertRevisionsPermission(){ + if ($this->definesEntityPermissions) { + return "revert $this->pluginId revisions"; + } + return FALSE; + } + + /** + * {@inheritdoc} + */ + public function getEntityDeleteRevisionsPermission(){ + if ($this->definesEntityPermissions) { + return "delete $this->pluginId revisions"; + } + return FALSE; + } + /** * {@inheritdoc} */ @@ -192,6 +232,14 @@ class GroupContentPermissionProvider extends GroupContentHandlerBase implements return $this->getEntityDeletePermission($scope); case 'create': return $this->getEntityCreatePermission(); + case 'view all revisions': + return $this->getEntityViewAllRevisionsPermission(); + case 'view revision': + return $this->getEntityViewRevisionPermission(); + case 'delete revision': + return $this->getEntityDeleteRevisionsPermission(); + case 'revert revision': + return $this->getEntityRevertRevisionsPermission(); } } @@ -263,6 +311,18 @@ class GroupContentPermissionProvider extends GroupContentHandlerBase implements if ($name = $this->getEntityDeletePermission('own')) { $permissions[$name] = $this->buildPermission("$prefix Delete own %entity_type entities"); } + if ($name = $this->getEntityViewAllRevisionsPermission()) { + $permissions[$name] = $this->buildPermission("$prefix View all revisions of %entity_type entities"); + } + if ($name = $this->getEntityViewRevisionPermission()) { + $permissions[$name] = $this->buildPermission("$prefix View any revision of %entity_type entities"); + } + if ($name = $this->getEntityDeleteRevisionsPermission()) { + $permissions[$name] = $this->buildPermission("$prefix Delete any revision of %entity_type entities"); + } + if ($name = $this->getEntityRevertRevisionsPermission()) { + $permissions[$name] = $this->buildPermission("$prefix Revert any revision of %entity_type entities"); + } if ($name = $this->getEntityCreatePermission()) { $permissions[$name] = $this->buildPermission( diff --git a/src/Plugin/GroupContentPermissionProviderInterface.php b/src/Plugin/GroupContentPermissionProviderInterface.php index eeecd71..ac457e4 100644 --- a/src/Plugin/GroupContentPermissionProviderInterface.php +++ b/src/Plugin/GroupContentPermissionProviderInterface.php @@ -115,6 +115,38 @@ interface GroupContentPermissionProviderInterface { */ public function getEntityCreatePermission(); + /** + * Gets the name of the view all revisions permission for the relation. + * + * @return string|false + * The permission name or FALSE if it does not apply. + */ + public function getEntityViewAllRevisionsPermission(); + + /** + * Gets the name of the view revision permission for the relation. + * + * @return string|false + * The permission name or FALSE if it does not apply. + */ + public function getEntityViewRevisionPermission(); + + /** + * Gets the name of the delete revision permission for the relation. + * + * @return string|false + * The permission name or FALSE if it does not apply. + */ + public function getEntityDeleteRevisionsPermission(); + + /** + * Gets the name of the revert revision permission for the relation. + * + * @return string|false + * The permission name or FALSE if it does not apply. + */ + public function getEntityRevertRevisionsPermission(); + /** * Gets the name of the permission for the given operation, target and scope. *