Add basic scaffolding for custom authorization functions #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Sets up pattern for protecting various resources through authorization. This very likely will evolve over time.
The basic idea is as follows:
The new
web::protect
module will encapsulate various submodules which will each have a number of authorization policies. The policy names (at least for the time being) should map directly to the controller action they are protecting.Ex
web::protect::coaching_relationships::index
=>web::controller::organization::coaching_relationships::index
.We can see if this pattern for code organization holds up as we implement more policies but for now it seemed reasonable.
GitHub Issue: [Closes|Fixes|Resolves] #your GitHub issue number here
Changes
web::protect
module for encapsulating authorization policiesprotect::coaching_relationships::index
function for authorizingcoaching_relationships
GET organizations/:organization_id/coaching_relationships
using the new function with from_fn_with_stateTesting Strategy
I used cURL to test this:
Valid organization_id
Invalid organization_id
Concerns
describe any concerns that might be worth mentioning or discussing