Closed (fixed)
Project:
Panels
Version:
7.x-3.x-dev
Component:
Plugins - layouts
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2016 at 14:24 UTC
Updated:
14 Aug 2017 at 16:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
msningrum commentedComment #3
Screenack commentedWe can confirm that the 3.6 update introduced this issue, and 3.7 fails to resolve the issue.
To recreate:
admin/structure/panels/layouts/add-flexible"You are not authorized to access this page."warning pops up.We're not using flexible layouts, so we're not directly compromised.
Comment #4
ladytekla commentedSubscribing.
We are experiencing the same issue. Using flexible layouts and as soon as I try to add a row or column the "You are not authorized to view this page" message is received.
Comment #5
dsnopekComment #6
dsnopekI'm able to confirm that this bug exists in Panels 3.7. However, for me, applying the patch from #2787637-6: Page manager gives access denied when managing newly added variants to tasks other than 'page' fixes it. The issue description says that the OP tried that, but it didn't fix it. :-/
Can someone give step-by-step instructions for reproducing this even with that patch applied?
Unfortunately, if I can't get it to break, I can't help to fix it... Thanks!
Comment #7
dsnopekComment #8
Screenack commentedInteresting. I can not apply #2787637-6: Page manager gives access denied when managing newly added variants to tasks other than 'page' to simplytest.me so I had to create a test site locally.
I am still seeing "You are not authorized to access this page."
To recreate locally:
Dev environment configuration:
Enabled modules:
Comment #9
deranga commentedWill a layout ever have a storage type?
I've added a check to see if editing_layout, not sure this is correct approach to address this issue, but have not had time to review this in detail.
The patch submitted is against 7.x-3.7 so can't be applied to dev.
Comment #10
dsnopekWhen editing the layout, we need to check the storage_type/id of the panels display that it's on. The layout itself won't ever have a storage_type/id, though.
Comment #11
deranga commentedSurely sometimes the layout will not be associated to any display?
For instance if you were to go to /admin/structure/panels/layouts, and click add flexible layout.
Comment #12
dsnopekOk, I see why I failed to reproduce this! I kept creating a flexible layout as part of a Panels display, and totally blew pass the
admin/structure/panels/layouts/add-flexiblelink. Sorry, everyone!So, this happens when creating a reusable flexible layout that isn't part of a Panels display.
The thing is that at the API level, I think that a flexible layout is always part of a Panels display (right?), so that UI has got to be creating a temporary, fake Panels display or something like that? We'll need to check a special set of permissions in that case, but continue to check the normal permissions when the settings for the flexible layout are on a real display. Maybe we could have a special storage plugin just for use in that UI?
Comment #13
dsnopekThis is my best guess on where the fake Panels display is created:
http://cgit.drupalcode.org/panels/tree/plugins/export_ui/panels_layouts_...
If we did decided to create a storage plugin for handling this case, this would be the place (if my guess is correct) to set that.
Comment #14
Screenack commentedderanga; the patch works here against 3.7 (not dev) following the same steps I outline in #8
dsnopek; if my report in #8 about step 7; "Navigate to
admin/structure/panels/layouts/add-flexible" was ambiguous, please let me know.Comment #15
dsnopek@Screenack: No your report was fine, it was my mistake. Sorry!
Comment #16
deranga commentedOk, just so the patch I attached makes more sense when reading I've adjusted the comment and removed the unnecessary extra line.
Is there any reason to also implement the new security measure for layouts, or is a simple user_access check for that permission good enough here?
Again attached patch is against 7.x-3.7 (not dev)
Comment #17
dsnopekWell, if we just check
user_access('administer panels layouts')that means that anyone with that permission would be able to change the flexible layout on any Panels display, even if they don't have permission to edit the underlying display. So, the current patch works for reusable flexible layouts that aren't on a Panels display, but potentially opens up a security hole for flexible layouts that aren't reusable, but just part of a single display.EDIT: I should note that I haven't actually tested that it opens up a new problem, just that that's why we need to be sure to test both cases and the final solution might end up being more complicated.
Comment #18
deranga commentedOkay, sure - definitely don't want to open up and perhaps the code change I'm suggesting should be nested to not disrupt the new storage type permission check flow:
Just so I'm clear on this, in what ways can you currently restrict the access to creating/editing a display irrespective of the layout?
I didn't think that the permissions offered by panels were that granular?
Comment #19
deranga commentedPatch based on last comment as realised that original patch would have subverted current permission check flow
Comment #20
Screenack commentedI can confirm that the patch in #19 works. Can we use the Drupal-recommended naming convention for uploading patches? This will help disambiguate which patch we're talking about.
layout_issue_1.patch should be
panels-flexlayoutperms-2790075-20-7x.patch
I've taken your patch and renamed it to standard.
Comment #21
deranga commented@Screenack - apologies, you are right, I should be using the naming convention.
Although this patch works, as @dsnopek mentions, this is quite a simplistic fix, and may not be the appropriate way to address.
Where the `fake` display is generated if one is not associated to the layout in http://cgit.drupalcode.org/panels/tree/plugins/export_ui/panels_layouts_... is likely the correct place to add in a storage type and id:
So adding something like this after line 75 and before line 82:
What I don't follow hence the questions, is what benefit there would be in adding a storage type and storage id in this instance - I don't follow what granular permissions can be set to grant editing of a layout. Also, I'd need to understand more about how the storage type and id are handled; any pointers @dsnopek?
Comment #22
dsnopekHere's a patch with what I was thinking for this. It works in my testing, however, you'll need to clear the cache (so Panels picks up the new plugin) and if you previously started editing a particular flexible layout, you may need to save it for the change to take effect (because the old Panels display will already be cached in the CTools object cache).
Please let me know if this works for the folks who were having the problem!
Comment #23
Screenack commentedThis patch successfully addresses the warning, using the steps I outlined in #8, but using the latest patch.
Comment #24
damienmckennaBumping to 3.9.
Comment #25
dasginganinjaCurrent Setup:
On a new installation of 7.51 I installed the above modules. I then navigated to Admin -> Structure -> Panels -> Layouts and added a new custom layout without any customizations other than setting the title. After that I went to edit the layout.
From Column I selected "Add row to top" and was greeted with the "You are not authorized" alert. That left the modal panel up in a spinning loading state so I closed it.
After that I selected "Add region to left" from Row and was greeted with the same functionality of alert and the modal window sticking.
This behavior follows for {Canvas,Column,Row,Region} settings, adding to {Canvas,Column,Row} removing a {Column,Row,Region}.
The above patch (#22) solves this issue. It's impossible to make changes to a custom layout without that patch and I certainly feel that this should be addressed in the next release of Panels #2819117: Plan for Panels 7.x-3.9 release.
Comment #26
dasginganinjaThis line of code is missing a full-stop. (Drupal.Commenting.InlineComment.InvalidEndChar)
The new panels storage / layout plugin that defines access looks like is was modeled off of plugins/panels_storage/page_manager.inc and this exists there as well.
I have attached a new patch with this small Code Standards piece fixed. Other than that it looks good to go for the 3.9 release and addresses all of the "You are not authorized" messages that were previously occurring.
Comment #27
damienmckennaI've reviewed the changes between #22 and #26 and can confirm there *only* difference is a period, I guess @dasginganinja cleans their glasses more often than the rest of us ;-)
Comment #29
damienmckennaThis was committed and will be in the next release.
Comment #30
japerryThanks Damien, yah I was on a plane and d.o was being.. slow :) Fixed!
Comment #32
pub497 commentedthis doesn't patch with version 3.4 of panelizer?