Owned
The declaration, made beside a model, that a row belongs to the user who created it and that some of its routes are that user's alone.
A Guarded and not a sibling of one, because owned implies guarded and never the reverse: the routes covered here are routes whose handler asks who is signed in, and a route that refuses nobody has nobody to compare a row's owner with. Being a subtype is also what keeps the route table's guard lookup and its mounting exactly as they were, and what lets a model declare given Owned[Post, User] and nothing else.
Data, like Guarded, and for the same reason: modules/auth ships one way of producing one and any other way has to produce one of these and nothing more.
covers is a second set beside the inherited actions, and the two are genuinely different questions. actions is which routes need a signed in user; covers is which of them read and write through that user's rows alone. A blog guards all seven and scopes five of them, so that everybody reads everybody's posts and nobody edits another's; a cart guards and scopes the same seven, so that a cart is invisible to anyone but its owner. Folding them into one set would make the blog's index private and the cart's enumerable, depending on which reading won.
Type parameters
- U
-
the application's own user model, which appears only as the type of a key. Nothing here reads a user, and that is what keeps
httpfree of a guard.
Attributes
- Source
- Owned.scala
- Graph
-
- Supertypes