Log message #4263992

# At Username Text
# May 26th 2021, 09:48 dereuromark What's the problem? There are tons of open source ones out there if u google :)
# May 26th 2021, 09:33 tomrwaller I did :)
# May 26th 2021, 09:02 dereuromark Did u check the awesome list? ;)
# May 26th 2021, 08:49 tomrwaller Bonus points if it's Bootstrap 5 :) But at this point I'd take anything!
# May 26th 2021, 08:48 tomrwaller Hey everyone - I don't suppose anyone has a Bootstrap-enabled FormHelper template they wouldn't mind sharing with me at all? I've been using one over the years that I cobbled together through bits and pieces online but I'm noticing it doesn't provide me any scope to add input help-block text on my forms and I can't for the life of me figure it out.
# May 25th 2021, 23:23 ljolley Yea this gets the job done and how I've done it in the past.
# May 25th 2021, 23:21 ndm Depends on what exactly you mean by "_better_", that's very likely coupled to your specific application logic.
# May 25th 2021, 23:17 ljolley (I appreciate the help btw - I've been banging my head against this for too long today)
# May 25th 2021, 23:17 ljolley can you see a better way of handling this? Basically I have a set of logic that I need to run on every action with simple comparison checks - and if they fail, I redirect to where the user should be.
# May 25th 2021, 23:15 ndm Basically, yes.
# May 25th 2021, 23:15 ljolley got it. I modified my controller `beforeFilter` to have this: `return parent::beforeFilter($event);` and it appears to be doing what I need it to do. Is that what you meant by "overwritten method makes no use of it"?
# May 25th 2021, 23:12 ndm Alternatively, if applicable, you could also set the return value of `$this->redirect()` as the event result.
# May 25th 2021, 23:11 ndm Your return value from the parent method will vanish into the void, as your overwritten method makes no use of it. You need to check if `parent::beforeFilter()` returns something, and then return that in your overwritten method.
# May 25th 2021, 23:10 ljolley so controller action errors, and redirect doesn't happen.
# May 25th 2021, 23:09 ljolley but the controller action is looking for `$session->read('Admin.organization_id')`
# May 25th 2021, 23:09 ljolley again. redirect happens if I clear out the controller action
# May 25th 2021, 23:08 ljolley is that correct?
# May 25th 2021, 23:08 ljolley the code above is sitting in the `beforeFilter` in the `AppController`. It's literally the only thing in there ATM. In the controller, I have this: ```public function beforeFilter(EventInterface $event) { parent::beforeFilter($event); }```
# May 25th 2021, 23:06 ndm Either your `beforeFilter()` is not being invoked (maybe you've overwritten it incorrectly), or the conditions are not being fulfilled, ie the redirect is not being invoked.
# May 25th 2021, 22:54 ljolley Looks like if I put the same check in the controller action, it works. but it's much more efficient and easier to maintain if I can have it just run in the `beforeFilter`
# May 25th 2021, 22:45 ljolley regardless, I don't need the controller action to run.
# May 25th 2021, 22:43 ljolley not sure why. on actions that would fall under the same criteria, the redirect works - but there's no showstoppers in the controller action
# May 25th 2021, 22:43 ljolley this runs in the beforeFilter but it executes the controller action before the redirect happens
# May 25th 2021, 22:41 ljolley right.
# May 25th 2021, 22:38 greg138 `beforeFilter` does run before your controller's action starts.
# May 25th 2021, 22:34 ljolley looks like the `return` isn't returning?
# May 25th 2021, 22:32 ljolley working through this some more, it looks like the redirect is triggered, but the page errors out in the controller because it's expecting `$session->read('Admin.organization_id');` Is there a way to force the redirect in the `beforeFilter` before it hits controller logic?
# May 25th 2021, 22:25 ljolley top redirect under `//REDIRECT TO ORGANIZATION DASHBOARD` works fine.
# May 25th 2021, 22:25 slackebot == false) { //REDIRECT TO MAIN DASHBOARD $this->Flash->admin_info(__('Not an out action.')); return $this->redirect(['controller'=>'Dashboard','action'=>'main','prefix'=>'Admin']); } }```
# May 25th 2021, 22:25 slackebot $this->Flash->admin_info(__('Not an in action.')); return $this->redirect(['controller'=>'Dashboard','action'=>'organization','prefix'=>'Admin']); } } else if(!$session->check('Admin.organization_id')) { //IF UNLOADED $access = $this->Access->actionCheck($this->request->getParam('controller'),$this->request->getParam('action'),'out'); if($access
# May 25th 2021, 22:25 ljolley ``` //CHECK THAT A CONTROLLER AND ACTION IS ACCESSIBLE DEPENDING ON IF THE USER IS LOADED INTO AN ORGANIZATION if($session->check('Admin.organization_id')) { //IF LOADED $access = $this->Access->actionCheck($this->request->getParam('controller'),$this->request->getParam('action'),'in'); if($access == false) { //REDIRECT TO ORGANIZATION DASHBOARD
# May 25th 2021, 22:24 ljolley I have a check happening in the `AppController` `beforeFilter` and for whatever reason, the redirect doesn't trigger.
# May 25th 2021, 22:23 ljolley is there anything that would cause a redirect `$this->redirect()` to not work?
# May 25th 2021, 22:10 jojomartius sounds good @ndm thanks!
# May 25th 2021, 22:09 ndm @jojomartius That's controlled by the route class. Check your routes config for `setRouteClass()` or `routeClass()` calls, they might be missing, leaving you with the default route class that maps the path as-is. https://github.com/cakephp/app/blob/4.2.2/config/routes.php#L27-L45
# May 25th 2021, 21:46 jojomartius Does anybody has an idea what happend and how i can get the lower case routing also working?
# May 25th 2021, 21:44 jojomartius Hey there, i've a really stupid question. I created a plugin in an existing project with ```bin/cake bake plugin alert``` and a controller with ```bin/cake bake controller companies --plugin alert``` but if I try to access it via the browser on /alert/companies i got nothing, only on /alert/Companies (with a capital C) wir works...
# May 25th 2021, 20:40 etibor is there a way to display the not permitted character in error message?
# May 25th 2021, 20:40 etibor okey i actually found, by var_dump the getErrors()
# May 25th 2021, 20:02 rightscoreanalysis is it hacky to be reading session data in a model?
# May 25th 2021, 19:41 etibor how the error message will return ?