Though the patch does a few things, the primary motivation for this issue is that the Edit link on monitor page is visible to people even without access. So classifying this issue as a bug. Otherwise switching sensorlist to use standard entity operations, and standardise entity and route access.
The attached patch also does a few extra things as a result.
- Switches SensorList (/admin/reports/monitoring) to use operations from listbuilder. Same strategy as other parts of core, including Views.
- Switch column to use 'Operations' phrasing.
- Switching to Operations also added Delete button as a side effect. Access is correctly deferred to SensorConfigAccessControlHandler
- Implemented hook_entity_operation to retain existing SensorList functions where Details and Force Run are buttons, and located before Edit button.
- Modified lines switches deprecated usage: urlInfo->toUrl, array() -> short syntax, etc.
- Switch access control edit and delete routes for sensor config to use entity access instead of hard coded permission. (makes it easier to override)
- Changed SensorConfigAccessControlHandler adding additional docs and removing deprecated usage.
- Added 'force run' to SensorConfigAccessControlHandler retaining existing access by permission.
- Changed 'view' in SensorConfigAccessControlHandler to return neutral instead of forbidden to allow overriding. Its not a true forbidden. Correctly cache by permission not by user.
To summarise: Existing functionality is mostly the same, apart from 'view' access op returning neutral instead of forbidden. Delete button visible on list.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff-3040171-access-control-9-10.txt | 601 bytes | dpi |
| #10 | 3040171-access-control-10.patch | 7.2 KB | dpi |
| #6 | interdiff-3040171-access-control-2-6.txt | 2.75 KB | dpi |
| #2 | 3040171-access-control.patch | 6 KB | dpi |
Issue fork monitoring-3040171
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dpiComment #3
dpiComment #4
dpiComment #6
dpiTweaks to retain fallback to administer behaviour
Comment #7
berdirLets add this to getDefaultOperations() in SensorListBuilder instead, we don't need to add a hook for own entity type.
Fine we deprecating that right now, we can use alterDeprecated for it.
you don't actually add $cacheability to the returned access result here.
Comment #8
jibranReroll + #7
Comment #9
dpiMinor fix to prevent many errors emitted by misuse of
alterDeprecatedComment #10
dpiFixes missing doc and test failure.
Comment #12
dpiCreated MR :)
Comment #13
acbramley commentedMR needs rebasing.
Comment #14
acbramley commentedRebased.