-
Notifications
You must be signed in to change notification settings - Fork 343
Cleaned up use of PrivilegesEvaluatorResponse #5804
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
Cleaned up use of PrivilegesEvaluatorResponse #5804
Conversation
4a3fb21 to
2900218
Compare
Signed-off-by: Nils Bandener <[email protected]>
7b86bff to
0a11355
Compare
Signed-off-by: Nils Bandener <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5804 +/- ##
==========================================
- Coverage 73.52% 73.49% -0.03%
==========================================
Files 438 438
Lines 26746 26709 -37
Branches 3960 3959 -1
==========================================
- Hits 19664 19629 -35
- Misses 5197 5200 +3
+ Partials 1885 1880 -5
🚀 New features to boost your workflow:
|
DarshitChanpura
left a comment
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.
Thank you for adding this improvement @nibix .
i do see that there is mixed usage of .reason("...") method chained with .insufficient(action). Should we have all insufficient() chained with reason()?
src/main/java/org/opensearch/security/privileges/ProtectedIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/SystemIndexAccessEvaluator.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/privileges/PrivilegesEvaluatorResponse.java
Show resolved
Hide resolved
I would recommend to improve incrementally. There's already a completely new PrivilegesEvaluator implementation in #5399 ... this PR has the goal to incrementally move towards that. |
Description
This PR is in preparation of #5399
The class
PrivilegesEvaluatorResponsewas using some less-than-optimal implementation patterns, especially exposing public attribute members which were directly manipulated by other classes. Additionally, theisComplete()pattern was never really used in a meaningful way.This PR does the following changes:
PrivilegeEvaluatorResponseare privatePrivilegeEvaluatorResponseare now immutableisComplete()pattern is given up. Instead, methods now return a non-nullPrivilegesEvaluatorResponseif they can decide on the authorization status and null otherwise.Testing
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.