Allow AuthorizationHandlers to customize authorization status check process#2438
Conversation
9f2f426 to
8c9b635
Compare
Codecov Report
@@ Coverage Diff @@
## master #2438 +/- ##
==========================================
+ Coverage 98.68% 98.69% +<.01%
==========================================
Files 1296 1297 +1
Lines 30363 30354 -9
==========================================
- Hits 29964 29958 -6
+ Misses 399 396 -3 |
1e92d7c to
464d13e
Compare
|
|
||
| module Decidim | ||
| module Verifications | ||
| class Hooks |
There was a problem hiding this comment.
This should probably be called DefaultHooks, as it comes with a default implementation.
There was a problem hiding this comment.
Also, not sure about hook as a name for this abstraction.
There was a problem hiding this comment.
What about calling it DefaultAuthorizationHandlerAuthorizer? it is a little long, but I think is the most accurate name, since it provides the logic for ActionAuthorizer that is inside the specific authorization handler. I would also change all references to hooks with authorizer.
There was a problem hiding this comment.
What about using DefaultActionAuthorizer and action_authorizer as a method name?
There was a problem hiding this comment.
Ok, I will prepare that change. 👍
| These are particulary useful when used within verification options, which are | ||
| set in the admin zone related to a feature action. As a result, a verification | ||
| method will be allowed to change the authorization logic and the appearance based | ||
| on the context where the authorization is being performed. |
There was a problem hiding this comment.
Maybe mention an example so a developer or a user can understand its value?
There was a problem hiding this comment.
And also an example on how to set it at the admin zone (like the screenshot)
There was a problem hiding this comment.
What do you think about this? I'm not very good in english developer-human communications, any help would be very appreciated. 😅
3a0f03e to
689c6aa
Compare
4dca389 to
ddca15c
Compare
|
@leio10 is this ready for reviews? |
… as a sample of hooks use.
ddca15c to
c972392
Compare
|
@mrcasals it should be ready to merge now. |
|
@leio10 LOL thanks!! I'm gonna review it and hopefully we can merge this without any other conflicts! |
|
@mrcasals It seems that codecov is stuck with this PR 😢 |
|
@leio10 shhhhhhhhh 🤐 |
|
Merged! 🎉 About CodeCov, it's not the first time it gets stuck, and in some other PRs we've skipped the checks and merged the Pr anyway. |
🎩 What? Why?
This change is the second part of #2435, explained in #2314. It adds a
DefaultActionAuthorizerclass with public methods that could be overriden by child classes. The class to be used for each handler is defined in the handler'sWorkflowManifest.Most of the logic of the
status_datamethod of theActionAuthorizerclass was moved to theauthorizemethod of the new class.More than the half of the effort of this PR was to allow authorization handler to inform the user about the implemented logic, this include:
A future PR should allow authorization handlers to define forms for options setting and avoid admin users to learn JSON.
📌 Related Issues
📋 Subtasks
📷 Screenshots (optional)
👻 GIF