class GroupNodePermissionProvider in Group 2.0.x
Provides group permissions for the group_node relation plugin.
Hierarchy
- class \Drupal\gnode\Plugin\Group\RelationHandler\GroupNodePermissionProvider implements PermissionProviderInterface uses PermissionProviderTrait
Expanded class hierarchy of GroupNodePermissionProvider
File
- modules/
gnode/ src/ Plugin/ Group/ RelationHandler/ GroupNodePermissionProvider.php, line 12
Namespace
Drupal\gnode\Plugin\Group\RelationHandlerView source
class GroupNodePermissionProvider implements PermissionProviderInterface {
use PermissionProviderTrait;
/**
* Constructs a new GroupMembershipPermissionProvider.
*
* @param \Drupal\group\Plugin\Group\RelationHandler\PermissionProviderInterface $parent
* The parent permission provider.
*/
public function __construct(PermissionProviderInterface $parent) {
$this->parent = $parent;
}
/**
* {@inheritdoc}
*/
public function getPermission($operation, $target, $scope = 'any') {
// Backwards compatible permission name for 'any' scope.
if ($operation === 'view unpublished' && $target === 'entity' && $scope === 'any') {
return "{$operation} {$this->pluginId} {$target}";
}
return $this->parent
->getPermission($operation, $target, $scope);
}
/**
* {@inheritdoc}
*/
public function buildPermissions() {
$permissions = $this->parent
->buildPermissions();
// Rename the view any unpublished entity permission.
if ($name = $this->parent
->getPermission('view', 'entity', 'any')) {
$permissions[$this
->getPermission('view', 'entity', 'any')] = $permissions[$name];
unset($permissions[$name]);
}
return $permissions;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupNodePermissionProvider:: |
public | function |
Provides a list of group permissions the plugin exposes. Overrides PermissionProviderTrait:: |
|
GroupNodePermissionProvider:: |
public | function |
Gets the name of the permission for the given operation, target and scope. Overrides PermissionProviderTrait:: |
|
GroupNodePermissionProvider:: |
public | function | Constructs a new GroupMembershipPermissionProvider. | |
PermissionProviderTrait:: |
protected | property | Whether the plugin defines permissions for the target entity type. | |
PermissionProviderTrait:: |
protected | property | The entity type the plugin handler is for. | |
PermissionProviderTrait:: |
protected | property | Whether the target entity type implements the EntityOwnerInterface. | |
PermissionProviderTrait:: |
protected | property | Whether the target entity type implements the EntityPublishedInterface. | |
PermissionProviderTrait:: |
protected | function | Builds a permission with common translation arguments predefined. | |
PermissionProviderTrait:: |
public | function | 4 | |
PermissionProviderTrait:: |
public | function | ||
RelationHandlerTrait:: |
protected | property | The plugin definition. | |
RelationHandlerTrait:: |
protected | property | The entity type manager. | |
RelationHandlerTrait:: |
protected | property | The group relation manager. | |
RelationHandlerTrait:: |
protected | property | The parent relation handler in the decorator chain. | |
RelationHandlerTrait:: |
protected | property | The plugin ID as read from the definition. | |
RelationHandlerTrait:: |
protected | function | Gets the entity type manager service. | |
RelationHandlerTrait:: |
protected | function | Gets the group relation manager service. | |
RelationHandlerTrait:: |
public | function | Aliased as: traitInit |