Log message #4202418

# At Username Text
# Sep 9th 2019, 15:44 neon1024 Stupid AuditStash plugin
# Sep 9th 2019, 15:38 admad dirty but simple and effective :slightly_smiling_face:
# Sep 9th 2019, 15:37 neon1024 Do I just write to the components config every time?
# Sep 9th 2019, 15:37 neon1024 What is a neat approach to managing dynamic redirect urls with the AuthComponent?
# Sep 9th 2019, 14:49 info315 @admad ok thanks
# Sep 9th 2019, 14:49 admad @info315 removing that statement is the right thing to do since the request has already been handled by the handler when you called `parent::process()`
# Sep 9th 2019, 14:43 info315 Hi, I try to port my AppAuthenticationMiddleware from cake 3.8 to the current 4.x but I stuck at this error: `substr() expects parameter 1 to be string, null given Error in: ROOT/vendor/cakephp/cakephp/src/Http/ControllerFactory.php, line 83 ` If i remove `$response = $handler->handle($request);` from my middelware the issue is gone, but i think that's not the solution
# Sep 9th 2019, 14:03 ndm You'd still have to reassign the connection after that though, or reset / remove the respective tables from the table registry. There's 1000 and 1 ways to abstract that away somewhere, the event stuff in the answer was just an example.
# Sep 9th 2019, 13:55 challgren https://api.cakephp.org/3.3/class-Cake.Datasource.ConnectionManager.html#_dropAlias
# Sep 9th 2019, 13:55 itmpls How can I revert it back to default once I alias it?
# Sep 9th 2019, 13:52 challgren @itmpls maybe https://api.cakephp.org/3.3/class-Cake.Datasource.ConnectionManager.html#_alias
# Sep 9th 2019, 13:51 itmpls Manually I can solve it with `$table->Users->setConnection()`. is there a cleaner way if I . had to do . this for 5-6 . tables?
# Sep 9th 2019, 13:51 ndm Changing the connection for `$table` won't change the connection for containments, you'd have to change the connection for those tables too.
# Sep 9th 2019, 13:50 itmpls My service requests table ($table) hasMany Users and on containment cake tries to cache/grab all the columns on the default connection, not on the connection $table is set to
# Sep 9th 2019, 13:49 itmpls I have 2 database connections and I am pulling data from both. Doing a `foreach ($connections as $connection) { $table->setConnection($connection); $table->find()->contain('Bar'); });` but when I contain `Bar` Cake does a `SHOW FULL COLUMNS FROM Bar` on the *default* connection and an error is thrown because it doesn't check that table on the dynamic connection I set
# Sep 9th 2019, 13:47 ndm I don't really know what exactly you mean by that? Reverting what exactly? And what is "all the other stuff"?
# Sep 9th 2019, 13:44 itmpls just came across this which may solve my problem
# Sep 9th 2019, 13:44 itmpls @ndm - in your answer here, https://stackoverflow.com/a/48372895/145190 is there a way to revert connection to default after all the other stuff?
# Sep 9th 2019, 13:39 y_lin @ndm Thanks a lot. I will try it!
# Sep 9th 2019, 13:36 ndm @y_lin That's the security component, it has nothing to with CSRF, it handles stuff like form tampering protection. If you don't need that kind of protection for your AJAX requests, the most simple solution is to disable it for those specific actions. Otherwise you'd also have to generate and add a security token to your AJAX requests. See for example how `\Cake\View\Helper\FormHelper::secure()` is doing that.
# Sep 9th 2019, 13:34 itmpls I think this is . the same problem I'm having
# Sep 9th 2019, 13:34 itmpls https://stackoverflow.com/questions/5313748/how-can-i-eliminate-cakephps-show-full-columns-queries
# Sep 9th 2019, 13:28 y_lin this is the error message i got
# Sep 9th 2019, 13:27 y_lin @ndm Thank you for giving suggestions. I think that i didn't explain the problem i meet clearly.
# Sep 9th 2019, 13:26 challgren @m4ximum take a look at https://github.com/CakeDC/auth/tree/master/src/Rbac
# Sep 9th 2019, 13:24 itmpls and that obviously doesn't work because i'm setting it dynamically
# Sep 9th 2019, 13:24 itmpls the problem is, when it does that `SHOW FULL COLUMNS FOR table` it does it on the default connection
# Sep 9th 2019, 13:22 itmpls Does anyone know why my query in which I set the connection of a table dynamically using setConnection, when I specify a table in `contains()`, cake does a `SHOW FULL COLUMNS FOR table`? Do I need to override and reset the global connection? debug is true I believe
# Sep 9th 2019, 13:19 aivaras.godliauskas thanks.
# Sep 9th 2019, 13:13 m4ximum Thank you for the answer @ndm. Right now with my cakephp 2 application I can grant permissions for every single controller action and group them as roles. Is this possible with this authorization plugin ?
# Sep 9th 2019, 13:03 ndm @m4ximum You should look into https://github.com/cakephp/authorization, it's flexible enough so that you can create ACL in pretty much any way you like.
# Sep 9th 2019, 12:53 m4ximum Hi all, is there any possibility to deal with ACLs in cakephp 4 ? Or is there some equivalent that I’ve not figured out yet ?
# Sep 9th 2019, 12:46 ndm @y_lin Start with inspecting the stacktrace to figure from where exactly the error is thrown. It also helps if you post the _exact_ error message, there are various possible errors related to tokens.
# Sep 9th 2019, 12:43 y_lin Hi, I want to delete or add entity by ajax with csrf. Does anyone knows how to deal with it. I have already added 'X-CSRF-Token' in the header of the request.
# Sep 9th 2019, 12:43 ndm @arai.mio.i As of 3.8 you can for example add custom locations via `\Cake\ORM\Locator\TableLocator::addLocation()`, like `$this->getTableLocator()->addLocation('Model/Table/User')` or `\Cake\ORM\TableRegistry::getTableLocator()->addLocation('Model/Table/User')` from wherever `\Cake\ORM\Locator\LocatorAwareTrait` cannot be used.
# Sep 9th 2019, 12:11 arai.mio.i Hi. I want to make directories under Table. The table classes under the directories can be load as below but are there any way to omit the namespace in the same way as default? ``` $this->loadModel('App\Model\Table\User\UsersTable') ```
# Sep 9th 2019, 12:01 lorenzo @aivaras.godliauskas check the `modifier()` method in the query api
# Sep 9th 2019, 11:15 neon1024 Afternoon everyone :wave:
# Sep 9th 2019, 11:13 aivaras.godliauskas Hi, is it possible to use SQL_CACHE in cakephp ORM query?
# Sep 9th 2019, 11:11 dereuromark Jep. If sth is not clear in docs or code, please pr suggested Improvements.
# Sep 9th 2019, 10:55 COOurb and after creating app_queue.php I have to add 'workermaxruntime' option.