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.
Trying out the new IPE for the first time on a project - it's amazing :)
I was thinking it may be useful to add permissions for the 'pane settings' and the 'pane delete' button as well - I can imagine use cases where you only want to expose the 'move pane' functionality, or the style button.
Attached patch adds two new permissions and adds checks for those in panels_ipe.module.
Comment | File | Size | Author |
---|---|---|---|
#37 | panels-1699432-37.patch | 11.91 KB | ron_s |
|
Comments
Comment #1
brunodboComment #2
sdboyer CreditAttribution: sdboyer commentedhave a look at the pipelines branch. this is all gonna be SOOO much better...and no more global perms. woot.
because i want it to be done out of pipelines and not with a global perm, though, i'd want this patch rerolled against that system. it might be a bit tough for you to penetrate; if so, i'll get to it as i can.
Comment #3
ar-jan CreditAttribution: ar-jan commentedDoes that branch address granular settings for which types of pane roles are allowed to add in that 'Add content' dialog as well? (although that is probably not IPE-specific)
Comment #4
populist CreditAttribution: populist commentedUpdated the title to be a bit more descriptive
Comment #5
setvik CreditAttribution: setvik commentedRe-rolled patch with additional permission for "Adding" panes via IPE
Comment #5.0
setvik CreditAttribution: setvik commentedClarifying issue description
Comment #6
heddnThe permissions should be added to the ipe module, not to the panels module.
Comment #7
PI_Ron CreditAttribution: PI_Ron commentedThis patch doesn't work against the latest dev.
Comment #8
PI_Ron CreditAttribution: PI_Ron commentedI've created a new patch with a few changes that should now apply to the latest dev. The main difference was the
$links
variable had changed to$vars['links']
This issue / patch is a great leap forward for Panels IPE, allowing us to completely remove the buttons from the IPE for certain roles. When combined with the 'Immovable' setting, it allows much more control over what certain roles can do with the IPE. In saying that, these permissions are still global and I believe there is a great need for individual pane IPE permissions, if anyone can shed some more light on how these permissions or access control rules could be added to IPE that would be great. Do you think I should create a new issue for this, or do you think it is covered here: https://www.drupal.org/node/2151943
Many thanks for your guys to your work on this so far.
Comment #9
heddnPlease add these permissions/changes to IPE module, not directly to panel's itself.
Comment #10
PI_Ron CreditAttribution: PI_Ron commented@heddn I have now moved the permissions to the Panels IPE module. I also added a new permission to Panels IPE called 'administer panels styles in place editing'.
For the styles button to show up in IPE now the user needs either the permission 'administer panels styles in place editing' or the more global 'administer panels styles'.
Comment #11
PI_Ron CreditAttribution: PI_Ron commentedAdded permission for changing region styles through the IPE.
Comment #12
mrjmd CreditAttribution: mrjmd commentedComment #15
mrjmd CreditAttribution: mrjmd commentedThe function panels_permissions() has a TODO of "Almost all of these need to be moved into pipelines.", and I found it confusing how some IPE were still in panels but these new ones weren't.
So I've gone ahead and moved all IPE-related permissions into the IPE module. Patch attached.
Functionally tested this too and it seems to work very well. I find the main Panels permissions to still be a bit confusing, but that's not this patch's fault :).
Comment #16
mglamanYou're not writing and update hook to ensure people with the general permission have this permission.
All of the sudden my customers would lose ability to add/delete/customize their pages while still able to "customize page."
Comment #17
PI_Ron CreditAttribution: PI_Ron commentedSo we need to write an update hook to give these permissions to roles with the 'Use In Place Editor' permission?
Comment #18
mglamanYep! There's another patch in the queue we can copy that does the same for region styling.
Comment #19
mrjmd CreditAttribution: mrjmd commentedThanks for the review mglaman! Here's another attempt that includes the update script. I left the update in panels.install rather than creating an install file for panels_ipe.
Comment #20
mrjmd CreditAttribution: mrjmd commentedBlarg, no newline on that, and wrong update number. One more try.
I guess depending on which makes it in first, this or #2329419: Style permissions not granular enough, one of these updates is going to cause a conflict.
Comment #21
DamienMcKennaI suggest adding a drupal_set_message() here to explain to the site builder that the permissions changed.
Are there any problems with renaming this variable?
The title should append "(IPE)" to help some of the other descriptions.
Replace "Panels'" with "the Panels" to match other descriptions.
Should be spelled "In-Place Editor". Also, the "without "use page manager" access" bit could be slightly improve, e.g.: without the "use page manager" permission.
Comment #22
mrjmd CreditAttribution: mrjmd commentedAddressing Damien's comments:
1. I've added a comment and a link to the permissions page.
2. I agree, not sure there was ever any compelling reason to change it. Switched back.
3. Done
4. Done
5. Done
I've also removed the space from $add_button = ' ';
I don't think it was necessary.
Comment #23
PI_Ron CreditAttribution: PI_Ron commentedThat variable was changed from links to region_links to allow differentiating between the links to be added for a pane and the links for a region. Without the change in variable I couldn't see a way to create the 'administer region styles in place editing' permission.
Comment #24
DamienMcKennaI've put back the renamed variable, per @PI_Ron's feedback.
Comment #25
MichelleI tested #24 and it mostly works. The various permissions seemed to work fine, other than I couldn't see any change whether "Administer region styles with the Panels In-Place Editor" was enabled or not. I set this to "needs work" because I'm getting this error:
Notice: Undefined index: links in theme_panels_ipe_add_pane_button() (line 210 of /var/www/html/drupal-contrib/sites/all/modules/panels/panels_ipe/panels_ipe.module).
That line is $links = theme('links', array('links' => $vars['links'], 'attributes' => $attributes));
At that point, it's 'region_links' in $vars according to my debugger so I'm wondering if that just got missed in the name change?
Comment #26
MichelleI tried changing it to "region_links" and the error went away so I'm uploading a revised patch. I don't know if changing it in that spot will have any other effects, though, so this may not be the right way to do it.
Comment #27
DamienMcKennaDoh! Thanks for fixing that, Michelle.
Comment #28
PI_Ron CreditAttribution: PI_Ron commentedAwesome stuff, these permissions are going to help me a lot. Thanks.
Comment #29
aleksijohansson CreditAttribution: aleksijohansson at Wunder commented#26 seems to work great and in general the patch does what it says! Tested with 7.x-3.5.
Comment #30
Chris CharltonI'm excited for this feature.
Comment #31
ron_s CreditAttribution: ron_s commentedPatch #26 no longer applies cleanly due to the recent release. The new patch has two changes:
- Changes
panels_update_7304()
topanels_update_7307()
, since there is now a 7304 in the module.- Moves the new
bypass access in place editing
permission frompanels_permission
topanels_ipe_permission
, to match the others.Please review the attached, thanks.
Comment #32
ron_s CreditAttribution: ron_s commentedWith the new release on Oct 16, 2016, the patch in #31 no longer works. New version is attached for review.
Comment #33
PI_Ron CreditAttribution: PI_Ron commentedTried patch from #32 with latest dev, but got malformed patch:
Comment #34
arnested CreditAttribution: arnested at Reload commentedI fixed the patch from #32.
I also added a separate permission for
drag panes in place editing
for dragging panes with the Panels In-Place Editor.Comment #35
ron_s CreditAttribution: ron_s commentedPatch #34 no longer works with the latest 7.x-3.x-dev branch and 7.x-3.9 release. I've created a new version for review.
Comment #36
ron_s CreditAttribution: ron_s commentedAfter 3+ years and another new release, patch #35 no longer works.
Have again created a new version... I'd appreciate if this can finally get reviewed.
Comment #37
ron_s CreditAttribution: ron_s commentedAttached is a new version of this patch. In 7.x-3.11,
panels_update_7309
was added, which conflicts with the update this patch needs to do.The new patch pushes the update to 7310. All other changes are the same.
Comment #38
ron_s CreditAttribution: ron_s commentedPatch in #37 applies cleanly to the latest 7.x-3.12 version.