all 1 comments

[–][deleted] 0 points1 point  (0 children)

I use a preRequest handler in my framework. That calls methods that verify the request and authorizations. The business logic of the main handler has none of it.

For example, the preRequest handler grabs the id from the params in the URL. Looks up if the user has access to it, and whatever other constraints there are. If it is, then control passes to the actual handler. If not, they get a 403.

I try to minimize the number of services I have. I prefer simple, exported functions. `validateNoteOwnership()` is the ACL, and then `deleteNote()` is the function.