Problem/Motivation
Procedural handler access callbacks have been deprecated.
Default to false if they exist afterwards to prevent leaking data.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3547724
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:
- 3547724-set-the-default
compare
- 3547724-view-access-default
changes, plain diff MR !15272
Comments
Comment #3
smustgrave commentedThis may be good to start?
Comment #4
nicxvan commentedYes
Comment #6
smustgrave commentedIs that what you meant? Wasn't entirely sure what needed to be removed.
starting to go back through any deprecations we moved to follow ups and this was one.
Comment #7
nicxvan commentedLooking at the intent I think we need to also drop:
&& function_exists($this->definition['access callback'])The access callback looks like it only supported procedural implementations, and we need to not accidentally grant access where we didn't previously.
I may be mistaken here so I tagged for subsystem review too.
Comment #8
smustgrave commentedLets do the approach @berdir mentioned.
Comment #9
smustgrave commentedComment #10
lendudeThe test should have been using
$view->$type['access_callback']and not$view->field['access_callback'], that way it would have actually been doing what it was supposed to do, check it for all handler types. I've tried that locally and it works and it's green.If we'd want to keep the coverage for now, we should probably use a dataprovider to supply the $type and iterate through them that way, so we can catch all the deprecation messages and not just the first one. That would work I think.
Since we are dealing with 'access' stuff, I'm not sure removing the coverage is the best way to go here, if using a dataprovider does actually work it should be simple enough a change to keep the coverage (didn't check that yet).
Comment #11
berdir> Since we are dealing with 'access' stuff, I'm not sure removing the coverage is the best way to go here, if using a dataprovider does actually work it should be simple enough a change to keep the coverage (didn't check that yet).
That's fair. The problem is that the fundamental mechanism that this uses to test access is being removed. Without it, we no longer have a mechanism to generically test every plugin type because every access logic needs to be implemented in the plugin. We'd need to have a custom test plugin for all of them to exercise this. That's quite a lot of work.
We have test coverage for actual access logic, such as EntityField and FieldLanguage, but most plugins do not currently have examples that include access restrictions.
Comment #12
lendudeYeah that is a fair point, that would make it not a low effort to keep this, we have some coverage for access(), I agree removing it makes sense.
Comment #13
catchRe-titling for what this actually does now. Got momentarily thrown off by the return TRUE after the exception is thrown, but that's only if we're in the non-deprecated path, but I was looking for a 'return FALSE' and didn't see one.
Given this is data structure so only test coverage would actually trigger the deprecation, it does seem nicer to throw an exception here. I think we need a follow-up to remove the exception in Drupal 13 (or 14, but at some point).
Comment #14
catchCommitted/pushed to main, thanks!