Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
block_content.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2022 at 01:16 UTC
Updated:
2 Nov 2022 at 20:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
benjifisherIt looks as though (2) from the issue description was already done on the parent issue, just not checked off the list.
In
Drupal\block_content\BlockContentType, I seeas recommended in the change record.
I also tested:
demo_umamiprofile./en/admin/people/permissions/module/block_content, grant all "edit block type" permissions to the Editor role./en/admin/config/development/configuration/single/exportto inspect the dependencies for the role.The dependencies were added.
Comment #3
benjifisherThe "Manage Permissions" tab was added in #3253955: Let modules opt in to the bundle-specific permissions form. But when that issue was fixed, there were no per-block-type permissions from the
block_contentmodule. There might be such permissions from other modules, such as Configuration Translation or Layout Builder. Since there may or may not be per-block-type permissions, the BlockContentType entity specifies an access check to avoid allowing access to an empty page, or generating links to it.The change record explains how to handle this: specify one of two route providers in the entity annotations, depending on whether the check is needed. I have made the required change in the MR for this issue.
Comment #5
benjifisherItem (1) from the issue description relates to the
"create block $type"permissions. Some patches on the parent issue added these permissions, but the final version does not. The create permissions were moved to a child issue (sibling of this one): #3213736: Add "create block $type" permissions.Again, the task should have been removed from the list in the issue summary of the parent issue.
I have addressed all three items, so this issue is now ready for review.
Comment #6
benjifisherP.S. I copied some comments from the parent issue to #3213736: Add "create block $type" permissions.
Comment #7
aaronmchaleDid some manual testing, in short:
block/2(type: Test) but importantly notblock/1(type: Basic block).As a sort of sanity check, I also tested adding and remove the Administer Block permission to Content Editor, and everything behaved as expected. I also noted that adding the Administer Block permission was the only way to get the contextual links to appear, even though Content Editor could edit the "Test" block, I had to navigate directly to
block/2in order to edit it, there was no intuitive way to access this page from the site front-end.So while functionally everything works as expected, from a UX perspective I'd say that's a fundamental problem. That said, that is something which is not in the scope of this issue, so I'm happy to mark this issue as RTBC.
Comment #8
benjifisherAaronMcHale:
Thanks for testing. Did you also review the +1/-1 change in the MR?
Please re-test the contextual links. In the Standard profile, the Content Editor role already has permission to use contextual links. That and permission to edit Test blocks should be enough, and it works as expected in my testing:
It is also listed as one of the "completed tasks" on the parent issue. (Search that issue for "contextual".)
Also, you tested the functionality of the parent issue, but you did not test the change made in this one, which affects access to the Permissions form (tab, local task) for the block types.
/admin/structure/block/block-content/manage/basic/permissions./admin/structure/block/block-content/types.All of that should function the same with or without the change in this issue. The change here is to skip the unnecessary test that there is at least one permission to manage. Maybe the easiest way to test that is to hack
Drupal\user\Form\EntityPermissionsForm::access()so that it always returnsAccessResult::forbidden(). With 10.1.x, even the administrator role cannot access the permissions form. With the patch, anyone with the "administer permissions" permission should have access.In my testing, all of that works.
Back to NR.
Comment #9
aaronmchaleYes, that was what my manual testing centred around, essentially validating what the behaviour is in HEAD and then confirming that after applying the MR, there is no regressions; And so, as far as I could tell, the change in the MR did not result in any regression.
I just tested again, inspected the source code, and confirmed that the contextual links are actually there, I just wasn't initially seeing them, perhaps because of where I positioned the block and that it only has one word in it, so the "hit box" is quite short. Regardless I do now see the contextual links for the blocks for which the content editor user has permission to edit.
Can confirm that I can also replicate that, and everything there works as expected.
So looks like RTBC again.
Comment #11
catchTook me a minute to realise the patch doesn't actually fix 2/3 bullets in the issue summary because they were already fixed in the parent issue, but it's all in the comments and patch ended up being trivial. Committed 6c6f7ad and pushed to 10.1.x. Thanks!