-
Notifications
You must be signed in to change notification settings - Fork 8
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
Protect Routes #292
Merged
Merged
Protect Routes #292
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
6e6b893
Initial role based routing
joaodiaslobo 582f36e
Add membership status to conn assigns to retrieve role and protect ro…
joaodiaslobo 80b03ce
Add organization parameter to department routes
joaodiaslobo 75bafae
Initial role based routing
joaodiaslobo feebe5a
Add membership status to conn assigns to retrieve role and protect ro…
joaodiaslobo 237d1ab
Add organization parameter to department routes
joaodiaslobo 75dff21
Merge branch 'jl/protect-routes' of github.com:cesium/atomic into jl/…
joaodiaslobo a849e37
Fix issues regarding previous rebase
joaodiaslobo 3a558fb
Check for parameters mismatch and trigger 404
joaodiaslobo 075b5c0
Add organization parameter to partnership routes
joaodiaslobo f07ca2b
Change organization routes id parameter's name
joaodiaslobo 4956113
Change membership routes and detect id mismatches
joaodiaslobo 9c43972
Remove duplicate routes
joaodiaslobo 756263e
Add organization_id param to activity routes
joaodiaslobo d650934
Filter activities by organization
joaodiaslobo b9539d5
Add organization parameter to speaker routes
joaodiaslobo a475878
Change board routes and check for id mismatches
joaodiaslobo 3cb3da0
Initial role based routing
joaodiaslobo 31d0e56
Add membership status to conn assigns to retrieve role and protect ro…
joaodiaslobo f7a275b
Add organization parameter to department routes
joaodiaslobo b528b79
Initial role based routing
joaodiaslobo 7dcd54a
Add membership status to conn assigns to retrieve role and protect ro…
joaodiaslobo 02423dc
Add organization parameter to department routes
joaodiaslobo 6f51255
Fix issues regarding previous rebase
joaodiaslobo 43fc3f9
Check for parameters mismatch and trigger 404
joaodiaslobo 015b71e
Add organization parameter to partnership routes
joaodiaslobo 161f226
Change organization routes id parameter's name
joaodiaslobo 8f6d8cd
Change membership routes and detect id mismatches
joaodiaslobo a4205fc
Remove duplicate routes
joaodiaslobo bfad6e5
Add organization_id param to activity routes
joaodiaslobo c35bfb3
Filter activities by organization
joaodiaslobo 7dc2c24
Add organization parameter to speaker routes
joaodiaslobo aaf5d8c
Change board routes and check for id mismatches
joaodiaslobo a318a7b
Merge branch 'jl/protect-routes' of github.com:cesium/atomic into jl/…
joaodiaslobo cba4774
Run formatter
joaodiaslobo 1c1187a
Solve warnings
joaodiaslobo b4ce9fc
Update routes and add authorization
joaodiaslobo e94d326
Keep organization state trough routes
joaodiaslobo b155ca7
Fix tests
MarioRodrigues10 a7f3908
Fix warnings
MarioRodrigues10 0825507
Add some improvements
MarioRodrigues10 290bcbe
Add field default_organization_id
MarioRodrigues10 5edc4eb
Solve minor root.html.heex problem
MarioRodrigues10 f27aafb
Implement suggestions
MarioRodrigues10 b710af3
Fix function
MarioRodrigues10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
defmodule AtomicWeb.MismatchError do | ||
defexception message: "The provided parameters have no relation in the database.", | ||
plug_status: 404 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div id="atomic-edit" phx-update="ignore"> | ||
<.live_component module={AtomicWeb.ActivityLive.FormComponent} id={@activity.id} title={@page_title} action={@live_action} activity={@activity} return_to={Routes.activity_show_path(@socket, :show, @activity)} /> | ||
<.live_component module={AtomicWeb.ActivityLive.FormComponent} id={@activity.id} organization={@current_organization} title={@page_title} action={@live_action} activity={@activity} return_to={Routes.activity_show_path(@socket, :show, @current_organization, @activity)} /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div id="atomic-new" phx-update="ignore"> | ||
<.live_component module={AtomicWeb.ActivityLive.FormComponent} id={:new} title={@page_title} action={@live_action} activity={@activity} return_to={Routes.activity_index_path(@socket, :index)} /> | ||
<.live_component module={AtomicWeb.ActivityLive.FormComponent} id={:new} organization={@current_organization} title={@page_title} action={@live_action} activity={@activity} return_to={Routes.activity_index_path(@socket, :index, @current_organization)} /> | ||
</div> |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you raising an exception on an
handle_params
function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what he is doing is raising an exception making the current request fail with 404 status, which automatically shows the 404 page. Smart
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I see. Why not wrap this logic inside a function and call it on a Plug implemented at the route level? That way, we could also use that function when deciding to display (or not) the "Edit" button on the show of an activity. Agreed? 🙏
Edit: This was supposed to be a reply to the already created thread 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is a good idea. Will clean up the code quite a bit