You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add thorough documentation about relationship operations (#71)
* Mention design principle in README
* WIP: Add docs for relationship authorization
* Add back-to-top links
* Move doc-top anchor
* Add doc about PATCH on resource with has-one relationship
* Add doc about POST new resource with has-one relationship
* Add placeholders for has-many relationship documentation
* Fix typo
* Add doc about POST new has-many relationships
* Add doc about DELETE some has-many relationships
* Talk about dissociation instead of removing
We're not "removing" the records, as we're instead only severing the
relationship in the has-one or has-many association.
* Add doc about PATCH has-many relationships
* Add doc about removing of has-many relationships
* Add doc about PATCH on resource with has-many relationship
* Trim unnecessary trailing whitespace from relationship-authorization docs
* Add doc about POST new resource with has-many relationship
* Differentiate relationship replacing and removing with PATCH on resource
* Add newline to end of README.md
* Link to relationship authorization docs from README
* Add consistency caveat to relationship auth docs
* Link to relationship auth docs from Policies part of README.md
* Fix code examples author association
* Add back-to-top link to end of relationship docs
* Describe TOC in terms of HTTP operations
* Mirror sub-headings with TOC
* Split has-one and has-many example setup
* Split docs to two parts and bump heading levels accordingly
Copy file name to clipboardExpand all lines: README.md
+15-9Lines changed: 15 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,26 @@ branch. This may contain information that is not relevant to the release you are
14
14
[jr]: https://github.com/cerebris/jsonapi-resources"A resource-focused Rails library for developing JSON API compliant servers."
15
15
[pundit]: https://github.com/elabs/pundit"Minimal authorization through OO design and pure Ruby classes"
16
16
17
+
The core design principle of `JSONAPI::Authorization` is:
18
+
19
+
**Prefer being overly restrictive rather than too permissive by accident.**
20
+
21
+
What follows is that we want to have:
22
+
23
+
1. Whitelist over blacklist -approach for authorization
24
+
2. Fall back on a more strict authorization
25
+
17
26
## Caveats
18
27
19
28
Make sure to test for authorization in your application, too. We should have coverage of all operations, though. If that isn't the case, please [open an issue][issues].
20
29
21
30
If you're using custom processors, make sure that they extend `JSONAPI::Authorization::AuthorizingProcessor`, or authorization will not be performed for that resource.
22
31
23
-
This gem should work out-of-the box for simple cases. The default authorizer might be overly restrictive for [more complex cases][complex-case].
32
+
This gem should work out-of-the box for simple cases. The default authorizer might be overly restrictive for cases where you are touching relationships.
24
33
25
-
The API is subject to change between minor version bumps until we reach v1.0.0.
34
+
**If you are modifying relationships**, you should read the [relationship authorization documentation](docs/relationship-authorization.md).
0 commit comments