Log message #4263042

# At Username Text
# May 13th 2021, 10:49 ovidiu.marinoiu yes
# May 13th 2021, 10:48 kevin.pfeifer so like you want to edit records which are displayed in the index template without the need to go into the seperate edit template
# May 13th 2021, 10:47 ovidiu.marinoiu for example: I have a table with users. if I click on the email cell, an editable textfield will show. after changing the field, an ajax request will update the db. I did something on my own but don't really like it.
# May 13th 2021, 10:43 kevin.pfeifer @ovidiu.marinoiu what do you then mean by inline editor?
# May 13th 2021, 10:40 ovidiu.marinoiu @admad now really what I was looking for, but thanks!
# May 13th 2021, 10:28 paolo.bragagni Super. Thanks!!
# May 13th 2021, 10:27 slackebot function is being generated. The template for the controller function is loaded from `plugins/yourTemplatePlugin/templates/bake/element/Controller/login.twig` The template for the view is loaded from `plugins/yourTemplatePlugin/templates/bake/Template/login.twig`
# May 13th 2021, 10:27 slackebot (EventInterface $event) { $view = $event->getSubject(); if ($view->get('name') === 'Users') { // add the login and logout actions to the Users controller $view->set('actions', [ 'login', 'index', 'view', 'add', 'edit', 'delete' ]); } } );``` In this example an additional `login`
# May 13th 2021, 10:27 kevin.pfeifer @paolo.bragagni as stated in the last code block in the https://book.cakephp.org/bake/2/en/development.html#bake-events section you need to add your custom functions in an event listener. ```<?php use Cake\Event\EventInterface; use Cake\Event\EventManager; use Cake\Utility\Hash; // in src/Application::bootstrapCli() EventManager::instance()->on( 'Bake.beforeRender.Controller.controller', function
# May 13th 2021, 09:33 admad OvidiuM: https://github.com/CakeDC/TinyMCE
# May 13th 2021, 08:20 OvidiuM Hi! Do you guys have some knowledge about guidelines/tutorials/plugins for integrating an inline editor with cakephp?
# May 13th 2021, 07:14 paolo.bragagni it bakes 'standers' views (index edit etc..) but I'd like to insertt my own actions. where I have to write my own actions?
# May 13th 2021, 07:13 paolo.bragagni hi. found a way to make a bake theme with a plugin etc.. I dont understand how to bake my own actions and views
# May 12th 2021, 22:57 rightscoreanalysis $request->input(); :)
# May 12th 2021, 22:09 rightscoreanalysis it was required
# May 12th 2021, 22:08 rightscoreanalysis is there an equivalent $request->getContent() in cake2?
# May 12th 2021, 21:57 greg138 Didn't ever use Cake2, but I think if you don't include the plugin, then it won't find *your* model class, it will use it's default scaffolding one, which will default the name of the database table.
# May 12th 2021, 21:37 joacir.santos @ndm I had think about this way too. tks!
# May 12th 2021, 21:30 slackebot $response; }```
# May 12th 2021, 21:30 slackebot `\Authorization\Middleware\UnauthorizedHandler\RedirectHandler::handle()`, and set a flash message on the request object (works as of CakePHP 4.2), something like: ```public function handle(Exception $exception, ServerRequestInterface $request, array $options = []): ResponseInterface { $response = parent::handle($exception, $request, $options); $request->getFlash()->error('You are not authorized to access that location'); return
# May 12th 2021, 21:30 ndm @joacir.santos There is no overly straightforward way yet I think. What you can for example do, is create a custom/extended unauthorized handler (https://book.cakephp.org/authorization/2/en/middleware.html#handling-unauthorized-requests) that handles the `\Authorization\Exception\ForbiddenException`. For example extend the plugin's redirect handler, overwrite
# May 12th 2021, 20:56 joacir.santos Greetings! I am using Cake4 whith AuhorizationComponent. How may I show a flash message to unauthorized user when try to access an action? There is any setup for this or I need to check identity permission before each controller action?
# May 12th 2021, 20:30 virtudavi99 So I could see Slack channels here in the Discord?
# May 12th 2021, 20:20 rightscoreanalysis but cake is complaining that the table is missing
# May 12th 2021, 20:20 rightscoreanalysis because in the top of the model file I have: public $useTable = false;
# May 12th 2021, 20:17 rightscoreanalysis legacy cakephp2, if I have a model file in the plugin and I need to load it, do I need to prefix the name of model with the plugin name?
# May 12th 2021, 19:33 thomas078 missing tables on test
# May 12th 2021, 19:32 thomas078 sure. Solved. It was nothing about Authorization. It was clearly stated on cli-error.log
# May 12th 2021, 19:19 thomas078 think i found it. Problem was when loading associated models within tests..
# May 12th 2021, 18:57 slackebot object(Authentication\Authenticator\Result) { [protected] _status => 'SUCCESS' [protected] _data => object(App\Model\Entity\User) {```
# May 12th 2021, 18:57 slackebot '_successfulIdentifier' => null, '_defaultConfig' => [], '_loaded' => [ (int) 0 => 'Password' ], '_config' => [], '_configInitialized' => true } [protected] _config => [ 'fields' => [ 'username' => 'username' ], 'sessionKey' => 'Auth', 'identify' => false, 'identityAttribute' => 'identity' ] [protected] _configInitialized => true } [protected] _result =>
# May 12th 2021, 18:57 slackebot '_configInitialized' => true } [protected] _successfulAuthenticator => object(Authentication\Authenticator\SessionAuthenticator) { [protected] _defaultConfig => [ 'fields' => [ 'username' => 'username' ], 'sessionKey' => 'Auth', 'identify' => false, 'identityAttribute' => 'identity' ] [protected] _identifier => object(Authentication\Identifier\IdentifierCollection) { '_errors' => [],
# May 12th 2021, 18:57 slackebot '_config' => [], '_configInitialized' => true }, '_defaultConfig' => [], '_loaded' => [ (int) 0 => 'Session', (int) 1 => 'Form' ], '_config' => [], '_configInitialized' => true } [protected] _identifiers => object(Authentication\Identifier\IdentifierCollection) { '_errors' => [], '_successfulIdentifier' => null, '_defaultConfig' => [], '_loaded' => [ (int) 0 => 'Password' ], '_config' => [],
# May 12th 2021, 18:57 thomas078 ```it is wierd as it looks like that Session is loaded correctly. object(Authentication\AuthenticationService) { [protected] _authenticators => object(Authentication\Authenticator\AuthenticatorCollection) { '_identifiers' => object(Authentication\Identifier\IdentifierCollection) { '_errors' => [], '_successfulIdentifier' => null, '_defaultConfig' => [], '_loaded' => [ (int) 0 => 'Password' ],
# May 12th 2021, 18:51 ndm You need to do some debugging as to what the request, session, etc looks like in your app when the test request runs
# May 12th 2021, 18:51 thomas078 ok. That must be the issue
# May 12th 2021, 18:50 ndm If everything works as intended, then the session authenticator will look up and return the value that you've configured for the session, and the authentication middleware will then use it to populate the request object with the identity attribute accordingly.
# May 12th 2021, 18:47 thomas078 i think that the problem is that im trying to read $this->request->getAttribute('identity')->getIdentifier() in controller and on the test i write $this->session(['Auth' => $user]);
# May 12th 2021, 18:45 thomas078 Because login works when i do it normally via browser.
# May 12th 2021, 18:45 thomas078 I think it has something to do with that sesstion now.
# May 12th 2021, 18:44 ndm eg you should receive the same error in a regular, real request