-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix: updateWithoutPermission updates user instead of saving it #36206
Conversation
WalkthroughThis pull request introduces significant modifications to the Changes
Assessment against linked issues
Poem
Tip Announcements
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (1)
Additional comments not posted (3)
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.yaml
Review profile: CHILL
Files selected for processing (2)
- app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java (3 hunks)
- app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java (2 hunks)
Additional comments not posted (4)
app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserServiceTest.java (2)
42-44
: Looks good!The imports are necessary for implementing security-related functionality in the test class. The code changes are approved.
755-787
: Great work on enhancing the test coverage!The new
runAs
method is a helpful utility for simulating user security contexts during testing. It will make it easier to write tests that verify the behavior of user-related operations under different security contexts.The
testUpdateName_shouldNotUpdatePolicies
test is a valuable addition. It ensures that updating a user's name does not accidentally modify their associated policies. This test helps maintain the integrity of user permissions and roles.Overall, these changes significantly improve the robustness and reliability of the user management functionality. Well done!
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java (2)
578-578
: Excellent optimization!The change in the
update
method is a significant improvement. By directly callingrepository.updateById
, you have streamlined the update process and eliminated the need for manual field copying.This optimization not only simplifies the code but also improves performance by reducing the overhead associated with object creation and field mapping.
Great job on identifying and implementing this enhancement!
604-605
: Good catch on preserving user policies!Setting the
policies
field tonull
in theupdates
object is a critical change. It ensures that the existing user policies are not accidentally overwritten during the update process.By preserving the user's policies, you maintain the integrity of their permissions and roles. This is essential for maintaining a secure and consistent access control system.
Well done on identifying and addressing this important aspect of user updates!
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserServiceCEImpl.java
Show resolved
Hide resolved
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.
LGTM except for the above comment. Approving to not block the PR in case the tests turn out okay.
…ithorg#36206) ## Description > UserService$updateWithoutPermission will now update the user instead of saving it. Fixes appsmithorg#36063 ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10786655302> > Commit: 0eb7f18 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10786655302&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Tue, 10 Sep 2024 06:20:46 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced user update functionality for more efficient processing. - Added a mechanism to ensure user policies remain unchanged during updates. - **Bug Fixes** - Implemented tests to verify that user name updates do not affect associated policies. - **Tests** - Introduced new test methods to validate user update scenarios within the correct security context. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nilesh Sarupriya <[email protected]>
Description
Fixes #36063
Automation
/ok-to-test tags="@tag.Sanity"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10786655302
Commit: 0eb7f18
Cypress dashboard.
Tags:
@tag.Sanity
Spec:
Tue, 10 Sep 2024 06:20:46 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Tests