Skip to content

Conversation

@tapiarafael
Copy link
Contributor

@tapiarafael tapiarafael commented Feb 18, 2025

Proposed changes (including videos or screenshots)

Check the license before inserting new users on the LDAP Sync (It will continue to update existing users).

Issue(s)

Steps to test or reproduce

Further comments


This pull request addresses an issue in the Rocket.Chat repository by adding a validation mechanism to the LDAP synchronization process. The update ensures that the activation of new LDAP users does not exceed the license restrictions. Specifically, a new method insertUser is introduced in the LDAPUserConverter class to manage user insertion while checking against the active user license limit. Additionally, a logger is implemented to provide warnings when the maximum number of users is reached. These changes aim to prevent any violations of the seat limit defined by the license.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 18, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@codecov
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.62%. Comparing base (56a15e8) to head (05b2b68).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35244   +/-   ##
========================================
  Coverage    59.62%   59.62%           
========================================
  Files         2832     2832           
  Lines        68362    68362           
  Branches     15144    15144           
========================================
  Hits         40758    40758           
  Misses       24996    24996           
  Partials      2608     2608           
Flag Coverage Δ
unit 75.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2025

🦋 Changeset detected

Latest commit: 05b2b68

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tapiarafael
Copy link
Contributor Author

I can't write tests for this one. E2E is impossible because of the LDAP, and unit testing is almost insane, considering how much I would need to mock and how artificial the test would be.
The best scenario would be extracting the license seat validation to a function and testing the function isolated, but this would be only to say that we have tests, since I would be testing a dumb sum equation (2 users + 2 newUsers >= licenseLimit)

@tapiarafael tapiarafael marked this pull request as ready for review February 18, 2025 17:29
KevLehman
KevLehman previously approved these changes Feb 19, 2025
@scuciatto scuciatto added this to the 7.5.0 milestone Feb 21, 2025
@CLAassistant
Copy link

CLAassistant commented Feb 23, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35244/

Built to branch gh-pages at 2025-04-14 19:29 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ricardogarim ricardogarim dismissed stale reviews from KevLehman and MarcosSpessatto via dd8ecf3 March 19, 2025 14:31
ricardogarim
ricardogarim previously approved these changes Mar 19, 2025
@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Mar 19, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Mar 19, 2025
@scuciatto scuciatto modified the milestones: 7.5.0, 7.6.0 Mar 24, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Apr 7, 2025
@pierre-lehnen-rc pierre-lehnen-rc requested a review from a team as a code owner April 7, 2025 17:08
refactor: early return to improve readability

Create famous-falcons-laugh.md

test: ensure that license is being checked

feat: use `shouldPreventAction` from License

rewrites changeset

validate license on user insertion instead

oops
@ricardogarim ricardogarim force-pushed the fix/ldap-sync-limit branch from 7b2e7d9 to fac8690 Compare April 9, 2025 19:21
@scuciatto scuciatto added stat: QA assured Means it has been tested and approved by a company insider and removed stat: QA assured Means it has been tested and approved by a company insider labels Apr 14, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 14, 2025
@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kodiakhq kodiakhq bot merged commit c24da0b into develop Apr 15, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the fix/ldap-sync-limit branch April 15, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants