Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continued authz #81

Merged
merged 10 commits into from
Jan 4, 2025
Merged

Continued authz #81

merged 10 commits into from
Jan 4, 2025

Conversation

calebbourg
Copy link
Collaborator

@calebbourg calebbourg commented Dec 4, 2024

Description

Adds Authorization plumbing and functions for index actions.

There's a good amount of duplicated code. I think I'm at a point where I'd like to audit and re-think our error handling a bit. Probably use an existing crate. My thought is that it will be much easier to refactor some of this authorization stuff to remove the duplication if I take a step back and improve on how errors are propagated through our abstraction layers.
The plan would be something like this:

  • Merge this PR
  • Pivot to work on our real-time collaboration stuff
  • Come back and think through error handling
  • Refactor this code and add authorization functions for other operations (Ex. updating resources)

Testing Strategy

valid coaching_relationship_id

curl 'http://localhost:4000/coaching_sessions?coaching_relationship_id=c6026a63-bace-4e83-bfda-5987e63a5192&from_date=2024-11-04&to_date=2025-01-04' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Connection: keep-alive' \
  -H 'Cookie: id=FJd0ETgOe6PM4MhvZwWuXA' \
  -H 'Origin: http://localhost:3000' \
  -H 'Referer: http://localhost:3000/' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
  -H 'X-Version: 0.0.1' \
  -H 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"'

@calebbourg calebbourg force-pushed the continued_authz branch 2 times, most recently from 1f031b1 to 06c401f Compare December 12, 2024 13:37
@calebbourg calebbourg self-assigned this Dec 12, 2024
@calebbourg calebbourg added the enhancement Improves existing functionality or feature label Dec 12, 2024
@calebbourg calebbourg requested a review from jhodapp December 12, 2024 13:47
@calebbourg calebbourg marked this pull request as ready for review December 12, 2024 13:47
Copy link
Member

@jhodapp jhodapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A great start, I'm looking forward to building on top of this!

.route("/notes", get(note_controller::index))
.route_layer(from_fn_with_state(app_state.clone(), protect::notes::index))
.merge(
// GET /notes
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these inline for readability as there are a few nestings of functions/methods

@jhodapp
Copy link
Member

jhodapp commented Jan 4, 2025

@calebbourg This looks great, feel free to merge whenever ready. The merge grouping you added reads really well and is quite intuitive.

@calebbourg calebbourg merged commit a0428fd into main Jan 4, 2025
4 checks passed
@calebbourg calebbourg deleted the continued_authz branch January 4, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality or feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants