# |
Jul 9th 2019, 14:02 |
neon1024 |
As you might have the Cake 2 equivalent of `$this->getRequest()->allow(['post', 'put'])` or similar |
# |
Jul 9th 2019, 14:02 |
neon1024 |
Then probably just need to update the controller methods if the verbs are not set in the routing |
# |
Jul 9th 2019, 14:02 |
jeremy.payne |
A blanket permission would be a terrible idea |
# |
Jul 9th 2019, 14:01 |
jeremy.payne |
We plan (or already have the code set up) for allow-origin headers :slightly_smiling_face: |
# |
Jul 9th 2019, 14:01 |
neon1024 |
Unless you’re also implementing the Allow-Origin headers |
# |
Jul 9th 2019, 14:00 |
neon1024 |
As you have to allow it, I could send 100,000 OPTIONS requests to your enedpoint |
# |
Jul 9th 2019, 14:00 |
neon1024 |
As opening your endpoint up to OPTIONS requests will allow for hammering and ddos |
# |
Jul 9th 2019, 13:59 |
neon1024 |
We sidestepped the whole issue by proxying the call in a controller using php |
# |
Jul 9th 2019, 13:59 |
neon1024 |
I’d first think about why you need to do cross origin ajax requests |
# |
Jul 9th 2019, 13:58 |
jeremy.payne |
Hi all, I have to work on an old (Cakephp2) project and allow preflight `OPTIONS` requests on the api. As it stands those get a "405 method not allowed" back, and googeling isn't helping. What are some simple steps I can follow to pinpoint the problem? The `routes.php` file has several hundred `Router::connect()` rules but nothing regarding post/get/put. |
# |
Jul 9th 2019, 13:49 |
half2me |
would be nice if we could reproduce this somehow in a separate piece of code |
# |
Jul 9th 2019, 13:49 |
half2me |
Nope, but it seems a few people are having this strange issue. Right now I just left the atomicity set to false, because I didn’t have time to debug properly |
# |
Jul 9th 2019, 13:30 |
devito |
collin |
# |
Jul 9th 2019, 12:16 |
dereuromark |
I once blogged about it: https://www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/#setup |
# |
Jul 9th 2019, 12:12 |
madbbb |
I didn't read MMPT article and thought that these fields are keys to left and right parent :,) |
# |
Jul 9th 2019, 12:09 |
dereuromark |
yes |
# |
Jul 9th 2019, 12:09 |
madbbb |
and left lft and right as int? |
# |
Jul 9th 2019, 12:05 |
dereuromark |
i am sure it does, if the parent id also is using the right type |
# |
Jul 9th 2019, 12:04 |
madbbb |
Hello. Is it possible to use TreeBehaviour with UUID primary key? |
# |
Jul 9th 2019, 11:24 |
neon1024 |
I’d also double check the class namespaces too, just in case |
# |
Jul 9th 2019, 11:23 |
neon1024 |
I would have used `collection_parts`, `CollectionPartsController` and `CollectionPartsTable` |
# |
Jul 9th 2019, 11:23 |
neon1024 |
As it’s not a word, it will not be inflected correctly, would be my guess |
# |
Jul 9th 2019, 11:22 |
mrfeedback |
any ideas? |
# |
Jul 9th 2019, 11:22 |
mrfeedback |
does somebody had the case that a model within a baked controller isn´t loaded by default? in mycase I got a model named "Collectionparts" and according to that also a controller `CollectionpartsController` within thiscontroller i always need to use `$this->loadModel('Collectionparts');` in order to access the model |
# |
Jul 9th 2019, 11:18 |
conehead |
Well, guess I can get a List of all Tables with: ` $tables = ConnectionManager::get('default')->schemaCollection()->listTables();` From here on I should be able to get the correct Table |
# |
Jul 9th 2019, 11:10 |
conehead |
Hm is there a way to check which plugins have been loaded within a controller? I got a singularized class name, but not its namespace. I now need to find the correct table to this model without using inflector. I would have tried to check which plugins are loaded and check in each `Model` folder if my class exists and if I found the class, I need to get the `Table` for this entity |
# |
Jul 9th 2019, 11:06 |
neon1024 |
Join the eternal quest to find an email validation regex! :crossed_swords: |
# |
Jul 9th 2019, 11:05 |
dereuromark |
the right upgrade regex probably goes for millions on the black market :P |
# |
Jul 9th 2019, 11:05 |
dereuromark |
a collection of regex is worth gold :) |
# |
Jul 9th 2019, 11:04 |
conehead |
Still looks like this was possible within 20 seconds with a string replace |
# |
Jul 9th 2019, 10:51 |
info315 |
https://github.com/it-novum/openITCOCKPIT/commit/f597a69c3bc8c67dc174c943675e7153440d17da I did it manually now and it was a pain in the ass |
# |
Jul 9th 2019, 10:07 |
challgren |
Whoops is great! |
# |
Jul 9th 2019, 10:07 |
dereuromark |
that already exists :slightly_smiling_face: at least for error handling to click and jump to IDE |
# |
Jul 9th 2019, 09:59 |
neon1024 |
A nice PHP Storm plugin would allow me to click a URL in my code, such as an AJAX call, and it would match the routing, open the controller and take me to the method |
# |
Jul 9th 2019, 09:50 |
challgren |
I <3 PHPStorm |
# |
Jul 9th 2019, 09:47 |
challgren |
Crude but it works |
# |
Jul 9th 2019, 09:45 |
challgren |
replace regex `allowEmptyString\($1null, $2\)` |
# |
Jul 9th 2019, 09:45 |
challgren |
find regex `allowEmptyString\((\'[A-z0-9]*\', )((false)|\'(create|update)\')` |
# |
Jul 9th 2019, 09:45 |
challgren |
Here’s a regex to fix it |
# |
Jul 9th 2019, 09:35 |
info315 |
brb |
# |
Jul 9th 2019, 09:35 |
info315 |
no one have a message, most have a `$when` |