Log message #4054565

# At Username Text
# Jul 20th 2017, 13:14 hmic "authorize" => "Controller" i think
# Jul 20th 2017, 13:13 hmic you need to specify in the auth config
# Jul 20th 2017, 13:13 Ecorce hmic, that'd be perfect to me, but... Auth don't want to look at my isAuthorized function, he redirects to loginAction first -_-
# Jul 20th 2017, 13:12 awi hm. Does htmlHelper->link support the download tag? https://www.w3schools.com/tags/att_a_download.asp
# Jul 20th 2017, 13:00 hmic 3 lines of code there
# Jul 20th 2017, 13:00 hmic you can put that in the appcontroller too and return true if a user exists.
# Jul 20th 2017, 12:59 hmic you need to implement an isauthorized method
# Jul 20th 2017, 12:59 hmic you cant if you want to use allow, allow does just allow an action to be accessed like before (without auth beeing enabled), nothing else.
# Jul 20th 2017, 12:58 Ecorce nop, I juste need to check if user is connected with Auth, no more
# Jul 20th 2017, 12:58 hmic if you want to decide on a user basis, this is not authentication, but authorization and you would need an isauthorized in the controller (and set controllerauthorization in the auth config), like i said before
# Jul 20th 2017, 12:57 hmic you need to allow before auth has run!
# Jul 20th 2017, 12:57 hmic of course it is
# Jul 20th 2017, 12:49 Ecorce I just want to start the component, I don't want him to forbid at first... I've tried : unauthorizedRedirect => false, but, no better
# Jul 20th 2017, 12:48 Ecorce I've tried to move the allow inside initialize for each Controller, but then again, $this->Auth->user() is empty
# Jul 20th 2017, 12:41 adriencs thanks @dereuromark
# Jul 20th 2017, 12:41 hmic but use controller authorization rather and implement an isauthorized function, or use the controller initialize to Auth->allow()
# Jul 20th 2017, 12:41 dereuromark you can customize either the relation and the attribute, or resolve as you did by using a more unique name for the select alias
# Jul 20th 2017, 12:40 dereuromark job is also the related attribute for Jobs table in your main table here. thats why it probably collides @adriencs
# Jul 20th 2017, 12:40 hmic you actually should not allow from there anyways
# Jul 20th 2017, 12:40 hmic Ecorce, because auth did run before, like you specified!
# Jul 20th 2017, 12:03 Ecorce Hmm, loginAction is called everytime now, no matter $this->Auth->allow() (in BeforeFilter of the Controllers)
# Jul 20th 2017, 11:51 Ecorce https://book.cakephp.org/3.0/en/controllers/components/authentication.html#deciding-when-to-run-authentication
# Jul 20th 2017, 11:50 Ecorce (not authCheckIn) :p
# Jul 20th 2017, 11:50 Ecorce I've found in the docs : $this->Auth->config('checkAuthIn', 'Controller.initialize');
# Jul 20th 2017, 11:48 hmic flxfoo, you can use the same name as it will be in a different namespace
# Jul 20th 2017, 11:47 flxfoo yeah forgot I was on server side, that make sense.
# Jul 20th 2017, 11:47 flxfoo thanks hmic and slackebot
# Jul 20th 2017, 11:46 Ecorce (oops I was answering the wrong person) :)
# Jul 20th 2017, 11:46 pedroseco ah, should the controller name be diferent too? Or can I use the same name?
# Jul 20th 2017, 11:46 pedroseco @neon1024 thanks let me try
# Jul 20th 2017, 11:46 admad Ecorce: read my comments carefully :slightly_smiling_face:
# Jul 20th 2017, 11:46 neon1024 @pedroseco Do you mean the namespace of your controller? It should be `App\Controller`, but you’ll need a use statement for the plugin controller as well
# Jul 20th 2017, 11:45 Ecorce I'm working on a prefix, so the namespace should be correct
# Jul 20th 2017, 11:45 admad you can do the auth process earlier using 'authCheckIn' => 'Controller.initialize' in auth config
# Jul 20th 2017, 11:45 pedroseco @neon1024 and the namespace should be the App\Controller or PluginName\Controller ?
# Jul 20th 2017, 11:44 admad so $this->Auth->user('id') inside beforeFitler() is always gonna return null
# Jul 20th 2017, 11:44 admad by default auth process is done AFTER controller before filter is called
# Jul 20th 2017, 11:43 Ecorce (line 45 : $this->Auth->user('id') empty, whereas login succeeded)
# Jul 20th 2017, 11:42 Ecorce hmic : https://gist.github.com/anonymous/be95621bd0be2447fcb59040dfa8bac3
# Jul 20th 2017, 11:42 neon1024 `class PedrosecoController extends PluginsController {`
# Jul 20th 2017, 11:41 pedroseco should the derivate controller have the namespace of the plugin one?