# |
Jul 23rd 2021, 12:08 |
kevin.pfeifer |
I am just in the process of updating the doc since its a bit more “advanced” I would say |
# |
Jul 23rd 2021, 12:06 |
paolo.bragagni |
first of all I dont know how to create my own handler |
# |
Jul 23rd 2021, 12:05 |
paolo.bragagni |
not so easy |
# |
Jul 23rd 2021, 11:46 |
paolo.bragagni |
:) |
# |
Jul 23rd 2021, 11:46 |
paolo.bragagni |
arghhhh |
# |
Jul 23rd 2021, 10:54 |
kevin.pfeifer |
so basically the example uses the RedirectHandler (`Authorization.Redirect` in your array above) which is this class in the plugin https://github.com/cakephp/authorization/blob/master/src/Middleware/UnauthorizedHandler/RedirectHandler.php |
# |
Jul 23rd 2021, 10:53 |
kevin.pfeifer |
what you do in that handle() function is basically up to you |
# |
Jul 23rd 2021, 10:52 |
kevin.pfeifer |
and with that you can also (as the doc describes) create your own Handler https://github.com/cakephp/authorization/blob/15aa0e01746c797ed3ce5ce745a7a3f08ccc0c6e/docs/en/middleware.rst#handling-unauthorized-requests |
# |
Jul 23rd 2021, 10:51 |
kevin.pfeifer |
|
# |
Jul 23rd 2021, 10:50 |
kevin.pfeifer |
The Flash message topic is pretty re-occuring. let me search the slack for how to do that |
# |
Jul 23rd 2021, 10:37 |
paolo.bragagni |
and what about flash message that shows user that it hasnt the authorization? |
# |
Jul 23rd 2021, 10:37 |
paolo.bragagni |
something like 'url' => $this->referer() |
# |
Jul 23rd 2021, 10:36 |
paolo.bragagni |
'unauthorizedHandler' => [ 'className' => 'Authorization.Redirect', 'url' => '/users/login', 'queryParam' => 'redirectUrl', 'exceptions' => [ MissingIdentityException::class, OtherException::class, ], |
# |
Jul 23rd 2021, 10:36 |
paolo.bragagni |
Hi in unauthorizedHandler how to redirect to last page? |
# |
Jul 23rd 2021, 00:14 |
web-54 |
hello |
# |
Jul 22nd 2021, 17:47 |
zxcvxcvzxcv |
=# |
# |
Jul 22nd 2021, 15:00 |
tyler.adam.lazenby |
hahaha |
# |
Jul 22nd 2021, 15:00 |
tyler.adam.lazenby |
Thanks @dereuromark I will have to go back the white board and figure out my logic. again |
# |
Jul 22nd 2021, 13:23 |
paolo.bragagni |
I know I know but I need it. I'll do my own thanks. |
# |
Jul 22nd 2021, 13:02 |
ndm |
That aside, that plugin is so basic, just do your own. |
# |
Jul 22nd 2021, 13:00 |
ndm |
Using embedded SQL queries sounds like a terrible idea, IMHO that's a job for stored procedures and/or views. |
# |
Jul 22nd 2021, 12:53 |
paolo.bragagni |
something similar to this https://github.com/morrislaptop/reports for cake4? |
# |
Jul 22nd 2021, 12:17 |
paolo.bragagni |
ok thank you |
# |
Jul 22nd 2021, 12:10 |
kevin.pfeifer |
there are many ways how you can interact with migrations |
# |
Jul 22nd 2021, 12:10 |
dereuromark |
if you used change(), just use "migrations rollback", done |
# |
Jul 22nd 2021, 12:10 |
kevin.pfeifer |
or use rollback https://book.cakephp.org/migrations/2/en/index.html |
# |
Jul 22nd 2021, 12:08 |
kevin.pfeifer |
manually delete the table with SQL CLI, PHPMyAdmin or whatever DB management tool you desire |
# |
Jul 22nd 2021, 12:07 |
paolo.bragagni |
with someting changed? |
# |
Jul 22nd 2021, 12:04 |
paolo.bragagni |
(if I want to rerun ?) |
# |
Jul 22nd 2021, 12:04 |
paolo.bragagni |
yes you are great |
# |
Jul 22nd 2021, 12:01 |
paolo.bragagni |
ops not save |
# |
Jul 22nd 2021, 12:00 |
paolo.bragagni |
something wrong in my config |
# |
Jul 22nd 2021, 11:59 |
kevin.pfeifer |
this creates the table `checklist_types` with the columns id, name, created and modified with 3 entries |
# |
Jul 22nd 2021, 11:59 |
paolo.bragagni |
should include checklist_types table? |
# |
Jul 22nd 2021, 11:46 |
slackebot2 |
```bin/cake migrations migrate``` |
# |
Jul 22nd 2021, 11:46 |
slackebot2 |
$checklist_types_table->addColumn( 'modified', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP', 'null' => false, ] ); $checklist_types_table->create(); $checklist_types_table->insert( [ 'name' => 'Wordpress' ] ); $checklist_types_table->insert( [ 'name' => 'Drupal' ] ); $checklist_types_table->insert( [ 'name' => 'WooCommerce' ] ); $checklist_types_table->saveData();``` execute |
# |
Jul 22nd 2021, 11:46 |
kevin.pfeifer |
```bin/cake bake migration MySuperMigration``` open confg/Migrations/<DATE>_MySuperMigration.php insert into `change()` function ``` $checklist_types_table = $this->table( 'checklist_types' ); $checklist_types_table->addColumn( 'name', 'string' ); $checklist_types_table->addColumn( 'created', 'datetime', [ 'default' => 'CURRENT_TIMESTAMP', 'null' => false, ] ); |
# |
Jul 22nd 2021, 11:46 |
dereuromark |
you can execute seeds for demo data afterwards |
# |
Jul 22nd 2021, 11:42 |
paolo.bragagni |
trying.. I'd like only to create some tables (users, roles, ..) and fill with default values.. |
# |
Jul 22nd 2021, 11:18 |
dereuromark |
migrations? |
# |
Jul 22nd 2021, 11:02 |
paolo.bragagni |
what is the cakephp 4 corresponding to 'cake schema' ? I'd like to insert some tables in default DB |