# |
Aug 15th 2019, 13:44 |
neon1024 |
No code examples, links or forward user journey ,:( |
# |
Aug 15th 2019, 13:44 |
neon1024 |
Top docs here! https://book.cakephp.org/3.0/en/controllers/components/csrf.html#csrf-protection-and-ajax-requests |
# |
Aug 15th 2019, 13:38 |
maymeow |
in pm because its long :) |
# |
Aug 15th 2019, 13:34 |
ricksaccous |
can you show me the dump of post before it's saved? |
# |
Aug 15th 2019, 13:34 |
slackebot |
$this->Flash->error(__('The user could not be saved. Please, try again.')); } $roles = $this->Users->Roles->find('list', ['limit' => 200]); $this->set(compact('user', 'roles')); } ``` this function is saving model with association. In request data are field for user and address information for it... :slightly_smiling_face: So its standard and there is no problem but for update?.... |
# |
Aug 15th 2019, 13:34 |
maymeow |
``` public function add() { $user = $this->Users->newEntity(); if ($this->request->is('post')) { $user = $this->Users->patchEntity($user, $this->request->getData()); if ($this->Users->save($user)) { $this->Flash->success(__('The user has been saved.')); return $this->redirect(['controller' => 'addresses', 'action' => 'index']); } |
# |
Aug 15th 2019, 13:29 |
ricksaccous |
interesting |
# |
Aug 15th 2019, 13:26 |
maymeow |
@ricksaccous i tried in dd() and field in_folder is dirty |
# |
Aug 15th 2019, 13:21 |
ricksaccous |
you should prob make sure that post_metadata is marked as dirty @maymeow |
# |
Aug 15th 2019, 13:20 |
greenmanspirit |
Hello, I am trying to find a way to use the table policy in the Authorization plugin to limit all finds, not just a scope on a particular action, is that possible? |
# |
Aug 15th 2019, 13:20 |
ricksaccous |
also |
# |
Aug 15th 2019, 13:19 |
ricksaccous |
also make sure you are setting the appropriate property values corresponding to the other models in the entity |
# |
Aug 15th 2019, 13:19 |
ricksaccous |
save($post, ['associated' => 'PostMetaDatas.InFolders']}) or whatever your models are called |
# |
Aug 15th 2019, 13:18 |
ricksaccous |
actually that's prob what you need to do |
# |
Aug 15th 2019, 13:18 |
ricksaccous |
you either need to specify associations in the save |
# |
Aug 15th 2019, 13:15 |
maymeow |
Ho i can update model with associated data? (when i creating new one its working with save) but when i updating its only save changes to main model not to associated data ``` $post = $this->Posts->find()->contain(['PostMetadata'])->where(['Posts.id' => $id])->first(); $post->done = true; $post->post_metadata->in_folder = PostsActionsFactory::FOLDER_DONE; ``` |
# |
Aug 15th 2019, 13:11 |
spriz |
@mrfeedback I guess you can still use https://github.com/cakephp/acl :P ? |
# |
Aug 15th 2019, 12:46 |
mrfeedback |
are there some best practices on how to make user permission management? I am using authorization and authentication plugin which do exactly what expected. But now I am thinkg about how to manage roles and users. Are there some common ways to do it like in the past with ACL ? |
# |
Aug 15th 2019, 12:33 |
slackebot |
[protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } |
# |
Aug 15th 2019, 12:33 |
slackebot |
=> true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) |
# |
Aug 15th 2019, 12:33 |
slackebot |
(int) 10 => array([maximum depth reached]) ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( (int) 10 => array() ) ) [protected] _isGlobal |
# |
Aug 15th 2019, 12:33 |
slackebot |
object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) {} [protected] _listeners => array( [maximum depth reached] ) [protected] _isGlobal => true } [protected] _listeners => array( 'Auth.afterIdentify' => array( |
# |
Aug 15th 2019, 12:33 |
val |
object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => object(CakeEventManager) { [protected] _generalManager => |
# |
Aug 15th 2019, 12:32 |
val |
I noticed something weird. `Debugger::log(CakeEventManager::instance(), 'debug', 20);` just below `CakeEventManager::instance()->detach($this);` outputs this: |
# |
Aug 15th 2019, 12:24 |
val |
And in the controller: `$this->GlobalAuth = $this->loadComponent('GlobalAuth');` |
# |
Aug 15th 2019, 12:23 |
slackebot |
$this->Auth->user()); } /** * afterIdentify * * @param Event $event Event. * @return void */ public function afterIdentify(CakeEvent $event) { Configure::write('GlobalAuth', $event->data['user']); } /** * implementedEvents * * @return array */ public function implementedEvents() { return [ 'Auth.afterIdentify' => 'afterIdentify', ]; } } |
# |
Aug 15th 2019, 12:23 |
slackebot |
__construct(ComponentCollection $collection, $settings = array()) { parent::__construct($collection, $settings); CakeEventManager::instance()->attach($this); } public function shutdown(Controller $controller) { // This prevents the memory leak. //CakeEventManager::instance()->detach($this); } /** * {@inheritDoc} * @see Component::initialize() */ public function initialize(Controller $controller) { Configure::write('GlobalAuth', |
# |
Aug 15th 2019, 12:23 |
val |
<?php App::uses('Component', 'Controller'); /** * GlobalAuth component * * @property AuthComponent $Auth */ class GlobalAuthComponent extends Component implements CakeEventListener { public $components = ['Auth']; /** * Constructor. * * @param ComponentCollection $collection A ComponentCollection this component can use to lazy load its components. * @param array $settings Array of configuration settings. */ public function |
# |
Aug 15th 2019, 12:22 |
val |
``` |
# |
Aug 15th 2019, 11:31 |
val |
@neothermic probably |
# |
Aug 15th 2019, 11:23 |
neothermic |
@val in an ironic question, can you make a testcase that shows the leak? |
# |
Aug 15th 2019, 11:21 |
val |
Hi, it looks like `CakeEventManager::instance()->attach($this);` in 2.x leads to the memory leak in unit tests. Is it a known problem? |
# |
Aug 15th 2019, 11:21 |
alexdd55976 |
my old company was sold...so i switched jobs ... other way i had 250 loc to maintain |
# |
Aug 15th 2019, 11:21 |
neothermic |
I somewhat wish when we did our big 1.3 -> 2.x migration, we'd just bitten the bullet and gone to 3.x as well |
# |
Aug 15th 2019, 11:20 |
spriz |
We're a simple SaaS with 330k LOC - looking forward to that 4.x migration already :) |
# |
Aug 15th 2019, 11:20 |
spriz |
Oh yikes! :) |
# |
Aug 15th 2019, 11:18 |
neothermic |
so we have a percentage of that on our platform right now |
# |
Aug 15th 2019, 11:18 |
neothermic |
```the number of applicants looking for a place through clearing on Thursday morning rose slightly to 126,170.``` |
# |
Aug 15th 2019, 11:16 |
neothermic |
it's the big results day today, so our platform is under moderate load :) |
# |
Aug 15th 2019, 11:16 |
alexdd55976 |
now software engineer again.. hoping to establish cake as the new framework for next-gen internal dev |
# |
Aug 15th 2019, 11:16 |
spriz |
Ah I see |