Requirements defined in the action plugin annotation have no effect

Created on 30 January 2025, 6 days ago

Problem/Motivation

VBO 4.3.2 and Drupal 11.

I need to show a custom action to a specific role.

In the module readme it is not mentioned, but in this guide it is mentioned that you can use the "requirements" to show the action to a given permission, this does not work for me.

requirements: an array of requirements that must be met to make the action available. Possible options:
_permission - if user has that permission, the action will be displayed in the options select list.
_custom_access - if set to TRUE, action's customAccess method will be called to determine if the current user can run the action on a specific object/ entity (see ViewsBulkOperationsActionBase for a default implementation). If FALSE or not defined, the customAccess method will not be called.

This is my plugin annotation.

/**
 * Action description.
 *
 * @Action(
 *   id = "generate_x_report",
 *   label = @Translation("Generate the report"),
 *   type = "",
 *   requirements = {
 *     "_permission" = "permission to generate x report",
 *   },
 * )
 */

Users without the permission "permission to generate x report" can also see "Generate the report" option of vbo.
Am I wrong about this?
I don't know if this is a bug or the documentation is wrong.

🐛 Bug report
Status

Active

Version

4.3

Component

Actions

Created by

🇦🇷Argentina abelpzl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024