Problem/Motivation
BlockPluginInterface::access() now returns an AccessResult object.
While this object is really nice and helpful for caching of access checking, it makes code potentially more fragile, when you check
access and forget that you don't get back a boolean value.
Proposed resolution
By default return a boolean value again, but make it possible for request for a result object, much like a lot of other apis.
Remaining tasks
User interface changes
API changes
interface BlockPluginInterface {
- public function access(AccountInterface $account) {
+ public function access(AccountInterface $account, $return_as_object = FALSE) {
}
Beta phase evaluation
Comments
Comment #1
dawehner.
Comment #2
berdirDo we need to update existing calls to that method?
Comment #4
dawehnerHa, now we do have one sechole!
Comment #5
berdirSome commented out tests in there :)
Nice, so core had the same bug as page_manager? Why are there no tests failing on this?
Comment #6
catchComment #7
wim leersWow. Very poor test coverage for block access, then :(
Comment #9
tstoecklerThis should be the default, no? I.e. specifying
NULLandFALSEexplicitly, should not be necessary?!Comment #10
dawehnerRight this is the default, though I prefer to make this implicit, to improve readability. Maybe we should even use TRUE and call
isAllowed()?Comment #11
dawehnerLet's write a proper test.
Comment #13
dawehnerAs often said, better don't trust me.
Just to be clear, so the code is secure, but we just page_manager has a sechole here. I still would love to have dedicated testcoverage here.
Fixed the unittest.
Comment #14
berdirIs this the same elsewhere? It's not too useful either way but we afaik stopped putting the default in the description? Maybe something like "Controls if the return value is an AccessResult object or a bollean" ?
Unnecessary empty line.
Why bother implementing this?
I like how the FAIL test in #11 is green and PASS failed :) Can you provide an updated test-only patch? Then this is good to go I think.Uh, me much stupid. There's obviously no failing test because there is no bug :)
Comment #15
berdirSetting to needs work for the minor stuff.
Comment #16
berdirTagging novice to fix the minor things from my review.
Comment #17
hussainwebDoing a reroll first.
Comment #21
hussainwebLet's see if this works.
Comment #22
dawehnerAdding a IS and BA
Comment #23
berdirSkimmed through it, looks good to me. Page manager is AFAIK still broken, so would be nice to have this fixed.
Maybe Wim can review/RTBC this? :)
Comment #24
wim leersLooks good to me too.
Two blank lines; should be one. Can be fixed on commit.
Comment #26
wim leersRebased.
Comment #27
alexpottCommitted b8f63ed and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.