Loading core/modules/user/src/Plugin/views/access/Permission.php +7 −6 Changes for core/modules/user/src/Plugin/views/access/Permission.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\user\PermissionHandlerInterface; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; Loading @@ -18,13 +20,12 @@ * Access plugin that provides permission-based access control. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "perm", * title = @Translation("Permission"), * help = @Translation("Access will be granted to users with the specified permission string.") * ) */ #[ViewsAccess( id: 'perm', title: new TranslatableMarkup('Permission'), help: new TranslatableMarkup('Access will be granted to users with the specified permission string.'), )] class Permission extends AccessPluginBase implements CacheableDependencyInterface { use DeprecatedServicePropertyTrait; Loading core/modules/user/src/Plugin/views/access/Role.php +7 −6 Changes for core/modules/user/src/Plugin/views/access/Role.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -6,8 +6,10 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\user\RoleInterface; use Drupal\user\RoleStorageInterface; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; Loading @@ -17,13 +19,12 @@ * Access plugin that provides role-based access control. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "role", * title = @Translation("Role"), * help = @Translation("Access will be granted to users with any of the specified roles.") * ) */ #[ViewsAccess( id: 'role', title: new TranslatableMarkup('Role'), help: new TranslatableMarkup('Access will be granted to users with any of the specified roles.'), )] class Role extends AccessPluginBase implements CacheableDependencyInterface { /** Loading core/modules/views/src/Attribute/ViewsAccess.php 0 → 100644 +53 −0 Changes for core/modules/views/src/Attribute/ViewsAccess.php: 53 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\views\Attribute; use Drupal\Component\Plugin\Attribute\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a views access plugins type attribute for plugin discovery. * * @see \Drupal\views\Plugin\views\access\AccessPluginBase * * @ingroup views_access_plugins */ #[\Attribute(\Attribute::TARGET_CLASS)] class ViewsAccess extends Plugin { /** * Constructs a ViewsAccess attribute. * * @param string $id * The plugin ID. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title * The plugin title used in the views UI. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $short_title * (optional) The short title used in the views UI. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $help * (optional) A short help string; this is displayed in the views UI. * @param string[]|null $display_types * (optional) The types of the display this plugin can be used with. * For example the Feed display defines the type 'feed', so only rss style * and row plugins can be used in the views UI. * @param string[] $base * (optional) The base tables on which this access plugin can be used. * If no base table is specified the plugin can be used with all tables. * @param bool $no_ui * (optional) Whether the plugin should be not selectable in the UI. * If set to TRUE, you can still use it via the API in config files. * @param class-string|null $deriver * (optional) The deriver class. */ public function __construct( public readonly string $id, public readonly TranslatableMarkup $title, public readonly ?TranslatableMarkup $short_title = NULL, public readonly ?TranslatableMarkup $help = NULL, public readonly ?array $display_types = NULL, public readonly array $base = [], public readonly bool $no_ui = FALSE, public readonly ?string $deriver = NULL ) {} } core/modules/views/src/Plugin/views/access/None.php +7 −6 Changes for core/modules/views/src/Plugin/views/access/None.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -3,19 +3,20 @@ namespace Drupal\views\Plugin\views\access; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Attribute\ViewsAccess; use Symfony\Component\Routing\Route; /** * Access plugin that provides no access control at all. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "none", * title = @Translation("Unrestricted"), * help = @Translation("Will be available to all users.") * ) */ #[ViewsAccess( id: 'none', title: new TranslatableMarkup('Unrestricted'), help: new TranslatableMarkup('Will be available to all users.'), )] class None extends AccessPluginBase { /** Loading core/modules/views/tests/modules/views_test_cacheable_metadata_calculation/src/Plugin/views/access/CacheableMetadataCalculationTest.php +7 −6 Changes for core/modules/views/tests/modules/views_test_cacheable_metadata_calculation/src/Plugin/views/access/CacheableMetadataCalculationTest.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -6,19 +6,20 @@ use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; /** * Tests plugin that reports when cacheable metadata is being calculated. * * @ViewsAccess( * id = "test_cacheable_metadata_access", * title = @Translation("Cacheable metadata calculation test access plugin"), * help = @Translation("Provides a test access plugin that reports when cacheable metadata is being calculated.") * ) */ #[ViewsAccess( id: 'test_cacheable_metadata_access', title: new TranslatableMarkup('Cacheable metadata calculation test access plugin'), help: new TranslatableMarkup('Provides a test access plugin that reports when cacheable metadata is being calculated.'), )] class CacheableMetadataCalculationTest extends AccessPluginBase implements CacheableDependencyInterface { /** Loading Loading
core/modules/user/src/Plugin/views/access/Permission.php +7 −6 Changes for core/modules/user/src/Plugin/views/access/Permission.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -9,7 +9,9 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\user\PermissionHandlerInterface; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; Loading @@ -18,13 +20,12 @@ * Access plugin that provides permission-based access control. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "perm", * title = @Translation("Permission"), * help = @Translation("Access will be granted to users with the specified permission string.") * ) */ #[ViewsAccess( id: 'perm', title: new TranslatableMarkup('Permission'), help: new TranslatableMarkup('Access will be granted to users with the specified permission string.'), )] class Permission extends AccessPluginBase implements CacheableDependencyInterface { use DeprecatedServicePropertyTrait; Loading
core/modules/user/src/Plugin/views/access/Role.php +7 −6 Changes for core/modules/user/src/Plugin/views/access/Role.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -6,8 +6,10 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\user\RoleInterface; use Drupal\user\RoleStorageInterface; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; Loading @@ -17,13 +19,12 @@ * Access plugin that provides role-based access control. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "role", * title = @Translation("Role"), * help = @Translation("Access will be granted to users with any of the specified roles.") * ) */ #[ViewsAccess( id: 'role', title: new TranslatableMarkup('Role'), help: new TranslatableMarkup('Access will be granted to users with any of the specified roles.'), )] class Role extends AccessPluginBase implements CacheableDependencyInterface { /** Loading
core/modules/views/src/Attribute/ViewsAccess.php 0 → 100644 +53 −0 Changes for core/modules/views/src/Attribute/ViewsAccess.php: 53 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\views\Attribute; use Drupal\Component\Plugin\Attribute\Plugin; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Defines a views access plugins type attribute for plugin discovery. * * @see \Drupal\views\Plugin\views\access\AccessPluginBase * * @ingroup views_access_plugins */ #[\Attribute(\Attribute::TARGET_CLASS)] class ViewsAccess extends Plugin { /** * Constructs a ViewsAccess attribute. * * @param string $id * The plugin ID. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title * The plugin title used in the views UI. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $short_title * (optional) The short title used in the views UI. * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $help * (optional) A short help string; this is displayed in the views UI. * @param string[]|null $display_types * (optional) The types of the display this plugin can be used with. * For example the Feed display defines the type 'feed', so only rss style * and row plugins can be used in the views UI. * @param string[] $base * (optional) The base tables on which this access plugin can be used. * If no base table is specified the plugin can be used with all tables. * @param bool $no_ui * (optional) Whether the plugin should be not selectable in the UI. * If set to TRUE, you can still use it via the API in config files. * @param class-string|null $deriver * (optional) The deriver class. */ public function __construct( public readonly string $id, public readonly TranslatableMarkup $title, public readonly ?TranslatableMarkup $short_title = NULL, public readonly ?TranslatableMarkup $help = NULL, public readonly ?array $display_types = NULL, public readonly array $base = [], public readonly bool $no_ui = FALSE, public readonly ?string $deriver = NULL ) {} }
core/modules/views/src/Plugin/views/access/None.php +7 −6 Changes for core/modules/views/src/Plugin/views/access/None.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -3,19 +3,20 @@ namespace Drupal\views\Plugin\views\access; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Attribute\ViewsAccess; use Symfony\Component\Routing\Route; /** * Access plugin that provides no access control at all. * * @ingroup views_access_plugins * * @ViewsAccess( * id = "none", * title = @Translation("Unrestricted"), * help = @Translation("Will be available to all users.") * ) */ #[ViewsAccess( id: 'none', title: new TranslatableMarkup('Unrestricted'), help: new TranslatableMarkup('Will be available to all users.'), )] class None extends AccessPluginBase { /** Loading
core/modules/views/tests/modules/views_test_cacheable_metadata_calculation/src/Plugin/views/access/CacheableMetadataCalculationTest.php +7 −6 Changes for core/modules/views/tests/modules/views_test_cacheable_metadata_calculation/src/Plugin/views/access/CacheableMetadataCalculationTest.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -6,19 +6,20 @@ use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Attribute\ViewsAccess; use Drupal\views\Plugin\views\access\AccessPluginBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; /** * Tests plugin that reports when cacheable metadata is being calculated. * * @ViewsAccess( * id = "test_cacheable_metadata_access", * title = @Translation("Cacheable metadata calculation test access plugin"), * help = @Translation("Provides a test access plugin that reports when cacheable metadata is being calculated.") * ) */ #[ViewsAccess( id: 'test_cacheable_metadata_access', title: new TranslatableMarkup('Cacheable metadata calculation test access plugin'), help: new TranslatableMarkup('Provides a test access plugin that reports when cacheable metadata is being calculated.'), )] class CacheableMetadataCalculationTest extends AccessPluginBase implements CacheableDependencyInterface { /** Loading