Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I created a simple Rules component that displays a message with the id of the file attached to a node (later I'd like to save this file). I selected the component in the VBO field, OK. But I open view page the option doesn't appear in the list of action available, it looks like a bug doesn't it?
Here's my rules component export:
{ "rules_convert_images_to_media_files" : {
"LABEL" : "Convert Image content type to media files",
"PLUGIN" : "rule",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "node" : { "label" : "Node", "type" : "node" } },
"IF" : [
{ "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "photo" : "photo" } } } }
],
"DO" : [
{ "entity_fetch" : {
"USING" : { "type" : "file", "id" : [ "node:field-photo:file:fid" ] },
"PROVIDE" : { "entity_fetched" : { "file" : "File" } }
}
},
{ "drupal_message" : { "message" : "Saving file [file:fid] of image [node:nid]" } }
]
}
}
and here is my views vbo field export (I guess this is useless):
$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'node';
$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_result'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array(
...
'rules_component::rules_convert_images_to_media_files' => array(
'selected' => 1,
'use_queue' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
),
...
);
Can anyone help me getting through that?
Comments
Comment #1
hosef CreditAttribution: hosef commentedI appear to be having the same issue. I create a new rule/rule set and it shows up as an option when I am configuring the VBO field, but when I go to the actual view there are no options in the drop down box.
Comment #2
hosef CreditAttribution: hosef commentedChanged the title to be more appropriate to the bug in question.
Comment #3
hosef CreditAttribution: hosef commentedOk, after a little digging it appears that this is not a problem with VBO. The issue is caused by the fact that Rules does not allow anyone, including uid 1, to execute a component by default.
There is already an issue in the Rules issue queue which should help to address the problem, #1647252: Access issue: "Administer rule configurations" permission doesn't grant components execution
Comment #4
Striky2 CreditAttribution: Striky2 commented+1
Clearly a permission-type issue.
The ticket seem to say there is a workaround. Did anyone successfully use the suggested workaround to have the component action appearing on the top of the VBO view without being uid 1?
Comment #5
kristofferwiklund CreditAttribution: kristofferwiklund commentedIf you edit you component. And under the Settings section. You have the checkbox
"Configure access for using this component with a permission."
Click that and then set allow permission for your administrator role. After that it works
Comment #6
vlyalko CreditAttribution: vlyalko commentedThis worked great. Thank you.
Comment #7
firfin CreditAttribution: firfin commentedActually this seems to be a duplicate of #1831578: Use file_entity_access() callback when file_entity module is present.
At the least the patch in there (committed to more recent versions of entity module) fixed it for me.
Comment #8
firfin CreditAttribution: firfin commentedComment #8.0
firfin CreditAttribution: firfin commentedCopy/paste correction
Comment #9
BrightBoldI tried the patch in #9 in #1831578: Use file_entity_access() callback when file_entity module is present but it turned out I was already using a version of Entity with that code included and I was still having this problem.
I didn't think it was a permissions issue since I was logged in as user1, but the solution in #5 here fixed it for me. Thanks.
Comment #10
johnlaine CreditAttribution: johnlaine commentedYes, #5 worked for me as well. A big thank you to you sir!
Comment #11
jweirather CreditAttribution: jweirather commented#5. All day long.