Respect / Rest

Thin controller for RESTful applications
http://respect.github.io/Rest
Other
605 stars 102 forks source link

Who implement By ou AuthBasic using ini configs? #100

Closed williamespindola closed 11 years ago

williamespindola commented 11 years ago

Hello there. I'm setting up my routes using ini files, something like this:

[myRoute Respect\Rest\Routes\ClassName]
method = GET
pattern = /some/route
class = My\Class
constructorParams[] = [mapper]

But now I need implement some By or AuthBasic like doc examples. Someone can help to do this? Thanks

augustohp commented 11 years ago

Have you tried using:

[myRoute Respect\Rest\Routes\ClassName]
method = GET
pattern = /some/route
class = My\Class
constructorParams[] = [mapper]
by[] = My\Class\Routine
williamespindola commented 11 years ago

This not works because the by method not exists in ClassName. I think that is necessary implement some this like that. But the by method is a callBack method. I don't know how implement it.

wesleyvicthor commented 11 years ago

try to use appendRoutine[]; you should append a By class instance with a callback defined.

using Respect\Config:

[authentication My\Authentication] mapper = [mapper]

[authenticationRoutine Respect\Rest\Routines\By] callback = [[authentication], check]

[adminRoute Respect\Rest\Routes\ClassName] ; route setup ... appendRoutine[] = [authenticationRoutine]

you can use appendRoutine to execute validation or checks(By, When) on your routes. :)

On Fri, Nov 22, 2013 at 5:22 PM, William Espindola <notifications@github.com

wrote:

This not works because the by method not exists in ClassName. I think that is necessary implement some this like that.

— Reply to this email directly or view it on GitHubhttps://github.com/Respect/Rest/issues/100#issuecomment-29101203 .

williamespindola commented 11 years ago

Hey @wesleyvicthor "Agrega valor ao camarote"! Work perfectly, thanks so much.

nickl- commented 11 years ago

11993_13509_13610x