
Problem/Motivation
while working on #2315773: Create a menu link field type/widget/formatter I realized we have a generic reset form, but not a generic delete form, even though it would be trivial to provide one and make life easier for contrib
Proposed resolution
Since that patch is postponed, let's pull the code in there.
Remaining tasks
Add some test?
User interface changes
N/A
API changes
minor change to MenuForm
Comment | File | Size | Author |
---|---|---|---|
#1 | 2408275-1.patch | 5.33 KB | pwolanin |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commentedHere's the added form and other small changes
Comment #2
dawehnerSo, we don't take into account for example
_entity_access: menu_link_content.delete
but just whether something is deletable.This sounds wrong.
Comment #3
pwolanin CreditAttribution: pwolanin commented@dawehner - so this is the generic case for a plugin that doesn't define it's own delete route. We also check 'administer menu'. In core we already have a different route defined for menu link content entities since they do other checks.
Comment #4
dawehnerWell, sure I know but we should ask the menu link plugin about it.
Comment #5
pwolanin CreditAttribution: pwolanin commentedIn fact, we only check 'administer menu' for delete access to the menu link content entity now in core in \Drupal\menu_link_content\MenuLinkContentAccessControlHandler
so the menu_link_content.delete check is actually just the same as 'administer menu' permission in the end.
Comment #6
pwolanin CreditAttribution: pwolanin commentedIn other words - if a plugin wants to use the generic reset or delete forms, it's essentially saying the 'administer menu' permission is sufficient. If it's not sufficient, it can define its own routes and do some other access checks.
Comment #7
dawehnerAlright, but still, if you create the following URL:
I should not be able to delete the menu link, because just 'administer menu' does not reflect entity access.
It seems to be okay, in case 'administer menu' would be a 'restricted access' permission.
Comment #8
tim.plunkettCross linking #1728804: Introduce (Content)EntityDeleteForm and children to handle entity deletions, in case that goes in first.
Comment #24
smustgrave CreditAttribution: smustgrave at Mobomo commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #25
smustgrave CreditAttribution: smustgrave at Mobomo commentedIs this actually still needed?