-
Notifications
You must be signed in to change notification settings - Fork 2
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
Get group membership faster. #58
Conversation
For members where we already know the DN, just create the grant instead of fetching the user. For group membership by user id, we still have to hit the LDAP server.
Caution Review failedThe pull request is closed. WalkthroughThe recent updates introduce a new function, Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- pkg/connector/group.go (2 hunks)
Additional comments not posted (2)
pkg/connector/group.go (2)
132-146
: Well-structured function for grant creation.The
newGrantFromDN
function is well-structured and effectively encapsulates the grant creation logic, enhancing maintainability and reducing redundancy.
Line range hint
147-239
: Streamlined grant creation inGrants
method.The integration of
newGrantFromDN
into theGrants
method effectively reduces redundancy and simplifies the control flow. Ensure that this change does not affect other parts of the codebase that rely on the previous grant creation logic.Verification successful
Streamlined grant creation in
Grants
method verified.The integration of
newGrantFromDN
into theGrants
method has been verified and does not affect other parts of the codebase. The changes effectively reduce redundancy and simplify the control flow without impacting existing functionalities.
- The
Grants
method ingroupResourceType
now usesnewGrantFromDN
for streamlined grant creation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new grant creation logic in `Grants` does not affect other parts of the codebase. # Test: Search for usage of the `Grants` method. Expect: No issues with the new grant creation logic. rg --type go -A 5 $'Grants'Length of output: 282957
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.
Looks good
It took me a second to get up to speed on what a DN
was. Can you add a docstring to newGrantFromDN()
that says something like
// newGrantFromDN - create a `Grant` from a given group and user distinguished name.
func newGrantFromDN(resource *v2.Resource, userDN string) *v2.Grant {
This might also be a good time to add a integration test for groups.
Our current CI tests do test granting/revoking group membership, so if this code did break that, the test would fail. |
For members where we already know the DN, just create the grant instead of fetching the user. For group membership by user id, we still have to hit the LDAP server.
Summary by CodeRabbit
New Features
Improvements
Error Handling