
On Thu, Mar 17, 2011 at 8:01 PM,
Both Snap and Happstack can match against partial route. And after handling it let it fall deeper to the next handler.
Does yesod routing support such model ?
Sure, just use MultiPieces. For example: mkYesod "MyApp" [$parseRoutes| /*Strings RootR GET |] getRootR [] = ... getRootR ["hello"] = ... getRootR ("something":rest) = go rest But even though you *can* do it, that doesn't mean I recommend it. One of the major features that Yesod gives you versus Snap or Happstack is type-safe URLs. Doing these kinds of matches undercuts that feature drastically. So sure: contrary to popular belief, Yesod can express the full routing flexibility present in Happstack and Snap. But there's a very good reason to use the recommended approaches whenever possible. I think that isAuthorized[1] should provide you with the tool you need to achieve this. I've written sites with very complex permissions code using isAuthorized, and frankly I think it's a much better and simpler approach to many other authorization systems out there. (And yes, I would love to augment the Yesod book with some documentation on it.) [1] http://hackage.haskell.org/packages/archive/yesod-core/0.7.0.1/doc/html/Yeso...
You should be able to avoid a subsite by checking the url in the auhorization callbacks.
Could you please elaborate. I do not even know where to begin to look for such callbacks.
The scaffolded site has an authentication example. But it is implemented as a subsite. And i have a hard time figuring out how to create a subsite without a documentation.
I don't think a subsite is the solution you are looking for here. It *could* solve your problem, but it would not be the most pleasant approach. Subsites should be saved for reusable components whenever possible. Michael