clean install

This commit is contained in:
2024-12-10 15:08:16 +01:00
commit e14eb2d8fd
31193 changed files with 3555714 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace Drupal\role_delegation\Plugin\Action;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\role_delegation\Access\RoleDelegationAccessCheck;
use Drupal\user\Plugin\Action\AddRoleUser;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Alternate action plugin for 'user_add_role_action'.
*
* This plugin makes sure the add role action also works without
* the 'administer users' permission.
*
* @see \Drupal\user\Plugin\Action\AddRoleUser
*/
class RoleDelegationAddRoleUser extends AddRoleUser {
/**
* The role delegation access checker.
*
* @var \Drupal\role_delegation\Access\RoleDelegationAccessCheck
*/
protected $roleDelegationAccessCheck;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeInterface $entity_type, RoleDelegationAccessCheck $roleDelegationAccessCheck) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type);
$this->roleDelegationAccessCheck = $roleDelegationAccessCheck;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('entity_type.manager')->getDefinition('user_role'),
$container->get('access_check.role_delegation')
);
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
$access = parent::access($object, $account, $return_as_object);
// If access == true, the user already has the administer users permission.
if ($access === TRUE) {
return $access;
}
// Check if the user has access to add the role to the user.
return $this->roleDelegationAccessCheck->access($account);
}
}