Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291122

Allow access methods on controllers to be used in routes

$
0
0

Currently, in (and in the conversion issues) new access checkers are being added for the purpose of one route, this seems OTT as it is registered an iterated over for EVERY ROUTE when the route info is getting rebuilt. An off the cuff example would be something like #1987762: Convert node_add_page() to a new style controller, we are adding a NodeAddAccessController, which is only really going to be used on this route. Also, the DX is strange in the route definition, if you create a new access checker E.g. '_node_add_access' what do you put for the value? 'TRUE' ? as it means nothing in this case.

This is not taking into account the crazy world of contrib either. I guess you could have 100 registered access checkers without breaking a sweat if this carries on :)

I propose to add a ControllerAccessCheckInterface that Controllers can implement, this will then call a static access() method.

Here is an initial patch.

EDIT: Names are up for discussion for sure, still needs some work, also the test controller is probably in the wrong place...

AttachmentSizeStatusTest resultOperations
d8.controller-access.patch5.51 KBIdlePASSED: [[SimpleTest]]: [MySQL] 56,438 pass(es).View details | Re-test

Viewing all articles
Browse latest Browse all 291122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>