refactor: introduce declarative permission pattern for authorization#50
Merged
ivan-borovets merged 2 commits intoivan-borovets:masterfrom Jul 25, 2025
Conversation
Replace procedural authorization logic with a declarative Permission/Policy pattern. This improves code clarity, maintainability, and testability. Key changes: - Add Permission abstraction and concrete implementations (IsSelf, IsSuperior, etc.) - Add composite permissions (AnyOf, AllOf) for complex authorization rules - Extend AuthorizationService with declarative authorize() method - Refactor ChangePasswordInteractor and GrantAdminInteractor to use new pattern The old procedural methods are retained for backward compatibility. This change demonstrates Clean Architecture principles by improving the application layer abstractions without affecting other layers.
Owner
|
Thanks for the idea! I did hesitate a bit over adding another abstraction layer — it can raise the entry barrier for new developers — but in the end, the gain in clarity felt worth it. To support that direction, a few adjustments were made:
Let me know what you think about the current version. |
5b601d3 to
71d437c
Compare
Owner
|
Proceeding with this for now. Always open to feedback if anything needs to be revisited. |
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.
Replace procedural authorization logic with a declarative Permission/Policy pattern. This improves code clarity, maintainability, and testability.
Key changes:
The old procedural methods are retained for backward compatibility. This change demonstrates Clean Architecture principles by improving the application layer abstractions without affecting other layers.