49 improve authorization of create actions#48
Merged
Conversation
itamm15
reviewed
Mar 9, 2026
3 tasks
vincentvanbush
approved these changes
Mar 10, 2026
itamm15
approved these changes
Apr 16, 2026
vincentvanbush
approved these changes
Apr 20, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request
Description
This PR introduces
authorize_with_transactionfor controller create flows that need post insert authorization checks.Final behavior in this PR:
authorize_with_transactionreturns only{:ok, value}or{:error, reason}{:error, conn}(after calling unauthorized handler):on_unauthorizedhandler can overridehandle_unauthorized/2for this flowType of Change
Related Issues
Closes #49.
Changes Made
authorize_with_transaction/2,3callback API and default implementation inPermit.Phoenix.Controller(Ecto enabled path).:actionoverride support for authorization context.:on_unauthorizedoption to customize unauthorized handling for this flow.{:ok, _} | {:error, _} | {:unauthorized, conn}to{:ok, _} | {:error, _}.{:error, %Ecto.Changeset{}}(validation){:error, conn}(unauthorized)Testing
Test Environment
Test Cases
Test Commands Run
Documentation
Code Quality
Phoenix/LiveView Specific
Backward Compatibility
Breaking Changes
Performance Impact
Performance Notes
Security Considerations
Additional Notes
Screenshots/Examples
Checklist
Reviewer Notes