Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
7.x-3.x-dev
Component:
Core
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2011 at 10:35 UTC
Updated:
8 May 2017 at 01:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedYes, I like this idea.
Comment #2
infojunkieMe too! This already happens in the Drush integration btw.
Comment #3
mathieuhelie commentedBumping because I need to list some nodes in Rules that requires a filtered view.
#1310228: Can't execute a rule without "Administer Users" permission
Comment #4
emattias commentedHere's a patch that adds an option to skip the permission check per individual action.
Comment #5
infojunkieI was initially thinking of impersonating user 1 right before execution, as in:
Any opinion as to the pros/cons of each approach?
Comment #6
emattias commentedMy thinking was that what if, for example, logging of which user did what was added. Then it may say user 1 when in fact it may not be true. My approach is essentially the same thing. Also everybody may not know that user 1 skips the permission check.
Comment #7
bojanz commentedSkipping the permission check is not enough, the trick needs to be #5.
Otherwise entity_access and other access controls will still fail.
Comment #8
emattias commentedBut aren't the access controls skipped anyhow when executing as user 1?
Comment #9
bojanz commentedYep. But your patch doesn't do that.
Comment #10
emattias commentedI know that my patch doesn't do that, it was an active choice. :)
My thinking was that if permission checking is skipped when running entity_access, why not just skip the entity_access checking?
Also, some users my not be aware that "execute as user 1" == skipping permission check so I opted for actually skipping the permission checking and be verbose with what the option means.
Is this your suggestion? (in D7)
Comment #11
infojunkieWe can label the option "skip permission check" and implement it as "impersonate user 1".
Comment #12
emattias commentedSo the switching back to the real user will be done in _views_bulk_operations_execute_finished?
How should I have the $old_state available there. Should I add $user->old_state or another global variable? Or do you have a better approach?
Comment #13
digitalfrontiersmediaI agree with emattias' strategy here as it doesn't muss about with user object switching and session saving. It's simple and effective.
I implemented this patch and it works well and can't really see any problems with it. The only issue I could even imagine would be granting someone permission to admin and build VBO's and from there building a VBO that elevates themselves or others to Administrator role by then skipping perm checking on the operation. But you're likely not giving VBO admin rights to someone who can't be trusted with user admin anyway?
Comment #14
westie commentedIf there is a method to sandbox the admin privileges to the VBO view actions then, certainly you would trust these users to perform the task - after all you built the VBO for them/it.
However, would what you are suggesting potentially allow for them to act as an admin outside of VBO?
Comment #15
digitalfrontiersmedia@westie, Yes. Someone could be sandboxed to admin Views/VBO, then build a VBO that changes alters the roles of the users returned to Super Admin role or something. Click "Skip permission checking" so it wouldn't bother to see if they have "admin users" or Role Delegation permissions, and elevate their user to Super Admin, and from there do whatever the heck they wanted.
But it would initially depend on them being trusted enough to have Views/VBO admin perms to begin with.
Comment #16
Abbass commentedAnybody can answer #10 and #11 about how to implement this to have the action executed and revert at the end of the action to the user 1.
Just so you know content access module has Grant/Revert access actions compatible with rules. However they do not work in rules components within action sets. May be it can be an avenue instead of hacking the code to impersonate user 1 by granting access before the action and reverting the access to regular at its end.
but i don't think it is necessary to impersonate a 100% the admin as the only permission usually needed to execute a bulk operation on a node is Edit any content.
Comment #17
Ogredude commentedEdit: Nevermind, #18 takes care of it.
Comment #18
Ogredude commentedReworked the patch to suit the current -dev. Various changes like $form['vbo']['operations'] is now $form['vbo_operations'] incorporated.
Also, it still wasn't solving my problem, which is that the action didn't even show as an available action to anyone but user1. I reworked the permission check in get_selected_options() to account for the permissions skip.
Comment #19
majdi commented#18 works for me , it solve the whole problem
Comment #20
chrisckCan I just clarify if the #18 patch allows users other than admin (uid: 1) to execute rules component actions?
I have a view that shows only the nodes the author created and I would like for them to be able to execute rules component actions on their own nodes.
EDIT: I have found my solution. I am using Rules Link module instead.
Comment #21
rahul.shindeSubmitting the patch for release 7.x-3.2
Comment #22
rahul.shindeHere is another patch for branch 7.x-3.x
Comment #23
schultetwin commentedPatch applied to 7.x-3.2 worked beautifully for me, thank you!
Comment #24
ikeigenwijs commentedI test patch #22 applied on stable release 7x.3.2
Works as advertised, this was exactly what we needed.
Ready to be integrated in dev and next release.
Our use case:
Normal users can not edit or create a specefic field.
But they can assign one trough VBO that calls a rule action with lots of goodies.
The skip permission power does travel the complete rule chain.
thx
Comment #25
adamtyoung commentedI applied the patch (21) successfully to 7.x-3.2. Should I see an extra option under each VBO choice in the view to turn this on? For example 'Execute as user 1' ? I do not see this.
Comment #26
adamtyoung commentedWorking now. Many thanks to the submitters!
Comment #27
ikeigenwijs commentedWhen will there be a new stable release?
I saw its been more than a year and there are a lot of patches added already.
Comment #28
eswiderski commentedI applied this patch and it was working, but seems to have just stopped appearing for me. The option is no longer in the view. Anybody else see this?
Comment #29
ikeigenwijs commented@eswiderski
Did you have automated updates or something like that, you have to reaplly the patch eatch time you replace the code with a different version.
Clear cach?
Still working at our end.
Comment #30
eswiderski commented@ikeigenwijs
what version/patch combo are you guys using?
thanks!
ed
Comment #31
eswiderski commented@ikeigenwijs good call it was probably an update. just patched latest stable with 22 and it's back.
thanks!
Comment #32
ikeigenwijs commentedIt would be nice if it would get commited...
Comment #33
askibinski commentedPatch in #22 also works for version 3.3.
Comment #34
askibinski commentedThis patch needs work because currently all existing views that use VBO will be broken:
This is probably caused by getAdminOption which does not receive a correct value for the setting, because the view was never saved.
Quick fix is to resave all exisiting views, after editting the VBO settings (for each display).
Solution would be to patch getAdminOption() or include an update.php script which would update all exisiting views.edit: no need for that, just need to check if $operations exists, something like attached patch.
Comment #35
askibinski commentedThis patch should be combined with the patch in #22.
Comment #36
ikeigenwijs commentedLooks good
Comment #37
ikeigenwijs commentedComment #38
aaronbaumanpatch doesn't apply to latest dev.
Comment #39
aaronbaumanHere's a reroll, which combines #22 and #35 against latest dev.
Comment #40
joelpittetThanks for the re-roll @aaronbauman, could you make the patch relative to the module's root please? Inside
views_bulk_operationswhen you are making the patch use--relativeflag ongit diff --relative .Comment #41
aaronbaumanOoops, that's my bad.
Here's a re-reroll
Comment #42
ikeigenwijs commentedStill looks good on current dev.
We are using this for about 9 months on a production environment with +- 3 million nodes so we use vbo a lot.
Would be nice to have this committed.
Comment #43
lelivero commentedStill works with the dev from Nov 28 2015
Comment #44
joe.p commented#41 is perfectly working with VBO version 7.x-3.3. Please commit this patch to the dev release.
Comment #45
blumm commentedInstead of #5 (which is valid for drupal6 only) the instructions in https://www.drupal.org/node/218104 worked for me (I wanted to "execute as user 1" in Rules). They contain the code for both drupal7 and drupal8. This may be helpful / an alternative to the patch above which only refers to VBOs
Comment #46
Lord Pachelbel commented#41 works for me, too, using 7.x-3.3.
FWIW, I needed this patch because I'm writing a custom action that will create nodes using data from a view, but the user performing the action will never have permission to alter the data in the view itself, which is what VBO is normally used for. I couldn't figure out a way to work around this without skipping VBO's permissions checks entirely.
Comment #47
rahul.shinde#41 works for 7.x-3.3.
Comment #48
ikeigenwijs commentedStill applies cleanly on current dev
A screenshot of the UI addition.
No change or impact for current installs and views.
Comment #49
nwom commented#41 works perfectly. Thank you very much
Comment #50
zenimagine commentedworks for me :-)
Comment #51
nerdcore commentedIt's been over 14 months since this issue was marked RTBC.
Could we get this committed to the module code, please?
Comment #52
joelpittetThe code looks good, just reviewing the functionality and will likely commit tonight or tomorrow.
Comment #54
joelpittetCommitted and pushed to -dev
Comment #55
rahul.shindeComment #57
opensense commentedIs this in D8 dev version?