Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
For simple applications, checking permissions inside each handler function can be a simple, convenient approach. However, it doesn’t scale well. Eventually, you’re going to want to have a more declarative approach. Many systems out there define ACLs, special config files, and a lot of other hocus-pocus. In Yesod, it’s just plain old Haskell. There are three methods involved:
Determine if the current request is a “read” or “write”
operations. By default, Yesod follows RESTful principles, and assumes GET, HEAD, OPTIONS, and TRACE
requests are read-only, while all others are can write.
Takes a route (i.e., type-safe URL) and a boolean indicating whether or not the
request is a write request. It returns an AuthResult, which can have one of
three values: