- Issue created by @altcom_alfonso
- Merge request !12Added checks before modifying the action definitions. → (Open) created by Unnamed author
After updating Views Bulk Operations to the 4.3.4 there are warning on core content_moderation module complaining about undefined array key "id".
Views Bulk Operations is now filtering out the actions the user doesn't have permission to use. The problem comes when
function administerusersbyrole_action_info_alter(array &$definitions) {
$definitions['user_add_role_action']['class'] = AddRoleUser::class;
$definitions['user_remove_role_action']['class'] = RemoveRoleUser::class;
}
goes to replace the classes, it doesn't check if the action exists first.
Install Views Bulk Operations to 4.3.2 or heigher and Administer Users by Role to 3.5.0, go to an admin view with VBO in it with a user with limited permissions. Warnings will be displayed.
To check if the action definition is set before modifying it.
function administerusersbyrole_action_info_alter(array &$definitions) {
if (isset($definitions['user_add_role_action'])) {
$definitions['user_add_role_action']['class'] = AddRoleUser::class;
}
if (isset($definitions['user_remove_role_action'])) {
$definitions['user_remove_role_action']['class'] = RemoveRoleUser::class;
}
}
Active
3.0
Code