Skip to content

feat: Allow per user logout url - #21204

Merged
gustavotrott merged 19 commits into
bigbluebutton:v3.0.x-releasefrom
jaapjansma:dev_20285_allow_per_user_logoutURL
Nov 27, 2024
Merged

gustavotrott merged 19 commits into
bigbluebutton:v3.0.x-releasefrom
jaapjansma:dev_20285_allow_per_user_logoutURL

Conversation

@jaapjansma

@jaapjansma jaapjansma commented Sep 17, 2024 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds a logoutURL parameter to the joinMeeting api. This introduces a feature to have a per user logoutURL

Closes Issue(s)

Closes #20285

Motivation

We are using big blue button in our organization and we create a meeting from our CiviCRM installation. We want the moderator to go to a different url after logging out. In the url for the moderator we ask the moderator some follow up questions about the meeting and we store that result in our CiviCRM.

The viewers should go to the normal logout page.

More

@gustavotrott

Copy link
Copy Markdown
Contributor

Hey @jaapjansma, thanks for your contribution!

Right now, the logoutURL supports placeholders like %%USERID%%, but I know these might not be super helpful for third-party integrations.
I was thinking we could add new placeholders like %%EXTERNAL_USERID%% and maybe %%USER_ROLE%%. This way, the integration platform could use a callback endpoint and set it as the logoutUrl, which would handle the user properly and redirect them to the right page.

Basically, instead of passing the URL directly through the join call, your CRM would have a generic URL that gets called, receives a parameter with the user's ID in that application, and it knows what to do next.

Do you think this approach would work for your use case?

@jaapjansma

Copy link
Copy Markdown
Contributor Author

@gustavotrott the short answer is that we might get that working with a little workaround. The reason for that is that our CiviCRM runs in a private network (behind a firewall) and the follow up form is on a separate website. Your suggestion means that we have to implement something in between which looks up the use role and then redirect it to the desired location (which depends on whether the person has the role moderator).

So ideally we provide this logout Url from our CiviCRM as soon as we create the meeting.

I am also curious what @ffdixon would think? As he has written the original feature request.

@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@coderabbitai

coderabbitai Bot commented Sep 27, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes involve the introduction of a logoutUrl parameter across various components of the application. This parameter allows for the customization of logout URLs per user, enhancing the flexibility of user redirection upon logout. Modifications include updates to method signatures, case classes, and database schemas to accommodate this new functionality. Key updates include the addition of the logoutUrl field in user-related classes and database tables, ensuring that each user can have a unique logout URL. The changes also encompass the adjustment of existing methods to handle this new parameter, ensuring that the core functionality of user registration and management is maintained. Furthermore, a new utility for URL validation has been introduced to enhance robustness.

Assessment against linked issues

Objective Addressed Explanation
Allow per-user logoutURL (20285) ✅

Possibly related PRs

Suggested reviewers

  • gustavotrott

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (13)
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (2)

23-23: LGTM! Consider encapsulation for future refactoring.

The new logoutUrl field is correctly declared as final, which is good for immutability. Its declaration is consistent with other fields in the class.

For future refactoring, consider using private fields with getter methods to improve encapsulation. This would allow for better control over data access and modification.


23-23: Overall impact: Feature implemented as requested. Consider additional system changes.

The changes successfully implement the per-user logout URL feature as requested in the PR objectives. The implementation is consistent with the existing code structure and allows for flexibility in specifying logout URLs for different users.

Consider the following points for a complete implementation:

  1. Ensure that the logoutUrl is properly used in the logout process, possibly in the meeting controller or a related service.
  2. Update any relevant documentation or API specifications to reflect this new parameter.
  3. Consider adding validation for the logoutUrl to ensure it's a valid URL.
  4. If not already planned, implement changes in the front-end application to pass the logoutUrl when registering users.

Also applies to: 29-29, 45-45

bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (3)

16-16: LGTM: Constructor updated correctly with minor suggestion.

The constructor has been properly updated to include the new logoutUrl parameter, and the field is correctly initialized. This change maintains backward compatibility.

Consider adding a null check for the logoutUrl parameter to ensure it's not null before assigning it to the field. This can prevent potential NullPointerExceptions later:

 public RegisteredUser(String authToken, String userId, String guestStatus, Boolean excludeFromDashboard,
                       Boolean leftGuestLobby, String enforceLayout, String logoutUrl) {
     // ... other initializations ...
-    this.logoutUrl = logoutUrl;
+    this.logoutUrl = logoutUrl != null ? logoutUrl : "";
 }

Also applies to: 23-23


62-64: LGTM: Setter method for logoutUrl added with suggestion for improvement.

The setLogoutUrl(String logoutUrl) method is properly implemented, following Java conventions for setter methods. It provides appropriate access to modify the private logoutUrl field.

Consider adding input validation to ensure that only valid URLs are set. This can prevent potential issues with invalid URLs later in the application. Here's a suggested implementation:

+import java.net.URL;
+import java.net.MalformedURLException;

 public void setLogoutUrl(String logoutUrl) {
-    this.logoutUrl = logoutUrl;
+    if (logoutUrl == null || logoutUrl.isEmpty()) {
+        this.logoutUrl = "";
+    } else {
+        try {
+            new URL(logoutUrl);
+            this.logoutUrl = logoutUrl;
+        } catch (MalformedURLException e) {
+            throw new IllegalArgumentException("Invalid URL: " + logoutUrl, e);
+        }
+    }
 }

This change ensures that only valid URLs are set, and throws an IllegalArgumentException for invalid URLs, improving the robustness of the class.


Line range hint 1-78: Summary: Implementation successfully adds support for per-user logout URLs.

The changes to the RegisteredUser class effectively implement the feature request for allowing per-user logout URLs. The new logoutUrl field, along with its getter and setter methods, provides the necessary functionality to manage individual logout URLs for each user.

This implementation aligns well with the PR objectives and the requirements outlined in issue #20285. It offers a flexible solution that allows front-end applications to specify unique logout URLs for each user, addressing the limitations of the previous shared logout URL functionality.

The code maintains backward compatibility and follows good Java coding practices. With the suggested minor improvements for null checking and URL validation, this implementation will provide a robust solution for managing user-specific logout URLs in the Big Blue Button system.

To fully leverage this new feature:

  1. Ensure that the logoutUrl is properly set when creating RegisteredUser objects in the relevant parts of the application.
  2. Update the logout process to use the user-specific logoutUrl when available, falling back to the default logout URL if not set.
  3. Consider adding documentation or comments in the class to explain the purpose and usage of the logoutUrl field, especially noting any constraints on the URL format or protocol.
bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (1)

167-167: LGTM! Consider adding a comment for clarity.

The addition of logoutUrl to the select_permissions for the bbb_client role is appropriate and aligns with the PR objectives. It allows clients to access the custom logout URL while maintaining security by not exposing it to clients not in a meeting.

Consider adding a brief comment above the logoutUrl field to explain its purpose and any specific considerations. This can help future maintainers understand the intent behind this addition. For example:

# Custom logout URL for redirecting users based on their role
- logoutUrl
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (2)

10-10: LGTM! Consider improving parameter alignment for readability.

The addition of the logoutUrl parameter to the create method and its inclusion in the RegisteredUser constructor aligns well with the PR objective of allowing per-user logout URLs. The implementation is correct and consistent with the existing code style.

To improve readability, consider aligning the parameters vertically:

def create(
  meetingId: String,
  userId: String,
  extId: String,
  name: String,
  roles: String,
  authToken: String,
  sessionToken: String,
  avatar: String,
  webcamBackground: String,
  color: String,
  guest: Boolean,
  authenticated: Boolean,
  guestStatus: String,
  excludeFromDashboard: Boolean,
  enforceLayout: String,
  logoutUrl: String,
  userMetadata: Map[String, String],
  loggedOut: Boolean
): RegisteredUser = {
  // ... (rest of the method body)
}

This formatting can make the method signature easier to read and maintain, especially as more parameters are added.

Also applies to: 35-35


Line range hint 1-261: Summary: Implementation successfully addresses PR objectives

The changes made to the RegisteredUsers object and RegisteredUser case class effectively implement the per-user logout URL feature as described in the PR objectives. The new logoutUrl parameter has been correctly added to the create method and integrated into the RegisteredUser case class.

These modifications align well with the requirement to allow unique logout URLs for each user, which was the main goal of this PR. The implementation should enable the desired functionality of directing moderators and viewers to different logout pages based on their roles.

To fully realize the benefits of this feature:

  1. Ensure that the logoutUrl is properly utilized in the relevant API endpoints or controllers that handle user logout.
  2. Update the documentation to reflect this new capability, especially for integrators like CiviCRM users.
  3. Consider adding unit tests to verify the correct handling of the new logoutUrl parameter.

As this feature introduces a new level of flexibility in user management, it's important to ensure that:

  1. The logoutUrl is properly sanitized and validated before use to prevent potential security issues like open redirects.
  2. There's a fallback mechanism in place in case a custom logoutUrl is not provided or is invalid.
  3. The feature is documented clearly for administrators and integrators, explaining how to use and manage per-user logout URLs effectively.

These considerations will help ensure the feature is both powerful and secure in its implementation.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (1)

291-291: LGTM! Consider adding parameter documentation.

The addition of the logoutUrl parameter to the registerUser method successfully implements the per-user logout URL feature. This change aligns well with the PR objectives.

However, to improve code maintainability and clarity, consider adding a brief comment or ScalaDoc to explain the purpose and expected format of the logoutUrl parameter.

Add a comment above the method signature explaining the logoutUrl parameter:

/**
 * @param logoutUrl The URL to redirect the user to upon logout. If not provided, the default logout URL will be used.
 */
def registerUser(meetingId: String, intUserId: String, name: String,
                 role: String, extUserId: String, authToken: String, sessionToken: String,
                 avatarURL: String, webcamBackgroundURL: String, guest: java.lang.Boolean, authed: java.lang.Boolean,
                 guestStatus: String, excludeFromDashboard: java.lang.Boolean,
                 enforceLayout: String, logoutUrl: String, userMetadata: java.util.Map[String, String]): Unit = {
  // ... (existing implementation)
}

Also applies to: 300-301

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (1)

127-131: LGTM! Consider adding parameter documentation.

The addition of the logoutUrl parameter to the registerUser method signature and its inclusion in the handle method call are correct and align with the PR objective of allowing per-user logout URLs.

Consider adding Javadoc comments for the new logoutUrl parameter to improve code documentation:

/**
 * @param logoutUrl The custom logout URL for the user
 */
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (1)

408-413: Enhance logout URL handling

The changes introduce a more flexible approach to handling the logout URL:

  1. It retrieves the default logout URL from the meeting object.
  2. If a logout URL is provided in the request parameters (using ApiParams.LOGOUT_URL), it overrides the default.
  3. A debug log statement is added to track the final logout URL.

These changes align with the PR objectives of allowing per-user logout URLs. However, there are a few points to consider:

  1. The ApiParams.LOGOUT_URL constant is not defined in this file. Ensure it's properly imported and defined.
  2. The debug log message uses string concatenation, which can be inefficient for logging. Consider using parameterized logging.

Consider updating the debug log statement to use parameterized logging:

-    log.debug "The following logout URL is present: " + logoutUrl
+    log.debug "The following logout URL is present: {}", logoutUrl

This change improves logging performance, especially when debug logging is disabled.

bbb-graphql-server/bbb_schema.sql (2)

285-285: LGTM! Consider adding an index for performance.

The addition of the logoutUrl column to the user table is appropriate and aligns with the PR objectives. The varchar(500) type is suitable for storing URLs.

Consider adding an index on this column if you expect to query users by their logout URL frequently:

CREATE INDEX idx_user_logoutUrl ON "user"("meetingId", "logoutUrl");

Action Required: Update Functions and Triggers to Handle logoutUrl

The logoutUrl column has been added to the user table, but existing functions and triggers do not reference or handle this new field. To ensure data consistency and proper functionality:

  • Update Functions:

    • update_user_voice_voiceActivityAt_trigger_func
    • update_user_connectionStatus_trigger_func
    • update_user_reaction_trigger_func
    • update_chat_user_startedTypingAt_trigger_func
    • update_chatUser_clear_lastTypingAt_trigger_func
    • update_user_hasDrawPermissionOnCurrentPage
    • update_user_presenter_trigger_func
    • ins_upd_del_breakoutRoom_user_trigger_func
    • set_last_room
    • update_bkroom_isUserCurrentlyInRoom_trigger_func
    • truncate_tables
  • Update Triggers:

    • update_user_voice_voiceActivityAt_trigger
    • update_user_connectionStatus_trigger
    • update_user_reaction_trigger
    • insert_user_reaction_trigger
    • update_user_presenter_trigger
    • update_bkroom_isUserCurrentlyInRoom_trigger

Ensure that all functions and triggers that perform insertions or updates on the user table include handling for the logoutUrl column. This may involve setting default values, updating existing records, and ensuring that business logic accounts for the new field.

🔗 Analysis chain

Line range hint 285-427: Consider reviewing related functions and triggers.

While the changes to add the logoutUrl column and include it in the view are well-implemented, it's worth considering if any existing functions or triggers in the schema need to be updated to handle this new column. For example, if there are any functions that insert or update user records, they might need to be modified to include the logoutUrl field.

To help identify any potential areas that might need updating, you can run the following script:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for functions or triggers that reference the user table
echo "Functions referencing the user table:"
rg --type sql -i 'CREATE\s+(OR\s+REPLACE\s+)?FUNCTION.*user' -A 10

echo "\nTriggers on the user table:"
rg --type sql -i 'CREATE\s+TRIGGER.*ON\s+(")?user(")?'

Length of output: 10857

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5dbefe3 and 7d7bb92.

📒 Files selected for processing (21)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (1 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1 hunks)
  • bbb-graphql-server/bbb_schema.sql (2 hunks)
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (1 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (6 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts (2 hunks)
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
🔇 Additional comments (28)
bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts (3)

6-6: Approved: logoutUrl moved to user_current object

This change aligns well with the PR objective of allowing per-user logout URLs. Moving logoutUrl from the meeting object to the user_current object enables the system to handle unique logout URLs for each user, which is exactly what was requested in the original feature request (issue #20285).


25-25: Approved: GraphQL query updated to fetch logoutUrl for each user

The addition of logoutUrl to the user_current selection set in the getMeetingEndData GraphQL query is crucial for implementing the per-user logout URL feature. This change ensures that the client receives the correct logout URL for each user, enabling the desired functionality of directing users to different logout pages based on their roles or other criteria.


Line range hint 1-43: Verify integration with other components

The changes made to the MeetingEndDataResponse interface and getMeetingEndData GraphQL query provide a solid foundation for implementing per-user logout URLs. However, to ensure full functionality:

  1. Verify that the server-side implementation sets the user-specific logoutUrl when users join a meeting.
  2. Check if any client-side components that previously used meeting.logoutUrl have been updated to use user_current.logoutUrl.
  3. Confirm that the documentation (mentioned in PR #21205) accurately reflects these changes.

To help with this verification, you can run the following script:

This script will help identify any areas that might need attention due to the logoutUrl relocation.

✅ Verification successful

Verification Complete: No Issues Found

The updates to the MeetingEndDataResponse interface and getMeetingEndData GraphQL query have been correctly implemented. All instances of meeting.logoutUrl have been removed, and the logoutUrl assignments in the components are properly set.

  • No remaining instances of meeting.logoutUrl detected.
  • logoutUrl is correctly assigned in relevant components.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential places that might need updates due to the logoutUrl change

# Test 1: Check for any remaining instances of meeting.logoutUrl
echo "Checking for remaining instances of meeting.logoutUrl:"
rg --type typescript --type javascript 'meeting\.logoutUrl'

# Test 2: Check for new instances of user_current.logoutUrl
echo "Checking for new instances of user_current.logoutUrl:"
rg --type typescript --type javascript 'user_current\.logoutUrl'

# Test 3: Look for potential places where logoutUrl is set on the server side
echo "Checking for potential server-side logoutUrl settings:"
rg --type typescript --type javascript 'logoutUrl.*='

Length of output: 644


Script:

#!/bin/bash
# Description: Corrected script to check for potential places that might need updates due to the logoutUrl change

# Test 1: Check for any remaining instances of meeting.logoutUrl in TypeScript and JavaScript files
echo "Checking for remaining instances of meeting.logoutUrl:"
rg --type ts --type tsx --type javascript 'meeting\.logoutUrl'

# Test 2: Check for new instances of user_current.logoutUrl in TypeScript and JavaScript files
echo "Checking for new instances of user_current.logoutUrl:"
rg --type ts --type tsx --type javascript 'user_current\.logoutUrl'

# Test 3: Look for potential places where logoutUrl is set on the server side in TypeScript and JavaScript files
echo "Checking for potential server-side logoutUrl settings:"
rg --type ts --type tsx --type javascript 'logoutUrl\s*='

Length of output: 633


Script:

#!/bin/bash
# Description: Updated script to check for potential places that might need updates due to the logoutUrl change

# Test 1: Check for any remaining instances of meeting.logoutUrl in TypeScript, TSX, and JavaScript files
echo "Checking for remaining instances of meeting.logoutUrl:"
rg --type ts --type typescriptreact --type javascript 'meeting\.logoutUrl'

# Test 2: Check for new instances of user_current.logoutUrl in TypeScript, TSX, and JavaScript files
echo "Checking for new instances of user_current.logoutUrl:"
rg --type ts --type typescriptreact --type javascript 'user_current\.logoutUrl'

# Test 3: Look for potential places where logoutUrl is set on the server side in TypeScript, TSX, and JavaScript files
echo "Checking for potential server-side logoutUrl settings:"
rg --type ts --type typescriptreact --type javascript 'logoutUrl\s*='

Length of output: 705


Script:

#!/bin/bash
# Description: Updated script to check for potential places that might need updates due to the logoutUrl change using glob patterns

# Test 1: Check for any remaining instances of meeting.logoutUrl in .ts, .tsx, and .js files
echo "Checking for remaining instances of meeting.logoutUrl:"
rg -g "*.ts" -g "*.tsx" -g "*.js" 'meeting\.logoutUrl'

# Test 2: Check for new instances of user_current.logoutUrl in .ts, .tsx, and .js files
echo "Checking for new instances of user_current.logoutUrl:"
rg -g "*.ts" -g "*.tsx" -g "*.js" 'user_current\.logoutUrl'

# Test 3: Look for potential places where logoutUrl is set on the server side in .ts, .tsx, and .js files
echo "Checking for potential server-side logoutUrl settings:"
rg -g "*.ts" -g "*.tsx" -g "*.js" 'logoutUrl\s*='

Length of output: 1039

bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1)

26-26: LGTM! Verify implementations and update documentation.

The addition of the logoutUrl parameter to the registerUser method signature aligns well with the PR objectives to allow per-user logout URLs. This change enhances the flexibility of the system as requested.

To ensure the change is properly implemented, please run the following script to check for classes implementing this interface:

Consider updating the method's documentation to reflect the new logoutUrl parameter. This will help maintain clear and up-to-date documentation for developers using this interface.

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)

29-29: LGTM! Verify impact on existing code.

The constructor has been correctly updated to include the new logoutUrl parameter, and the field is properly initialized. The changes maintain the existing structure and style of the constructor.

To ensure that this change doesn't break existing code, we should verify that all calls to this constructor have been updated. Run the following script to check for any usages of the old constructor signature:

Also applies to: 45-45

✅ Verification successful

Verification Successful

All existing usages of the RegisterUser constructor have been updated to include the new logoutUrl parameter. No issues were found during the verification process.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of RegisterUser constructor that might need updating

# Test: Search for RegisterUser constructor calls
rg --type java -A 5 'new RegisterUser\s*\('

Length of output: 802

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1)

33-33: LGTM! The change aligns with the PR objectives.

The addition of the logoutUrl parameter to the RegisterUserReqMsgBody constructor is consistent with the PR's goal of allowing per-user logout URLs. This change enables the system to pass individual logout URLs for each user during registration.

Let's verify the consistency of this change across the codebase:

This script will help us ensure that:

  1. All calls to RegisterUserReqMsgBody include the logoutUrl parameter.
  2. The RegisterUser case class includes the logoutUrl field.
  3. Any handlers for RegisterUserReqMsg are updated to handle the new parameter.

Please review the results of this script to confirm the consistency of the change across the codebase.

✅ Verification successful

Verification Successful: logoutUrl Parameter Consistently Implemented

The addition of the logoutUrl parameter to the RegisterUserReqMsgBody constructor has been consistently applied across the codebase. All constructor calls and related message handlers have been appropriately updated to handle the new parameter, ensuring alignment with the PR objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency of the logoutUrl parameter across the codebase

# Test 1: Search for RegisterUserReqMsgBody constructor calls
echo "Searching for RegisterUserReqMsgBody constructor calls:"
rg --type scala "RegisterUserReqMsgBody\(" -A 10

# Test 2: Search for RegisterUser case class definition
echo "Searching for RegisterUser case class definition:"
rg --type scala "case class RegisterUser"

# Test 3: Search for logoutUrl parameter in related message handlers
echo "Searching for logoutUrl parameter in related message handlers:"
rg --type scala "def handle.*RegisterUserReqMsg"

Length of output: 6341

bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (2)

13-13: LGTM: New field logoutUrl added correctly.

The addition of the logoutUrl field aligns with the PR objectives and follows good encapsulation practices by being declared as private.


58-60: LGTM: Getter method for logoutUrl added correctly.

The getLogoutUrl() method is properly implemented, following Java conventions for getter methods. It provides appropriate access to the private logoutUrl field.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1)

37-37: Verify the implementation of the logoutURL parameter

The addition of an empty string parameter to the RegisteredUsers.create method call aligns with the PR objective of adding a logoutURL parameter. However, there are some concerns:

  1. The PR mentions adding a logoutURL parameter, but the implementation uses an empty string.
  2. It's unclear if this empty string is intended to be a placeholder for the logoutURL.

Please confirm if this implementation aligns with the PR objectives. If it does:

  1. Consider replacing the empty string with a meaningful parameter name or value for logoutURL.
  2. Update the method signature and any related documentation to reflect this change.

If this is not the intended implementation for the logoutURL feature, please revise the code to accurately reflect the PR objectives.

To verify the RegisteredUsers.create method signature, you can run the following script:

This will help ensure that the method signature matches the updated call site.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (2)

Line range hint 1-124: Verify consistent usage of logoutUrl across the system.

While the change is minimal and focused, it's important to ensure that the addition of logoutUrl is consistently handled across the system. This includes checking if any other components or methods need to be updated to work with or pass along this new parameter.

Please run the following script to check for other occurrences of logoutUrl in the codebase:

✅ Verification successful

Consistent usage of logoutUrl confirmed across the system.
The search results indicate that logoutUrl is consistently used in multiple components of the codebase. The addition in RegisterUserReqMsgHdlr.scala aligns with existing implementations, ensuring uniform handling without introducing conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of logoutUrl in the codebase

# Test: Search for logoutUrl usage
rg --type scala --type java 'logoutUrl'

Length of output: 7552


63-63: LGTM! Verify RegisteredUsers.create method signature.

The addition of msg.body.logoutUrl to the RegisteredUsers.create method call aligns with the PR objectives of adding a logoutURL parameter. The implementation looks correct.

Please run the following script to verify that the RegisteredUsers.create method signature has been updated to accept the new logoutUrl parameter:

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (4)

27-27: LGTM: Addition of logoutUrl field

The addition of the logoutUrl field to the UserDbModel case class aligns with the PR objectives. The default value of an empty string is appropriate, allowing for easy identification of custom logout URLs.


35-35: LGTM: Updates to UserDbTableDef class

The changes to the UserDbTableDef class are consistent with the addition of the logoutUrl field:

  1. The * projection is correctly updated to include the new field.
  2. A new column definition for logoutUrl is added with the correct type (String).

These changes ensure proper mapping between the database table and the UserDbModel case class.

Also applies to: 57-57


88-89: LGTM: Update to UserDAO.insert method

The addition of logoutUrl = regUser.logoutUrl to the UserDbModel creation in the insert method is correct and consistent with the changes made to the UserDbModel case class. This ensures that the per-user logout URL is properly stored in the database when inserting a new user.


27-27: Summary: Implementation of per-user logout URL

The changes in this file successfully implement the foundation for per-user logout URLs by adding the logoutUrl field to the UserDbModel, updating the UserDbTableDef, and modifying the UserDAO.insert method. These changes align well with the PR objectives.

However, to fully implement this feature, consider the following suggestions:

  1. Ensure that the logoutUrl is being used appropriately in the logout process.
  2. Update any relevant API endpoints or services that handle user logout to utilize this new field.
  3. Consider adding validation for the logoutUrl field to ensure it's a valid URL.
  4. Update documentation to reflect this new feature and how it should be used.

To verify the complete implementation of this feature, you may want to check other parts of the codebase that handle user logout. Here's a script to help identify potential areas that might need updates:

This script will help identify areas of the codebase that might need to be updated to fully implement the per-user logout URL feature.

Also applies to: 35-35, 57-57, 88-89

✅ Verification successful

Summary: Implementation of per-user logout URL Verified

The verification process confirms that the logoutUrl field has been successfully integrated throughout the codebase. The updated shell script identified all relevant usages in the code and confirmed that no additional configuration files require modifications.

No further actions are needed to fully implement this feature.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find potential areas in the codebase that might need updates for the new logoutUrl feature

# Search for logout-related code
echo "Searching for logout-related code:"
rg --type scala --type java "logout|logoutUrl" -g '!**/UserDAO.scala'

# Search for API endpoints that might need to be updated
echo "\nSearching for potential API endpoints to update:"
rg --type scala --type java "def.*logout" -g '!**/UserDAO.scala'

# Search for configuration related to logout URLs
echo "\nSearching for logout URL configuration:"
rg --type scala --type java --type conf "logoutUrl|logout.*url" -g '!**/UserDAO.scala'

Length of output: 9270


Script:

#!/bin/bash
# Description: Find potential areas in the codebase that might need updates for the new logoutUrl feature

# Search for logout-related code
echo "Searching for logout-related code:"
rg --type scala --type java "logout|logoutUrl" -g '!**/UserDAO.scala'

# Search for potential API endpoints to update
echo "\nSearching for potential API endpoints to update:"
rg --type scala --type java "def.*logout" -g '!**/UserDAO.scala'

# Search for configuration related to logout URLs
echo "\nSearching for logout URL configuration:"
rg "logoutUrl|logout.*url" -g '*.conf' -g '!**/UserDAO.scala'

Length of output: 9216

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (1)

258-258: LGTM! Verify usage of logoutUrl in related components.

The addition of the logoutUrl field to the RegisteredUser case class is correct and consistent with the changes made in the create method. This change successfully implements the per-user logout URL feature.

To ensure the new logoutUrl field is properly utilized, please verify its usage in related components:

This verification will help ensure that the logoutUrl is properly integrated into the system and used as intended in API endpoints or controllers.

✅ Verification successful

Verified the usage of logoutUrl across related components.

All instances of logoutUrl have been appropriately integrated within the system, ensuring consistent functionality across relevant components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of logoutUrl in related components

# Test: Search for logoutUrl usage in Scala files
echo "Searching for logoutUrl usage in Scala files:"
rg --type scala 'logoutUrl'

# Test: Search for logoutUrl in API-related files
echo "Searching for logoutUrl in API-related files:"
rg --type scala 'logoutUrl' | rg -i 'api|endpoint|controller'

Length of output: 5049

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (4)

181-181: LGTM: Addition of logoutUrl to MeetingEndedProps

The addition of the logoutUrl property to the MeetingEndedProps interface is correct and aligns with the PR objectives. This change enables the component to receive a custom logout URL for each user.


194-194: LGTM: logoutUrl added to MeetingEnded component props

The logoutUrl prop has been correctly added to the destructured props of the MeetingEnded component. This change is consistent with the MeetingEndedProps interface modification and allows the component to receive the custom logout URL.


Line range hint 1-516: Summary: Implementation of per-user logout URL

The changes introduced in this file successfully implement the per-user logout URL feature as described in the PR objectives. The logoutUrl property has been added to the necessary interfaces and components, allowing for custom logout URLs to be passed down and used within the MeetingEnded component.

Key points:

  1. The MeetingEndedProps interface has been updated to include logoutUrl.
  2. The MeetingEnded component now accepts logoutUrl as a prop.
  3. The MeetingEndedContainer passes the logoutUrl to MeetingEnded in all render scenarios (loading, error, and success).

To ensure the implementation is complete, please verify the following:

  1. Check that the logoutUrl is being used correctly in the redirection logic within the MeetingEnded component:
#!/bin/bash
# Check for the usage of logoutUrl in redirection logic
grep -n 'window.location.href = logoutUrl' bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx
  1. Verify that the logoutUrl is being properly populated in the GraphQL query result:
#!/bin/bash
# Check for the logoutUrl in the GraphQL query
grep -n 'logoutUrl' bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts

These verifications will ensure that the logoutUrl is not only passed correctly but also used appropriately in the component logic and properly fetched from the backend.


454-454: LGTM: logoutUrl added to MeetingEnded in loading state

The logoutUrl prop has been correctly added to the MeetingEnded component within the loading state render of MeetingEndedContainer. The empty string default value is appropriate for this state.

Please ensure that a similar update has been made for the error state render. You can verify this by running the following command:

If the output shows two occurrences (one for loading and one for error state), then the change has been consistently applied.

✅ Verification successful

Verified: logoutUrl correctly added to both loading and error states in MeetingEnded component

The logoutUrl prop has been consistently added to both the loading (line 454) and error (line 472) state renders of the MeetingEnded component. This ensures consistency and adheres to the component's prop requirements.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if logoutUrl prop is present in both loading and error state renders
grep -n 'logoutUrl=""' bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx

Length of output: 144

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (1)

291-291: Verify usage of registerUser method across the codebase.

The signature change of the registerUser method might affect other parts of the codebase that call this method.

To ensure that all calls to registerUser have been updated correctly, run the following script:

Please review the output to ensure all calls to registerUser have been updated to include the logoutUrl parameter.

Also applies to: 300-301

✅ Verification successful

All calls to registerUser have been verified and no issues were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all calls to registerUser method and verify they include the new logoutUrl parameter.

# Search for method calls to registerUser
rg --type scala "registerUser\s*\(" -A 10

Length of output: 1692

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (2)

11-11: Verify implementation and documentation

While the message structure change is correct, it's important to ensure that the rest of the system can handle and utilize this new logoutUrl parameter effectively.

  1. Please verify that the actual implementation of the custom logout URL functionality is present in the appropriate parts of the system (e.g., the component that handles user logout).

  2. Check that the documentation update in the linked PR (#21205) accurately reflects this change and provides guidance on how to use the new logoutUrl parameter.

These steps will ensure that the feature is fully implemented and properly documented for users and developers.


11-11: LGTM! Verify usage in other parts of the system.

The addition of the logoutUrl parameter to RegisterUserReqMsgBody correctly implements the requested feature for allowing per-user logout URLs. This change aligns well with the PR objectives.

To ensure this change doesn't break existing functionality, please verify all usages of RegisterUserReqMsgBody across the codebase. Run the following script to find all occurrences:

Make sure to update any code that constructs this case class to include the new logoutUrl parameter.

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (1)

138-138: LGTM! Consistent implementation of the new feature.

The inclusion of logoutUrl in the RegisteredUser constructor call is correct and consistent with the previous changes. This modification ensures that the custom logout URL is properly associated with the registered user.

bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (3)

441-441: Update UserSession with new logoutUrl

The UserSession object is now updated with the potentially customized logoutUrl. This change is crucial for implementing the per-user logout URL feature.


Line range hint 408-503: Summary of changes for per-user logout URL feature

The implemented changes successfully add support for per-user logout URLs in the join method of the ApiController. Key modifications include:

  1. Retrieving the default logout URL from the meeting object.
  2. Allowing override of the logout URL through request parameters.
  3. Updating the UserSession object with the custom logout URL.
  4. Passing the logout URL to the registerUser method of the meetingService.

These changes align well with the PR objectives and provide the desired flexibility for handling different logout URLs based on user roles or entry paths.

To ensure full compatibility and proper implementation, please verify the following:

  1. The ApiParams.LOGOUT_URL constant is properly defined and imported.
  2. The registerUser method in the meetingService has been updated to handle the new logoutUrl parameter.
  3. Any downstream code that relies on the logout URL (e.g., actual logout handling) has been updated to use the new per-user logout URL.

Run the following script to check for potential usage of the logout URL in other parts of the codebase:

#!/bin/bash
# Description: Check for logout URL usage in the codebase
# Test: Find occurrences of logout URL handling
rg --type groovy 'logoutUrl|logout.*URL' ./grails-app

This will help identify any areas that might need additional updates to fully support the new feature.


503-503: Pass logoutUrl to registerUser method

The logoutUrl is now passed as a parameter to the registerUser method of the meetingService. This ensures that the custom logout URL is properly associated with the user's session.

To ensure this change is properly integrated, we should verify that the registerUser method in the meetingService has been updated to accept and handle this new parameter. Run the following script to check the method signature:

bbb-graphql-server/bbb_schema.sql (1)

427-427: LGTM! The view update is consistent with the table change.

The addition of the logoutUrl field to the v_user_current view is appropriate and consistent with the change made to the user table. This ensures that the logout URL is available when querying current user data through this view.

@jaapjansma
jaapjansma force-pushed the dev_20285_allow_per_user_logoutURL branch from 7d7bb92 to d28496c Compare October 10, 2024 11:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (22)
bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts (1)

Ensure all usages of getMeetingEndData and logoutUrl are correctly updated

The shell script execution identified multiple instances of getMeetingEndData and logoutUrl across various components and services. Please verify that all these usages have been updated to align with the new structure introduced in the recent changes. This will help prevent potential inconsistencies or runtime errors.

  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx
  • bigbluebutton-html5/imports/startup/client/logger/ServerStream.ts
  • bigbluebutton-html5/imports/ui/components/presence-adapter/component.tsx
  • bigbluebutton-html5/imports/ui/components/join-handler/presenceManager/component.tsx
  • bigbluebutton-html5/imports/ui/core/local-states/useAuthData.ts
  • (and others as identified by the script)
🔗 Analysis chain

Line range hint 1-43: Verify impact on dependent components

The changes to both the MeetingEndDataResponse interface and the getMeetingEndData GraphQL query are well-implemented and consistent. They successfully address the PR objectives by allowing per-user logout URLs, which will improve flexibility for different user roles (e.g., moderators and viewers).

However, it's important to ensure that these changes don't negatively impact other parts of the application that may rely on the previous structure.

Please run the following script to identify potential areas that might be affected by this change:

Review the results to ensure that all occurrences are updated to use the new structure where logoutUrl is part of user_current instead of meeting.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usages of getMeetingEndData and logoutUrl in the codebase

echo "Searching for usages of getMeetingEndData:"
rg --type typescript --type javascript "getMeetingEndData" -A 5

echo "\nSearching for usages of logoutUrl:"
rg --type typescript --type javascript "logoutUrl" -A 5

Length of output: 367


Script:

#!/bin/bash
# Description: Search for usages of getMeetingEndData and logoutUrl in the codebase

echo "Searching for usages of getMeetingEndData:"
rg --type ts --type tsx --type js --type jsx "getMeetingEndData" -A 5

echo "\nSearching for usages of logoutUrl:"
rg --type ts --type tsx --type js --type jsx "logoutUrl" -A 5

Length of output: 365


Script:

#!/bin/bash
# Description: Search for usages of getMeetingEndData and logoutUrl in the codebase

echo "Searching for usages of getMeetingEndData:"
rg "getMeetingEndData" --glob "*.{ts,tsx,js,jsx}" -A 5

echo "\nSearching for usages of logoutUrl:"
rg "logoutUrl" --glob "*.{ts,tsx,js,jsx}" -A 5

Length of output: 21343

bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (1)

62-64: Consider adding input validation for setLogoutUrl().

The setLogoutUrl() method is correctly implemented and follows Java conventions. However, consider adding input validation to ensure the provided URL is valid and meets any specific format requirements.

Here's a suggestion for adding basic validation:

public void setLogoutUrl(String logoutUrl) {
    if (logoutUrl == null || logoutUrl.trim().isEmpty()) {
        throw new IllegalArgumentException("Logout URL cannot be null or empty");
    }
    // You might want to add more specific URL validation here
    this.logoutUrl = logoutUrl;
}
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

Line range hint 1-85: Summary of changes and next steps

The modification to the RegisterUser case class aligns with the PR objectives to allow per-user logout URLs. This change enhances the flexibility of user redirection upon logout, as requested in the original feature request.

To ensure a smooth integration of this change, please:

  1. Verify that all usages of RegisterUser across the codebase are updated to use the new logoutUrl parameter instead of sessionToken.
  2. Review and update the handleRegisterUser method implementation in this file to correctly process the logoutUrl parameter.
  3. Check for any remaining references to sessionToken that might need to be replaced with logoutUrl.
  4. Ensure that the logoutUrl is being properly utilized in the logout process.

These steps will help maintain consistency and prevent potential issues related to this change.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (1)

26-26: LGTM! Consider using Option[String] for logoutUrl.

The addition of logoutUrl to the UserDbModel case class aligns well with the PR objective of allowing per-user logout URLs. Good job on using an empty string as the default value to avoid null values.

Consider using Option[String] instead of String with a default empty value. This would make it clearer when a logout URL is explicitly not set versus when it's an empty string. If you decide to make this change, remember to update related code accordingly.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (2)

10-10: LGTM! Consider adding documentation for the new parameter.

The addition of the logoutUrl parameter to the create method aligns well with the PR objectives. It allows for specifying a unique logout URL for each user, which is a key feature of this PR.

Consider adding a brief comment explaining the purpose of the logoutUrl parameter, especially since it's a new addition. This will help future developers understand its significance without needing to refer to external documentation.


272-272: LGTM! Consider adding a brief description for the new field.

The addition of the logoutUrl field to the RegisteredUser case class is consistent with the changes in the create method and aligns with the PR objectives.

Consider adding a brief comment above the logoutUrl field to describe its purpose and any constraints (e.g., if it can be null or empty). This will enhance the self-documentation of the code and help maintain it in the future.

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (3)

Line range hint 272-276: Validate logoutUrl before redirection

While the usage of logoutUrl for redirection is correct, directly assigning it to window.location.href without validation could pose a security risk. Consider implementing a URL validation function to ensure logoutUrl is safe before redirection.

Example validation:

const isValidUrl = (url: string): boolean => {
  try {
    new URL(url);
    return true;
  } catch {
    return false;
  }
};

// Usage
if (isValidUrl(logoutUrl)) {
  window.location.href = logoutUrl;
} else {
  // Handle invalid URL (e.g., log error, use default URL)
}

Line range hint 283-289: Validate logoutUrl after placeholder replacements

The placeholder replacements in logoutUrl enhance functionality, but the resulting URL should be validated before use. Consider adding a validation step after the replacements:

let redirectTo = logoutUrl;
redirectTo = redirectTo.replaceAll('%%USERID%%', userId);
redirectTo = redirectTo.replaceAll('%%USERNAME%%', userName);
redirectTo = redirectTo.replaceAll('%%MEETINGID%%', meetingId);

if (isValidUrl(redirectTo)) {
  window.location.href = redirectTo;
} else {
  // Handle invalid URL (e.g., log error, use default URL)
}

This ensures that the final URL is safe to use for redirection.


454-454: LGTM: logoutUrl correctly added to MeetingEndedContainer

The logoutUrl prop is correctly added to the MeetingEnded component calls within MeetingEndedContainer. The usage of an empty string as a fallback value in loading and error states is appropriate.

Consider adding a comment explaining the source of logoutUrl for clarity:

const {
  isModerator,
  logoutUrl, // Custom logout URL for the user
  meeting,
} = user_current[0];

This addition enhances code readability and documents the purpose of logoutUrl.

Also applies to: 472-472, 484-484, 512-512

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

11-11: LGTM! Consider adding a comment for the logoutUrl parameter.

The addition of the logoutUrl parameter to the RegisterUserReqMsgBody case class is correct and aligns with the PR objectives. This change enables the feature of specifying custom logout URLs for each user during registration.

Consider adding a brief comment to describe the purpose of the logoutUrl parameter, for example:

case class RegisterUserReqMsgBody(
  // ... other parameters ...
  logoutUrl: String, // Custom URL to redirect the user upon logout
  userMetadata: Map[String, String]
)

This will improve code readability and make the purpose of the new parameter clear to other developers.

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2)

127-127: LGTM! Consider adding @Nullable annotation.

The addition of the logoutUrl parameter to the registerUser method signature is appropriate and aligns with the PR objective of allowing per-user logout URLs.

Consider adding the @Nullable annotation to the logoutUrl parameter if it's not always required. This would improve code clarity and help prevent null pointer exceptions.


Line range hint 127-463: Summary: Per-user logout URL feature implemented correctly

The changes in this file successfully implement the per-user logout URL feature as per the PR objectives. The logoutUrl parameter has been consistently added to relevant method signatures and constructor calls. The implementation is minimal and focused, which is good for maintainability.

Key points:

  1. registerUser method signature updated
  2. RegisterUser constructor call updated
  3. RegisteredUser constructor call updated
  4. processRegisterUser method call updated

To ensure a complete implementation:

  1. Verify that the RegisteredUser class has been updated to include the logoutUrl field.
  2. Confirm that the gw.registerUser method in the gateway class handles the new logoutUrl parameter.
  3. Update unit tests to cover the new logoutUrl functionality.
  4. Consider adding documentation for the new parameter in the method JavaDoc comments.
bbb-graphql-server/bbb_schema.sql (10)

Line range hint 19-131: LGTM: Meeting tables are well-structured with appropriate relationships.

The meeting table and its related tables (meeting_breakout, meeting_recordingPolicies, etc.) are well-designed with appropriate columns, constraints, and indexes. The use of generated columns for createdAt and ended in the meeting table is a good practice for maintaining consistency.

Consider adding a CHECK constraint to the meeting_recording table to ensure that stoppedAt is always greater than or equal to startedAt. This would prevent potential data inconsistencies:

ALTER TABLE "meeting_recording" ADD CONSTRAINT "check_recording_times" 
CHECK ("stoppedAt" IS NULL OR "stoppedAt" >= "startedAt");

Line range hint 133-726: LGTM: User tables are comprehensive and well-structured.

The user table and its related tables (user_voice, user_camera, etc.) are well-designed with appropriate columns, constraints, and indexes. The use of generated columns for derived properties is a good practice for maintaining consistency and improving query performance.

Consider using an ENUM type for the role column in the user table instead of a varchar. This would provide better type safety and potentially improve performance. Here's how you could implement this:

CREATE TYPE user_role AS ENUM ('MODERATOR', 'PRESENTER', 'VIEWER');

ALTER TABLE "user" ALTER COLUMN "role" TYPE user_role USING "role"::user_role;

This change would ensure that only valid roles can be assigned to users and could potentially improve query performance when filtering by role.


Line range hint 728-1004: LGTM: Chat tables are well-structured with good use of triggers and views.

The chat system, including the chat, chat_user, and chat_message tables, is well-designed. The use of triggers for updating typing status and message sequences is a good approach to maintain data consistency. The views provide useful abstractions for querying chat data efficiently.

Consider adding a soft delete mechanism for chat messages instead of using a deletedAt timestamp. This could be implemented by adding a deleted boolean column and updating the views to filter out deleted messages. Here's an example:

ALTER TABLE "chat_message" ADD COLUMN "deleted" boolean NOT NULL DEFAULT false;

CREATE INDEX "idx_chat_message_deleted" ON "chat_message"("deleted");

-- Update the v_chat_message_public view
CREATE OR REPLACE VIEW "v_chat_message_public" AS
SELECT cm.*
FROM chat_message cm
WHERE cm."chatId" = 'MAIN-PUBLIC-GROUP-CHAT' AND cm."deleted" = false;

-- Update other views similarly

This approach would allow for easier management of deleted messages and potentially improve query performance when fetching active messages.


Line range hint 1006-1330: LGTM: Presentation and annotation tables are well-structured with good use of triggers and views.

The presentation system, including the pres_presentation, pres_page, and pres_annotation tables, is well-designed. The use of triggers for updating user permissions is a good approach to maintain data consistency. The views provide useful abstractions for querying presentation data efficiently.

For handling large presentations, consider implementing a pagination mechanism for fetching pages and annotations. This could be done by adding a LIMIT and OFFSET to the relevant views or by creating stored procedures. Here's an example for the v_pres_page view:

CREATE OR REPLACE FUNCTION get_presentation_pages(
    p_presentation_id VARCHAR(100),
    p_limit INTEGER,
    p_offset INTEGER
) RETURNS TABLE (
    -- Include all columns from v_pres_page
) AS $$
BEGIN
    RETURN QUERY
    SELECT *
    FROM v_pres_page
    WHERE "presentationId" = p_presentation_id
    ORDER BY "num"
    LIMIT p_limit
    OFFSET p_offset;
END;
$$ LANGUAGE plpgsql;

This approach would allow for more efficient fetching of large presentations, reducing the load on both the database and the application.


Line range hint 1332-1443: LGTM: Poll tables are well-structured with good use of views for data aggregation.

The poll system, including the poll, poll_option, and poll_response tables, is well-designed. The views provide useful abstractions for querying poll data and aggregating results efficiently.

Consider adding a materialized view for poll results to improve performance for frequently accessed poll data, especially for polls with many responses. Here's an example:

CREATE MATERIALIZED VIEW "mv_poll_results" AS
SELECT
    poll."meetingId",
    poll."pollId",
    poll."type",
    poll."questionText",
    poll."ownerId" AS "pollOwnerId",
    poll.published,
    o."optionId",
    o."optionDesc",
    count(r."optionId") AS "optionResponsesCount",
    sum(count(r."optionId")) OVER (partition by poll."pollId") "pollResponsesCount"
FROM poll
JOIN poll_option o ON o."pollId" = poll."pollId"
LEFT JOIN poll_response r ON r."pollId" = poll."pollId" AND o."optionId" = r."optionId"
GROUP BY poll."pollId", o."optionId", o."optionDesc"
ORDER BY poll."pollId";

CREATE UNIQUE INDEX ON "mv_poll_results" ("pollId", "optionId");

-- Create a function to refresh the materialized view
CREATE OR REPLACE FUNCTION refresh_poll_results()
RETURNS TRIGGER AS $$
BEGIN
    REFRESH MATERIALIZED VIEW CONCURRENTLY "mv_poll_results";
    RETURN NULL;
END;
$$ LANGUAGE plpgsql;

-- Create triggers to refresh the materialized view
CREATE TRIGGER refresh_poll_results_trigger
AFTER INSERT OR UPDATE OR DELETE ON poll_response
FOR EACH STATEMENT EXECUTE FUNCTION refresh_poll_results();

This approach would significantly improve query performance for poll results, especially for polls with a large number of responses.


Line range hint 1445-1495: LGTM: External video and Screenshare tables are simple and effective.

The externalVideo and screenshare tables are well-structured for their purposes. The indexes and views, particularly those filtering for current (non-stopped) entries, are appropriate and useful.

For long-running screenshares or external videos, consider implementing a heartbeat mechanism to ensure the sharing is still active. This could be done by adding a lastHeartbeatAt column and updating it periodically. Here's an example for the screenshare table:

ALTER TABLE "screenshare" ADD COLUMN "lastHeartbeatAt" timestamp with time zone;

CREATE INDEX "idx_screenshare_heartbeat" ON "screenshare"("meetingId", "lastHeartbeatAt");

-- Update the view to include the heartbeat check
CREATE OR REPLACE VIEW "v_screenshare" AS
SELECT * FROM "screenshare"
WHERE "stoppedAt" IS NULL
  AND ("lastHeartbeatAt" IS NULL OR "lastHeartbeatAt" > (NOW() - INTERVAL '1 minute'));

-- Create a function to update the heartbeat
CREATE OR REPLACE FUNCTION update_screenshare_heartbeat(p_screenshareId varchar(50))
RETURNS void AS $$
BEGIN
    UPDATE "screenshare" SET "lastHeartbeatAt" = NOW()
    WHERE "screenshareId" = p_screenshareId AND "stoppedAt" IS NULL;
END;
$$ LANGUAGE plpgsql;

This approach would allow you to detect and handle stale screenshares or external videos that may have been disconnected unexpectedly.


Line range hint 1497-1533: LGTM: Timer table and view are well-designed for tracking meeting timers.

The timer table structure is comprehensive, allowing for both stopwatch and countdown functionalities. The v_timer view provides useful derived properties based on the timer state, which is a good practice for encapsulating complex logic.

To improve timer precision and handle potential time drift, consider using a combination of the database timestamp and the application server's time. You could add a column to store the offset between the server time and the database time when the timer starts. Here's an example:

ALTER TABLE "timer" ADD COLUMN "serverStartOffset" bigint;

-- Update the view to include the offset in calculations
CREATE OR REPLACE VIEW "v_timer" AS
SELECT
     "meetingId",
     "stopwatch",
     CASE
        WHEN "stopwatch" IS TRUE OR "running" IS FALSE THEN "running"
        WHEN "startedAt" + (("time" - COALESCE("accumulated", 0)) * INTERVAL '1 millisecond') + 
             ("serverStartOffset" * INTERVAL '1 millisecond') >= CURRENT_TIMESTAMP THEN TRUE
        ELSE FALSE
     END "running",
     -- ... (rest of the view definition)
FROM "timer";

-- Create a function to start the timer with server offset
CREATE OR REPLACE FUNCTION start_timer(p_meetingId varchar(100), p_serverTime bigint)
RETURNS void AS $$
BEGIN
    UPDATE "timer" 
    SET "startedOn" = EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000,
        "serverStartOffset" = p_serverTime - (EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000)
    WHERE "meetingId" = p_meetingId;
END;
$$ LANGUAGE plpgsql;

This approach would help maintain timer accuracy even if there's a slight difference between the application server's time and the database server's time.


Line range hint 1535-1731: LGTM: Breakout room tables are well-structured with good use of triggers and views.

The breakout room system, including the breakoutRoom and breakoutRoom_user tables, is well-designed. The use of triggers for updating user statuses and last assigned/joined rooms is a good approach to maintain data consistency. The views provide useful abstractions for querying breakout room data efficiently.

For handling large numbers of breakout rooms, consider implementing a partitioning strategy for the breakoutRoom_user table. This could improve query performance when dealing with meetings that have many breakout rooms. Here's an example of how you could implement this:

-- First, create a parent table
CREATE TABLE "breakoutRoom_user_parent" (
    "breakoutRoomId" varchar(100) NOT NULL,
    "meetingId" varchar(100),
    "userId" varchar(50),
    -- ... (other columns)
    CONSTRAINT "breakoutRoom_user_pkey" PRIMARY KEY ("breakoutRoomId", "meetingId", "userId")
) PARTITION BY HASH ("meetingId");

-- Create partitions
CREATE TABLE "breakoutRoom_user_p0" PARTITION OF "breakoutRoom_user_parent"
    FOR VALUES WITH (MODULUS 4, REMAINDER 0);
CREATE TABLE "breakoutRoom_user_p1" PARTITION OF "breakoutRoom_user_parent"
    FOR VALUES WITH (MODULUS 4, REMAINDER 1);
CREATE TABLE "breakoutRoom_user_p2" PARTITION OF "breakoutRoom_user_parent"
    FOR VALUES WITH (MODULUS 4, REMAINDER 2);
CREATE TABLE "breakoutRoom_user_p3" PARTITION OF "breakoutRoom_user_parent"
    FOR VALUES WITH (MODULUS 4, REMAINDER 3);

-- Update the view to use the parent table
CREATE OR REPLACE VIEW "v_breakoutRoom" AS
SELECT -- ... (existing SELECT statement)
FROM "user" u
JOIN "breakoutRoom" b ON b."parentMeetingId" = u."meetingId"
LEFT JOIN "breakoutRoom_user_parent" bu ON bu."meetingId" = u."meetingId" AND bu."userId" = u."userId" AND bu."breakoutRoomId" = b."breakoutRoomId"
-- ... (rest of the view definition)

This partitioning strategy would distribute the data across multiple tables based on the meetingId, which could significantly improve query performance for large meetings with many breakout rooms.


Line range hint 1733-1893: LGTM: Shared notes and caption tables are well-structured with good use of triggers and views.

The shared notes and caption systems, including the sharedNotes, sharedNotes_rev, caption_locale, and caption tables, are well-designed. The use of triggers for updating caption locale information is a good approach to maintain data consistency. The views provide useful abstractions for querying shared notes and caption data efficiently.

To improve real-time collaboration on shared notes, consider implementing a conflict resolution mechanism using a version vector or operational transformation approach. Here's an example of how you could modify the sharedNotes_rev table to support this:

ALTER TABLE "sharedNotes_rev" ADD COLUMN "parentRev" integer;
ALTER TABLE "sharedNotes_rev" ADD COLUMN "conflictResolution" jsonb;

-- Create a function to handle conflict resolution
CREATE OR REPLACE FUNCTION resolve_shared_notes_conflict(
    p_meetingId varchar(100),
    p_sharedNotesExtId varchar(25),
    p_userId varchar(50),
    p_parentRev integer,
    p_changeset text,
    p_conflictResolution jsonb
) RETURNS integer AS $$
DECLARE
    new_rev integer;
BEGIN
    -- Insert the new revision
    INSERT INTO "sharedNotes_rev" ("meetingId", "sharedNotesExtId", "userId", "parentRev", "changeset", "conflictResolution")
    VALUES (p_meetingId, p_sharedNotesExtId, p_userId, p_parentRev, p_changeset, p_conflictResolution)
    RETURNING "rev" INTO new_rev;

    -- Update the sharedNotes table with the latest revision
    UPDATE "sharedNotes"
    SET "lastRev" = new_rev
    WHERE "meetingId" = p_meetingId AND "sharedNotesExtId" = p_sharedNotesExtId;

    RETURN new_rev;
END;
$$ LANGUAGE plpgsql;

This approach would allow for more sophisticated handling of concurrent edits, reducing the likelihood of conflicts and improving the user experience in real-time collaborative editing scenarios.


Line range hint 1895-2095: LGTM: Layout, notification, and plugin data channel tables are well-structured.

The layout, notification, and pluginDataChannelEntry tables are well-designed for their respective purposes. The use of JSON data types for plugin data provides flexibility, and the views offer useful abstractions for querying the data efficiently.

To improve the handling of notifications, consider implementing a notification queue system that allows for better control over notification delivery and reduces the load on the main database. Here's an example of how you could modify the notification table and add a queue table:

-- Add a status column to the notification table
ALTER TABLE "notification" ADD COLUMN "status" varchar(20) DEFAULT 'pending';

-- Create a notification queue table
CREATE TABLE "notification_queue" (
    "queueId" serial PRIMARY KEY,
    "notificationId" integer REFERENCES "notification"("notificationId"),
    "status" varchar(20) DEFAULT 'queued',
    "retryCount" integer DEFAULT 0,
    "nextRetryAt" timestamp with time zone,
    "createdAt" timestamp with time zone DEFAULT current_timestamp,
    "updatedAt" timestamp with time zone DEFAULT current_timestamp
);

CREATE INDEX "idx_notification_queue_status" ON "notification_queue"("status", "nextRetryAt");

-- Create a function to enqueue notifications
CREATE OR REPLACE FUNCTION enqueue_notification(p_notificationId integer)
RETURNS void AS $$
BEGIN
    INSERT INTO "notification_queue" ("notificationId")
    VALUES (p_notificationId);
END;
$$ LANGUAGE plpgsql;

-- Create a trigger to automatically enqueue new notifications
CREATE TRIGGER "enqueue_notification_trigger"
AFTER INSERT ON "notification"
FOR EACH ROW
EXECUTE FUNCTION enqueue_notification(NEW."notificationId");

This approach would allow for better management of notification delivery, including retries and rate limiting, while reducing the load on the main database during high-traffic periods.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7d7bb92 and d28496c.

📒 Files selected for processing (20)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (1 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1 hunks)
  • bbb-graphql-server/bbb_schema.sql (2 hunks)
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (1 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (6 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts (2 hunks)
🧰 Additional context used
🔇 Additional comments (32)
bigbluebutton-html5/imports/ui/components/meeting-ended/queries.ts (2)

6-6: LGTM: Interface update aligns with PR objectives

The addition of the logoutUrl field to the user_current array elements in the MeetingEndDataResponse interface accurately reflects the PR's goal of implementing per-user logout URLs. This change enhances type safety and ensures consistency with the new feature.


25-25: LGTM: GraphQL query update maintains consistency

The addition of the logoutUrl field to the user_current selection set in the getMeetingEndData query ensures consistency with the updated interface. This change correctly implements the data fetching for the new per-user logout URL feature.

bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1)

26-26: LGTM! The logoutUrl parameter has been added correctly.

The addition of the logoutUrl parameter to the registerUser method signature aligns well with the PR objectives. This change enables the implementation of per-user logout URLs, which addresses the feature request described in issue #20285.

A few points to consider:

  1. The placement of the new parameter is appropriate, coming before the authed parameter.
  2. Existing implementations of this interface will need to be updated to accommodate this new parameter.
  3. It might be helpful to add a brief Javadoc comment to explain the purpose of the logoutUrl parameter.

To ensure all implementations of this interface are updated, please run the following script:

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (3)

23-23: LGTM: New field logoutUrl added correctly

The new logoutUrl field has been added with the appropriate modifiers (public final) and type (String). This is consistent with the other fields in the class and aligns with the PR objective of allowing per-user logout URLs.


29-29: LGTM: Constructor updated to include logoutUrl

The constructor has been correctly updated to include the new logoutUrl parameter. The parameter is added in the appropriate position in the constructor signature (line 29) and is properly assigned to the class field (line 45). This change ensures that the logoutUrl can be set when creating a new RegisterUser instance.

Also applies to: 45-45


23-23: Verify impact on existing codebase

While the changes to the RegisterUser class are correct, it's important to ensure that all parts of the codebase that use this class have been updated accordingly. Please verify the following:

  1. All calls to the RegisterUser constructor have been updated to include the new logoutUrl parameter.
  2. Any serialization/deserialization logic (e.g., JSON conversion) has been updated to handle the new logoutUrl field.
  3. Unit tests have been updated or added to cover the new functionality.

To help with this verification, you can run the following script:

Please review the output of this script and make any necessary adjustments to the codebase.

Also applies to: 29-29, 45-45

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1)

33-33: LGTM! Verify RegisterUser message update.

The addition of logoutUrl to the RegisterUserReqMsgBody constructor aligns with the PR objective of allowing per-user logout URLs. This change correctly passes the logoutUrl from the RegisterUser message to the Akka apps.

To ensure full compatibility, please verify that the RegisterUser message class has been updated to include the logoutUrl field. Run the following script to check:

bbb-common-web/src/main/java/org/bigbluebutton/api/domain/RegisteredUser.java (4)

13-13: LGTM: New field logoutUrl added correctly.

The addition of the logoutUrl field aligns with the PR objectives and follows good encapsulation practices by being declared as private.


16-16: LGTM: Constructor updated correctly to include logoutUrl.

The constructor has been properly updated to include the new logoutUrl parameter and initialize the corresponding field. The placement of the new parameter at the end of the parameter list maintains backward compatibility.

Also applies to: 23-23


58-60: LGTM: Getter method getLogoutUrl() added correctly.

The getLogoutUrl() method follows Java conventions and correctly provides read access to the logoutUrl field.


Line range hint 1-78: Overall, the changes to RegisteredUser.java are well-implemented.

The addition of the logoutUrl field, along with its getter and setter methods, successfully implements the per-user logout URL functionality as described in the PR objectives. The changes follow Java conventions and maintain good encapsulation practices. The only suggestion for improvement is to add input validation in the setLogoutUrl() method.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

Line range hint 69-70: Review handleRegisterUser method implementation

The handleRegisterUser method might need to be updated to handle the new logoutUrl parameter. Please review its implementation to ensure it correctly processes the logoutUrl instead of the removed sessionToken.

To assist with this review, please run the following script to display the content of the handleRegisterUser method:

#!/bin/bash
# Description: Display the content of the handleRegisterUser method

echo "Content of handleRegisterUser method:"
rg --type scala -A 10 "def handleRegisterUser"

Additionally, search for any usage of RegisterUser in other parts of the codebase to ensure consistent updates:

#!/bin/bash
# Description: Search for RegisterUser usage in the codebase

echo "Usage of RegisterUser in the codebase:"
rg --type scala "RegisterUser\("

Please review the results and make any necessary adjustments to maintain consistency with the new logoutUrl parameter.

akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (1)

21-21: Approve addition of logoutURL, but suggest improvements for clarity and test coverage.

The addition of the logoutURL parameter (as an empty string) aligns with the PR objective. However, to enhance clarity and test coverage:

  1. Consider updating the createRegisteredUser method signature to explicitly include the logoutURL parameter:
def createRegisteredUser(meetingId: String, users: RegisteredUsers, name: String, role: String,
                         guest: Boolean, authed: Boolean, waitForApproval: Boolean, logoutURL: String = ""): RegisteredUser
  1. Add test cases with non-empty logoutURL values to ensure proper handling of the new parameter.

  2. Could you clarify the purpose of the second empty string parameter and the reason for removing the Map() parameter? This information would help in understanding the full scope of the changes.

To verify the impact of these changes, please run the following script:

This will help us understand how these changes might affect other parts of the codebase.

✅ Verification successful

Verified the addition of logoutURL parameter and confirmed consistent usage across the codebase.

The changes align with the PR objectives, and no issues were found in the current implementations. Proceed with the suggested improvements to enhance clarity and test coverage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usages of RegisteredUsers.create and createRegisteredUser

# Test: Search for RegisteredUsers.create usage
echo "Searching for RegisteredUsers.create usage:"
rg --type scala -A 5 'RegisteredUsers\.create'

# Test: Search for createRegisteredUser usage
echo "Searching for createRegisteredUser usage:"
rg --type scala -A 5 'createRegisteredUser'

Length of output: 4917

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1)

37-37: ⚠️ Potential issue

Verify the impact of changing Map() to empty string in RegisteredUsers.create

The modification from Map() to "" for the last two parameters in RegisteredUsers.create aligns with the PR objective of allowing per-user logout URLs. However, this change raises some concerns:

  1. Changing from Map() to "" is a significant type change that could affect how user data is stored and retrieved in the system.
  2. This modification might impact other parts of the codebase that expect these parameters to be of type Map.

Please verify that this change doesn't break existing functionality. Run the following script to check for other usages of RegisteredUsers.create and ensure they are consistent with this change:

Could you please clarify the rationale behind changing these parameters from Map() to ""? This will help ensure that the change is intentional and doesn't introduce any unintended side effects.

bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (1)

167-167: LGTM! Consider adding logoutUrl to bbb_client_not_in_meeting role if needed.

The addition of the logoutUrl column to the bbb_client role's select permissions is correct and aligns with the PR objectives. The placement and indentation are appropriate, maintaining the file's structure.

Consider if the logoutUrl should also be added to the bbb_client_not_in_meeting role's permissions. If users not in a meeting don't need access to this information, the current implementation is fine. Otherwise, you may want to add it to that role as well.

To verify the current permissions, you can run the following command:

This will display the select permissions for both roles, allowing you to compare and ensure the logoutUrl is present where needed.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1)

63-63: LGTM! Verify usage of logoutUrl in related components.

The addition of msg.body.logoutUrl to the RegisteredUsers.create method call correctly implements the per-user logout URL feature as intended in the PR objectives. This change allows for customized logout URLs for each user, which is particularly useful for scenarios where different user roles require different post-logout behaviors.

To ensure the complete implementation of this feature, please verify:

  1. The RegisteredUsers.create method correctly handles the new logoutUrl parameter.
  2. The logout process uses this custom URL when redirecting users.

Run the following script to check the implementation:

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1)

61-61: ⚠️ Potential issue

Potential type mismatch and inconsistency with PR objectives

The change from Map() to "" for the second-to-last parameter of RegisteredUsers.create seems inconsistent with the expected type and the PR objectives. This might lead to type mismatches or runtime errors. Additionally, this change doesn't align with the introduction of a logoutUrl parameter as mentioned in the PR objectives.

Consider the following points:

  1. Is the empty string "" the correct type for this parameter? It was previously Map().
  2. How does this change relate to the new logoutUrl feature mentioned in the PR objectives?
  3. The AI-generated summary suggests that the last parameter was changed, but it's actually the second-to-last parameter that was modified.

To verify the correct usage of RegisteredUsers.create, please run the following command:

Could you please clarify the intention behind this change and ensure it aligns with the PR objectives?

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (3)

34-34: LGTM! Database schema updated correctly.

The changes to the UserDbTableDef class correctly integrate the new logoutUrl field into the database table definition. The * projection and the column definition are both updated appropriately.

Also applies to: 55-55


Line range hint 1-214: Overall, the changes look good and align with the PR objectives.

The implementation of the logoutUrl field in the UserDbModel, UserDbTableDef, and UserDAO.insert method is consistent and appears to be complete for this file. The changes support the new feature of allowing per-user logout URLs as requested in the PR objectives.

A few points to consider:

  1. The suggestion to use Option[String] for logoutUrl in the UserDbModel case class.
  2. Verifying that the RegisteredUser class has been updated accordingly in other files.
  3. Ensuring that any other methods that create or update UserDbModel instances (if they exist) are also updated to handle the new logoutUrl field.

Great job on implementing this feature!


85-86: LGTM! Verify RegisteredUser class update.

The insert method has been correctly updated to include the logoutUrl when creating a new UserDbModel. This ensures that the logout URL is properly stored in the database for each user.

To ensure full compatibility, let's verify that the RegisteredUser class has been updated to include the logoutUrl field:

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (2)

35-35: LGTM! Correct implementation of the new parameter.

The logoutUrl parameter is correctly added to the RegisteredUser constructor call, maintaining consistency with the method signature changes. The placement of the parameter is appropriate and logical.


Line range hint 1-275: Overall implementation looks good. Minor documentation improvements suggested.

The changes to add the logoutUrl parameter to the RegisteredUsers object and RegisteredUser case class have been implemented correctly and consistently. These modifications align well with the PR objectives to allow per-user logout URLs.

Key points:

  1. The create method signature has been updated to include the logoutUrl parameter.
  2. The RegisteredUser constructor call within the create method now includes the logoutUrl parameter.
  3. The RegisteredUser case class has been updated to include the logoutUrl field.

These changes provide the necessary structure to support unique logout URLs for each user, enhancing the flexibility of the system as requested in the original feature request.

To ensure that these changes are properly integrated and don't introduce any regressions, please run the following verification script:

This script will help identify any potential issues or inconsistencies in the implementation across the codebase.

✅ Verification successful

Verification Successful: logoutUrl is consistently integrated with no outstanding issues detected.

The logoutUrl parameter has been appropriately integrated across the codebase, and no unresolved TODOs related to its functionality were found. The implementation aligns with the PR objectives, ensuring that each user can have a unique logout URL without introducing regressions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of logoutUrl in the codebase

# Check for any usages of logoutUrl in the codebase
echo "Checking for usages of logoutUrl:"
rg --type scala 'logoutUrl'

# Check if there are any remaining TODOs related to logout URL functionality
echo "Checking for related TODOs:"
rg --type scala 'TODO.*logout'

# Verify that the RegisteredUser case class is used correctly
echo "Verifying RegisteredUser usage:"
rg --type scala 'case class RegisteredUser'

Length of output: 4115

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (3)

181-181: LGTM: logoutUrl property added to MeetingEndedProps

The addition of the logoutUrl property to the MeetingEndedProps interface is correct and aligns with the PR objective of introducing a custom logout URL for each user.


194-194: LGTM: logoutUrl added to MeetingEnded component props

The logoutUrl prop is correctly added to the destructured props of the MeetingEnded component, ensuring it can be accessed within the component.


Line range hint 1-516: Summary of logoutUrl implementation

The implementation of the custom logout URL feature is generally well-done and aligns with the PR objectives. Key points:

  1. The logoutUrl property is correctly added to relevant interfaces and components.
  2. The feature allows for user-specific logout URLs as intended.
  3. Placeholder replacements in the URL enhance flexibility.

Areas for improvement:

  1. Implement URL validation before using logoutUrl for redirection to enhance security.
  2. Add validation after placeholder replacements in the confirmRedirect function.
  3. Consider adding a comment explaining the source of logoutUrl in the MeetingEndedContainer for better code documentation.

Overall, the changes effectively implement the desired functionality while maintaining code quality. Addressing the suggested improvements will further enhance the security and clarity of the implementation.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (1)

54-54: 🛠️ Refactor suggestion

Consider addressing backward compatibility, validation, and documentation.

The addition of the logoutUrl parameter to the RegisterUserReqMsgBody constructor correctly implements the per-user logout URL feature as requested. However, please consider the following points:

  1. Backward Compatibility: Ensure that existing integrations that don't provide a logoutUrl won't be affected. Consider providing a default value or making it an optional parameter.

  2. Validation: Add validation for the logoutUrl parameter to ensure it's a well-formed URL.

  3. Documentation: Update the relevant documentation to reflect this new parameter and its usage.

Consider refactoring the code to address these concerns:

- excludeFromDashboard = msg.excludeFromDashboard, enforceLayout = msg.enforceLayout, logoutUrl = msg.logoutUrl, userMetadata = msg.userMetadata)
+ excludeFromDashboard = msg.excludeFromDashboard, enforceLayout = msg.enforceLayout, logoutUrl = validateUrl(msg.logoutUrl), userMetadata = msg.userMetadata)

+ def validateUrl(url: Option[String]): Option[String] = {
+   url.filter(u => Try(new URL(u)).isSuccess)
+ }

This refactoring adds a validateUrl function to ensure the logoutUrl is well-formed, and makes it an optional parameter.

To ensure this change doesn't introduce unintended side effects, please run the following script:

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2)

291-291: LGTM! Consider adding URL validation for the logoutUrl parameter.

The addition of the logoutUrl parameter to the registerUser method signature and its inclusion in the RegisterUser object creation correctly implements the per-user logout URL functionality as per the PR objectives. However, to enhance security and robustness, consider adding URL validation for the logoutUrl parameter.

Here's a suggestion for implementing URL validation:

import java.net.URL

def isValidUrl(url: String): Boolean = {
  try {
    new URL(url)
    true
  } catch {
    case _: Exception => false
  }
}

def registerUser(..., logoutUrl: String, ...): Unit = {
  require(logoutUrl.isEmpty || isValidUrl(logoutUrl), "Invalid logout URL provided")
  
  // ... rest of the method implementation
}

This validation will ensure that only valid URLs are accepted, improving the system's robustness.

To ensure that the logoutUrl is being used correctly throughout the codebase, let's run a verification script:

#!/bin/bash
# Search for usages of logoutUrl in the codebase
rg --type scala 'logoutUrl'

This will help us identify any other places where logoutUrl is used and ensure consistent handling across the application.

Also applies to: 300-301


291-291: Review the logout process across the application

The addition of the logoutUrl parameter to the user registration process is a significant change that could impact the logout flow across the application. To ensure a smooth integration of this new feature:

  1. Review all components handling user logout to ensure they use the new logoutUrl parameter.
  2. Update any relevant documentation to reflect this new functionality.
  3. If applicable, modify client-side code to handle the per-user logout URLs.

To help identify areas that might need updating, run the following script:

This will help locate areas of the codebase that deal with user logout, allowing for a comprehensive review and update of the logout process.

Also applies to: 300-301

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (3)

131-131: LGTM! Consistent with method signature change.

The update to the RegisterUser constructor call correctly includes the new logoutUrl parameter, ensuring consistency with the method signature change.


138-138: LGTM! Verify RegisteredUser class update.

The update to the RegisteredUser constructor call correctly includes the new logoutUrl parameter, maintaining consistency with the previous changes.

Please ensure that the RegisteredUser class has been updated to include the logoutUrl field and handle it properly. Run the following command to verify:

#!/bin/bash
# Search for RegisteredUser class definition and verify logoutUrl field
rg -p "class RegisteredUser" -A 20 | rg "String logoutUrl"

463-463: LGTM! Verify gw.registerUser method update.

The update to the processRegisterUser method call correctly includes the new logoutUrl parameter, maintaining consistency with the previous changes.

Please ensure that the gw.registerUser method in the gateway class has been updated to handle the new logoutUrl parameter. Run the following command to verify:

bbb-graphql-server/bbb_schema.sql (1)

Line range hint 1-17: LGTM: Initial setup and utility functions look good.

The initial setup includes creating the unaccent extension and two utility functions: immutable_lower_unaccent and remove_emojis. These functions will be useful for text processing and sorting throughout the application.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Outside diff range and nitpick comments (3)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/UrlValidationUtil.scala (1)

5-14: Add ScalaDoc comments for better documentation.

To improve code documentation and maintainability, consider adding ScalaDoc comments to the object and method.

Here's an example of how you could add ScalaDoc comments:

/**
 * Utility object for URL validation.
 */
object UrlValidationUtil {
  /**
   * Validates if the given string is a valid URL.
   *
   * @param url The string to be validated as a URL.
   * @return true if the string is a valid URL, false otherwise.
   */
  def isValidUrl(url: String): Boolean = {
    // ... (existing implementation)
  }
}
akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (1)

9-9: LGTM! Consider enhancing test coverage for non-empty logoutURL values.

The addition of the logoutURL parameter with a default empty string value is a good implementation of the new feature. It maintains backward compatibility while allowing for the new functionality.

To improve test coverage, consider adding test cases that use non-empty logoutURL values. This will ensure that the system correctly handles various logout URL scenarios.

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (1)

Line range hint 228-229: Validate logoutUrl before redirection to prevent open redirect vulnerabilities

In the sendFeedback function, window.location.href is set to logoutUrl without validation. This could expose the application to open redirect vulnerabilities if logoutUrl contains malicious content.

Add validation before redirection:

setTimeout(() => {
+  if (validator.isURL(logoutUrl)) {
     window.location.href = logoutUrl;
+  }
}, REDIRECT_WAIT_TIME);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d28496c and 427c4cb.

📒 Files selected for processing (6)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (2 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/UrlValidationUtil.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (2 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
🧰 Additional context used
🔇 Additional comments (6)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/UrlValidationUtil.scala (1)

1-3: LGTM: Package declaration and imports are correct.

The package declaration and import statement are properly structured and follow Scala conventions.

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (5)

15-15: LGTM: New import for URL validation.

The addition of the UrlvalidationUtil import is appropriate for the new URL validation logic implemented in the registerUser method.


292-292: LGTM: Updated method signature with logoutUrl parameter.

The addition of the logoutUrl parameter to the registerUser method signature aligns with the PR objectives to allow per-user logout URLs. This change enables the implementation of custom logout behavior for each user.


298-300: LGTM: Robust URL validation implemented.

The added URL validation logic ensures that the logoutUrl is either empty or a valid URL. Using require with UrlvalidationUtil.isValidUrl is a good practice for enforcing preconditions. The error message is clear and informative.


304-305: LGTM: RegisterUser object updated with logoutUrl.

The RegisterUser object creation has been correctly updated to include the new logoutUrl parameter. This change is consistent with the method signature update and aligns with the PR objectives to implement per-user logout URLs.


15-15: Summary: Well-implemented per-user logout URL feature.

The changes in this file successfully implement the per-user logout URL feature as outlined in the PR objectives. Key improvements include:

  1. Addition of the UrlvalidationUtil import for URL validation.
  2. Updated registerUser method signature with a new logoutUrl parameter.
  3. Robust URL validation logic to ensure valid logout URLs.
  4. Updated RegisterUser object creation to include the new logoutUrl parameter.

These changes are consistent, well-implemented, and follow good coding practices. The feature will allow for customized logout behavior for each user, enhancing the flexibility of the system.

Also applies to: 292-292, 298-300, 304-305

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
bigbluebutton-html5/package.json (1)

115-115: LGTM! Consider updating documentation.

The addition of the validator package (version 13.12.0) is appropriate for the new logoutURL parameter feature. This library will help ensure proper validation and sanitization of URLs.

To maintain clear documentation:

  1. Consider adding a comment in the code where validator is used, explaining its purpose in relation to the logoutURL feature.
  2. Update the project's documentation (e.g., README.md) to mention this new dependency and its role in the logoutURL feature.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 427c4cb and 39840d6.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • bigbluebutton-html5/package.json (1 hunks)
🧰 Additional context used

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1)

59-59: LGTM! Consider minor adjustment for consistency.

The addition of the logoutUrl generation is consistent with the existing code style and appropriate for creating fake test data.

For improved consistency with other URL generations in this file, consider adding a random path to the URL:

-    val logoutUrl = "https://www." + RandomStringGenerator.randomAlphanumericString(32) + ".com/";
+    val logoutUrl = "https://www." + RandomStringGenerator.randomAlphanumericString(32) + ".com/" +
+      RandomStringGenerator.randomAlphanumericString(10) + ".html"

This change would make the logoutUrl structure more similar to avatarURL and webcamBackgroundURL.

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (1)

277-279: Good use of logoutUrl with validation, but consider error handling

The implementation of logoutUrl in the confirmRedirect function, including the replacement of placeholders with user data and the use of validator.isURL for validation, is a good approach. This aligns with the PR objectives and adds a layer of security.

However, consider adding error handling for cases where the URL is invalid. Currently, if validator.isURL returns false, the function silently fails to redirect. You might want to log this event or provide a fallback URL.

Consider adding error handling:

 if (validator.isURL(redirectTo)) {
   window.location.href = redirectTo;
+} else {
+  console.error('Invalid logout URL:', redirectTo);
+  // Optionally, redirect to a default URL or show an error message
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 39840d6 and 8a92db4.

📒 Files selected for processing (5)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/UrlValidationUtil.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (2 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/util/UrlValidationUtil.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
🧰 Additional context used
🔇 Additional comments (6)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1)

62-62: LGTM! Verify RegisteredUsers.create method signature.

The addition of the logoutUrl parameter to the RegisteredUsers.create method call is consistent with the PR objectives to allow per-user logout URLs.

To ensure the change is correctly implemented, please verify the RegisteredUsers.create method signature in the corresponding file. Run the following script to check the method signature:

This will help confirm that the logoutUrl parameter has been added to the method signature and that the Map() parameter has been correctly replaced or removed.

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (5)

8-8: Good addition of URL validator

The import of the 'validator' library is a positive step towards ensuring the validity and security of custom logout URLs. This aligns well with the PR objectives and helps prevent potential security issues related to URL handling.


182-182: Appropriate interface update for logoutUrl

The addition of the logoutUrl property to the MeetingEndedProps interface is consistent with the PR objectives. This change ensures type safety and proper integration of the new feature into the component's props.


195-195: Correct integration of logoutUrl prop

The addition of logoutUrl to the destructured props of the MeetingEnded component ensures that the custom logout URL is properly accessible within the component. This change is in line with the PR objectives and enables the implementation of per-user logout URLs.


457-457: Correct integration of logoutUrl in MeetingEndedContainer

The addition of the logoutUrl prop to the MeetingEnded component calls within MeetingEndedContainer is implemented correctly. The use of an empty string as a default value during loading or error states is appropriate. The retrieval of logoutUrl from user_current[0] aligns well with the PR objectives of providing a per-user logout URL.

These changes ensure that the custom logout URL is properly passed down from the container to the presentational component, maintaining the component hierarchy and data flow.

Also applies to: 475-475, 487-487, 515-515


Line range hint 1-520: Overall implementation of logoutUrl is well-executed

The changes introduced in this file effectively implement the per-user logout URL feature as outlined in the PR objectives. The logoutUrl parameter is consistently integrated across the component hierarchy, from props to usage in the redirect logic. The addition of URL validation enhances security.

While the implementation is generally solid, consider the suggested improvement for error handling in the confirmRedirect function to make the code more robust.

Great job on this feature implementation!

@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@jaapjansma

Copy link
Copy Markdown
Contributor Author

I have resolved the conflicting changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (8)
bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1)

26-26: Consider adding Javadoc to document parameter constraints.

The logoutUrl parameter would benefit from documentation specifying:

  • Whether null/empty values are allowed
  • Any URL format requirements or restrictions
  • Example usage

Add Javadoc above the method:

/**
 * Register a user for a meeting.
 * @param logoutUrl The URL where the user will be redirected after logout. 
 *                 Can be null/empty to use the default logout URL.
 *                 Must be a valid URL if provided.
 */
bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (1)

24-24: Add Javadoc to document the logoutUrl field.

Consider adding documentation to explain:

  • The purpose of this field
  • Expected format/constraints
  • Relationship with user roles (moderator vs viewer URLs)

Add documentation like this:

+/**
+ * Custom URL where the user will be redirected after logout.
+ * Different URLs can be set based on user roles (e.g., moderator vs viewer).
+ */
public final String logoutUrl;
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

21-21: Consider adding URL validation for the logoutUrl parameter.

The addition of logoutUrl parameter aligns with the PR objectives. However, since this is a URL parameter, consider adding validation to ensure it's a valid URL format and follows any security requirements (e.g., HTTPS only, allowed domains).

You could add URL validation in the handleRegisterUser method:

import java.net.URL
import scala.util.Try

def handleRegisterUser(msg: RegisterUser): Unit = {
  // Validate logout URL if present
  if (msg.logoutUrl.nonEmpty) {
    Try(new URL(msg.logoutUrl)).getOrElse {
      log.warning(s"Invalid logout URL format: ${msg.logoutUrl}")
      // Consider how to handle invalid URLs - throw exception or use default?
    }
  }
  sendRegisterUserRequestToAkkaApps(msg)
}
bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1)

77-79: Consider adding JavaDoc documentation.

The interface methods would benefit from JavaDoc documentation describing the parameters, especially the new logoutUrl parameter. This would help implementers understand the expected format and usage.

Example addition:

/**
 * Registers a user in a meeting.
 * 
 * @param meetingID The unique identifier of the meeting
 * ...
 * @param enforceLayout The layout to enforce for the user
 * @param logoutUrl Custom URL where the user will be redirected after logout
 * @param userMetadata Additional metadata for the user
 */
void registerUser(String meetingID, ...);
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (1)

10-11: LGTM! Consider documenting nullability requirements.

The logoutUrl parameter has been correctly added to the method signature and constructor call. However, it would be helpful to document whether this parameter can be null/empty and how such cases should be handled.

Also applies to: 36-38

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (1)

302-303: LGTM! URL validation implemented correctly.

The implementation properly validates the logout URL while maintaining backward compatibility by allowing empty URLs.

Consider adding unit tests to verify the URL validation behavior, especially edge cases like:

  • Empty URLs
  • Valid URLs with different schemes (http, https)
  • Invalid URLs
  • Malformed URLs
    Would you like me to help create these tests?
bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (1)

589-589: Consider adding URL validation for logoutUrl parameter.

While the logoutUrl parameter is correctly propagated to the gateway, it would be beneficial to validate the URL format before processing to ensure it's a well-formed URL.

Consider adding URL validation before processing:

 private void processRegisterUser(RegisterUser message) {
+    if (message.logoutUrl != null && !message.logoutUrl.isEmpty()) {
+        try {
+            new URL(message.logoutUrl);
+        } catch (MalformedURLException e) {
+            log.warn("Invalid logoutUrl format: {}", message.logoutUrl);
+        }
+    }
     gw.registerUser(message.meetingID,
       message.internalUserId, message.fullname, message.role,
       message.externUserID, message.authToken, message.sessionToken, message.avatarURL, message.webcamBackgroundURL, message.bot,
       message.guest, message.authed, message.guestStatus, message.excludeFromDashboard, message.enforceLayout, message.logoutUrl, message.userMetadata);
 }
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (1)

419-424: Enhance error handling and logging.

Consider improving error handling and logging:

  1. Add specific error cases for invalid URLs
  2. Include security-related logging
  3. Consider adding metrics for URL validation failures
 String logoutUrl = meeting.getLogoutUrl()
 if(!StringUtils.isEmpty(params.get(ApiParams.LOGOUT_URL))) {
+  try {
     logoutUrl = params.get(ApiParams.LOGOUT_URL)
+    log.info("Custom logout URL set for user {} in meeting {}", 
+             params.get("userID"), params.get("meetingID"))
+  } catch (Exception e) {
+    log.error("Failed to set custom logout URL: {}", e.getMessage())
+    // Use default URL from meeting
+  }
 }
-log.debug "The following logout URL is present: " + logoutUrl
+log.info("Logout URL for user {} set to: {}", 
+         params.get("userID"), logoutUrl)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8a92db4 and d5b4c35.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (2 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (2 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1 hunks)
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (2 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1 hunks)
  • bbb-graphql-server/bbb_schema.sql (2 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (8 hunks)
  • bigbluebutton-html5/package.json (1 hunks)
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (3 hunks)
🧰 Additional context used
📓 Learnings (1)
bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)
Learnt from: jaapjansma
PR: bigbluebutton/bigbluebutton#21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
🔇 Additional comments (33)
bbb-common-web/src/main/java/org/bigbluebutton/api/pub/IPublisherService.java (1)

26-26: LGTM! The parameter addition aligns with the feature requirements.

The addition of the logoutUrl parameter to the registerUser method signature correctly implements the per-user logout URL feature requested in issue #20285.

bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/RegisterUser.java (2)

24-24: LGTM! The logoutUrl integration follows the existing patterns.

The changes maintain consistency with the existing codebase structure and naming conventions.

Also applies to: 30-30, 47-47


24-24: Consider adding input validation for the logoutUrl.

While this class serves as a message container, consider implementing URL validation at the service layer to ensure:

  1. The URL is well-formed
  2. The URL follows security policies (e.g., allowed domains)
  3. Protection against XSS or open redirect vulnerabilities

Let's check if URL validation exists in the codebase:

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala (1)

33-33: LGTM! Verify URL validation.

The addition of logoutUrl to the message body is implemented correctly and follows the existing parameter passing pattern.

Let's verify the URL validation logic mentioned in the summary:

✅ Verification successful

URL validation is properly implemented

The logoutUrl parameter is validated in two places:

  • In BbbWebApiGWApp.scala using UrlValidationUtil.isValidUrl() before registering the user
  • In MsgBuilder.scala using the same validation before including it in the message body

The validation ensures:

  • URL is not null or empty
  • URL has valid protocol (http/https)
  • URL has valid format
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify URL validation implementation in MsgBuilder
# Expected: Find URL validation logic for logoutUrl parameter

# Search for URL validation in MsgBuilder
rg -A 5 "logoutUrl.*validation" 

# Alternatively, look for the MsgBuilder class implementation
ast-grep --pattern 'class MsgBuilder {
  $$$
  validate($$$logoutUrl$$$) {
    $$$
  }
  $$$
}'

Length of output: 131


Script:

#!/bin/bash
# Let's try a broader search for URL validation patterns and logoutUrl handling

# Search for files containing logoutUrl
rg -l "logoutUrl"

# Search for URL validation patterns
rg -A 5 "validateURL|isValidUrl|urlValidator"

# Search for MsgBuilder class with broader context
fd "MsgBuilder.scala" --exec cat {}

Length of output: 59640

bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala (1)

21-21: Verify handling of null/empty logoutUrl values.

Since this parameter affects the logout flow, it's important to ensure proper handling of cases where logoutUrl is null or empty.

✅ Verification successful

Proper null/empty logoutUrl handling is verified

The codebase shows proper handling of logoutUrl:

  • Input validation through require(logoutUrl.isEmpty || UrlValidationUtil.isValidUrl(logoutUrl))
  • Null/empty checks with fallback to empty string: if (msg.logoutUrl != null && !msg.logoutUrl.isEmpty && UrlValidationUtil.isValidUrl(msg.logoutUrl))
  • Database layer handles empty values by converting empty strings to None: case "" => None
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how null/empty logoutUrl values are handled

# Search for null checks or default value assignments for logoutUrl
echo "Searching for logoutUrl null/empty handling:"
rg --type scala "logoutUrl\s*(==|!=|\.isEmpty|\.nonEmpty|\.getOrElse|match)"

# Search for default logout URL configuration
echo "\nSearching for default logout URL configuration:"
rg --type-add 'config:*.{conf,properties,xml}' --type config "logout.*url"

Length of output: 859


Script:

#!/bin/bash
# Let's check the implementation details around logoutUrl validation and handling

# Check the UrlValidationUtil implementation
echo "Checking UrlValidationUtil implementation:"
rg -A 5 "class UrlValidationUtil"

# Check how logoutUrl is used in MsgBuilder
echo "\nChecking logoutUrl usage in MsgBuilder:"
rg -A 10 "logoutUrl" "bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala"

# Check MeetingDAO implementation for logoutUrl handling
echo "\nChecking MeetingDAO logoutUrl handling:"
rg -A 5 "logoutUrl = meetingProps" "akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MeetingDAO.scala"

Length of output: 2366

akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala (3)

9-9: LGTM: Method signature change is well-implemented.

The addition of the logoutURL parameter with a default empty string value maintains backward compatibility while supporting the new per-user logout URL feature.


22-22: Parameter casing inconsistency was previously identified.

The inconsistency between logoutURL (parameter) and logoutUrl (usage) remains to be addressed.


Line range hint 9-22: Test coverage enhancement was previously suggested.

The implementation would benefit from additional test cases using non-empty logout URLs, as mentioned in previous reviews.

bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java (1)

78-78: LGTM! The signature change aligns with requirements.

The addition of the logoutUrl parameter to registerUser correctly implements the per-user logout URL feature requested in issue #20285. The parameter placement is logical, maintaining consistency with other URL-related parameters.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala (2)

37-37: ⚠️ Potential issue

Implementation appears incomplete for the logoutURL feature.

The RegisteredUsers.create call has been modified to accommodate new parameters, but the logoutUrl parameter isn't being passed. This could lead to compilation errors or incorrect behavior.

Let's verify the RegisteredUsers.create signature and its usages:


36-38: Consider role-based logout URL handling.

According to the PR objectives, this feature is needed to provide different logout URLs for moderators vs viewers. However, this implementation always sets the role to Roles.VIEWER_ROLE which may not fulfill the requirement.

Let's verify if there are other places handling moderator registration:

bigbluebutton-html5/package.json (1)

116-116: LGTM! Good choice for URL validation.

The addition of the validator package is appropriate for implementing secure URL validation for the custom logout URLs feature. This is a well-maintained package that will help prevent open redirect vulnerabilities.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/RegisterUserReqMsgHdlr.scala (1)

63-63: LGTM! Verify integration with RegisteredUsers.

The addition of logoutUrl parameter to RegisteredUsers.create correctly implements the per-user logout URL functionality as specified in the PR objectives.

Let's verify the integration with the RegisteredUsers class:

✅ Verification successful

Integration with RegisteredUsers is properly implemented

The verification confirms that:

  • The RegisteredUser case class in RegisteredUsers.scala has the logoutUrl field properly defined
  • The RegisteredUsers.create method accepts the logoutUrl parameter and correctly passes it to the RegisteredUser constructor
  • The implementation aligns with the PR's objective of adding per-user logout URL functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that RegisteredUsers class properly handles the logoutUrl parameter
# Test: Search for RegisteredUsers class definition and create method
ast-grep --pattern $'case class RegisteredUser(
  $$$
  logoutUrl: $_
  $$$
)'

# Test: Verify that RegisteredUsers.create method accepts logoutUrl parameter
ast-grep --pattern $'def create(
  $$$
  logoutUrl: $_
  $$$
): RegisteredUser'

Length of output: 160


Script:

#!/bin/bash
# Let's try a different approach using ripgrep to find the RegisteredUser class and its usage
rg -A 20 "case class RegisteredUser" 

# Also search for RegisteredUsers object/class definition
rg -A 20 "object RegisteredUsers|class RegisteredUsers"

Length of output: 13033


Script:

#!/bin/bash
# Let's search for the logoutUrl field in RegisteredUser case class
rg -A 30 "case class RegisteredUser\(" akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala

Length of output: 1211

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserDAO.scala (3)

27-27: LGTM! Good choice of default value.

The addition of logoutUrl with a default empty string maintains backward compatibility while supporting the new feature.


35-35: Consider adding database constraints for the logoutUrl field.

While the table definition is correct, consider:

  1. Adding a maximum length constraint to prevent extremely long URLs
  2. Ensuring a database migration script exists for adding this column to existing tables

Let's check for migration scripts:

Also applies to: 57-57


88-89: Verify URL validation implementation.

The insert method accepts the logoutUrl without validation. While the PR mentions URL validation in BbbWebApiGWApp.scala, let's verify its implementation:

✅ Verification successful

Let me gather more information about the URL validation implementation.


URL validation is properly implemented

The logoutUrl is validated at multiple layers:

  • In BbbWebApiGWApp.scala, there's a validation check using require(logoutUrl.isEmpty || UrlValidationUtil.isValidUrl(logoutUrl))
  • The UrlValidationUtil.isValidUrl() implementation ensures:
    • URL is not null
    • URL is properly formatted (via URL class parsing)
    • Protocol is either HTTP or HTTPS

The validation occurs before the URL reaches the DAO layer, making it safe to store without additional validation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Look for URL validation implementation
rg -A 5 "logoutUrl.*valid" 
ast-grep --pattern 'def $_(logoutUrl: String) {
  $$$
}'

Length of output: 1069


Script:

#!/bin/bash
# Look for UrlValidationUtil implementation
rg -A 10 "class UrlValidationUtil" 
rg -A 10 "object UrlValidationUtil"

# Look for other URL validation related code
rg -A 5 "isValidUrl"

Length of output: 3911

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (1)

Line range hint 109-117: Verify database schema updates and migration strategy.

The changes to RegisteredUser affect database operations through UserDAO. Please ensure that:

  1. The database schema has been updated to accommodate the new logoutUrl field
  2. A migration strategy exists for existing users
  3. The documentation in PR #21205 covers these database changes
✅ Verification successful

Based on the search results, I can generate the final response as we have sufficient information about the database schema and implementation.

Database schema and implementation are properly handled.

The changes to RegisteredUser with the logoutUrl field are properly accommodated:

  • Database schema is updated in bbb-graphql-server/bbb_schema.sql with logoutUrl varchar(500)
  • Field is properly integrated in UserDAO.scala with corresponding column definition and mapping
  • Default empty string value is provided in UserDAO.insert for backward compatibility
  • URL validation is implemented in BbbWebApiGWApp.scala before persistence
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for database schema updates and migrations
rg -g '*.sql' -g '*.scala' 'logoutUrl' 

Length of output: 4973

bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (3)

8-8: LGTM: Import and interface changes are well-structured

The validator import and interface updates are correctly implemented to support the per-user logout URL feature.

Also applies to: 182-182


195-195: LGTM: Proper prop handling for logoutUrl

The logoutUrl prop is correctly destructured and consistently used throughout the component.


457-457: LGTM: Verify logoutUrl data flow

The logoutUrl initialization and data flow are properly implemented with appropriate fallbacks for loading and error states.

Let's verify the logoutUrl data flow in the GraphQL schema and resolvers:

Also applies to: 475-475, 487-487, 515-515

✅ Verification successful

Let me try another search strategy to verify the logoutUrl data flow.


Based on the search results, I can now verify the logoutUrl data flow. The code shows:

  1. The logoutUrl is properly defined in the GraphQL schema (queries.ts)
  2. It's correctly passed through the user_current data in getMeetingEndData query
  3. The component handles loading/error states with empty string fallback
  4. The logoutUrl is used in multiple components and services with proper type definitions
  5. The backend systems (bbb-web, akka-apps) properly handle and validate the logoutUrl

Verified: logoutUrl data flow is implemented correctly

The initialization with empty string for loading/error states is a proper fallback pattern, and the actual logoutUrl value is correctly passed from the GraphQL query when data is available. The implementation follows the expected data flow pattern throughout the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check GraphQL schema and resolver implementations for logoutUrl
rg -A 5 'type.*User.*{' | rg -A 10 'logoutUrl'
rg -A 5 'getMeetingEndData'

Length of output: 2322


Script:

#!/bin/bash
# Search for logoutUrl in GraphQL schema files
fd schema.ts --exec rg -A 5 'type.*User' {} \;

# Search for logoutUrl in resolver implementations
rg -A 5 'logoutUrl'

# Search for any other relevant files that might handle logoutUrl
fd -e ts -e js --exec rg -l 'logoutUrl' {} \;

Length of output: 71595

bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (3)

9-9: LGTM! Import added for URL validation.

The addition of UrlValidationUtil import is appropriate for the new URL validation functionality.


63-63: LGTM! Logout URL parameter added correctly.

The logoutUrl parameter is correctly added to the RegisterUserReqMsgBody constructor, maintaining consistency with the existing parameter pattern.


49-63: Verify consistent URL validation across the codebase.

Let's ensure that URL validation is consistently applied across the codebase for similar scenarios.

✅ Verification successful

URL validation is consistently implemented for logout URLs

The verification shows that URL validation is properly implemented in two key locations:

  • BbbWebApiGWApp.scala: Validates logout URL at the API gateway level using require
  • MsgBuilder.scala: Validates logout URL before message construction

The RegisterUserReqMsgBody construction is consistent across both implementations in:

  • MsgBuilder.scala: Uses validated logoutUrl
  • ToAkkaAppsSendersTrait.scala: Uses msg.logoutUrl which is pre-validated by BbbWebApiGWApp
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for other URL validation usage patterns
echo "Checking URL validation patterns:"
rg "UrlValidationUtil.isValidUrl" -A 2

# Check for other instances of RegisterUserReqMsgBody construction
echo "Checking RegisterUserReqMsgBody usage:"
ast-grep --pattern 'RegisterUserReqMsgBody($$$)'

Length of output: 3065

bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala (1)

296-296: LGTM! Parameter handling implemented correctly.

The logoutUrl parameter is consistently handled in both the method signature and the RegisterUser constructor call.

Also applies to: 309-309

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

12-12: LGTM! Addition of logoutUrl parameter aligns with requirements.

The addition of the logoutUrl parameter to RegisterUserReqMsgBody implements the per-user logout URL feature as specified in issue #20285.

Let's verify the impact on existing code:

✅ Verification successful

All RegisterUserReqMsgBody instantiations have been properly updated with the logoutUrl parameter

The code search reveals that all instances where RegisterUserReqMsgBody is constructed already include the logoutUrl parameter in the correct position:

  • In MsgBuilder.scala: logoutUrl = logoutUrl
  • In ToAkkaAppsSendersTrait.scala: logoutUrl = msg.logoutUrl
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for RegisterUserReqMsgBody instantiations that need to be updated
ast-grep --pattern 'RegisterUserReqMsgBody($$$)'

Length of output: 2077

bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (3)

139-139: LGTM: Method signature updated to support per-user logout URL.

The logoutUrl parameter has been added to the registerUser method signature in an appropriate position.


143-144: LGTM: Proper propagation of logoutUrl to RegisterUser message.

The logoutUrl parameter is correctly passed to the RegisterUser message constructor.


150-150: LGTM: Proper propagation of logoutUrl to RegisteredUser constructor.

The logoutUrl parameter is correctly passed to the RegisteredUser constructor.

bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (2)

419-424: LGTM! Proper handling of logout URL override.

The implementation correctly:

  1. Gets the default logout URL from the meeting
  2. Allows override via request parameter
  3. Includes debug logging

453-453: LGTM! Clean integration with existing flow.

The changes properly integrate the logout URL handling into the existing join and registration flow without disrupting current functionality.

Also applies to: 518-518

bbb-graphql-server/bbb_schema.sql (3)

286-286: LGTM: Appropriate column definition for logoutUrl.

The logoutUrl column is correctly defined with:

  • Appropriate type (varchar) and length (500) for storing URLs
  • Nullable constraint allowing optional custom logout URLs
  • Logical placement with other user-specific URL fields

477-477: LGTM: Appropriate exposure of logoutUrl in user view.

The logoutUrl is correctly exposed in the v_user_current view, which is the appropriate view for current user information. This aligns with the PR objective of supporting per-user logout URLs.


286-286: Consider adding URL validation for security.

To prevent security issues like open redirects, consider:

  1. Adding a CHECK constraint or trigger to validate the URL format
  2. Implementing URL validation in the application layer
  3. Ensuring URLs are properly sanitized before storage

Also applies to: 477-477

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (1)

428-428: Fix indentation.

The closing brace has incorrect indentation.

-  }
+    }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d5b4c35 and d747b38.

📒 Files selected for processing (4)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala (1 hunks)
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala (2 hunks)
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
🔇 Additional comments (3)
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (3)

40-40: LGTM: Import added for URL validation.

The import of UrlValidationUtil is appropriately placed and will be used for validating the logout URL.


420-431: LGTM: Per-user logout URL implementation.

The implementation correctly:

  • Uses meeting's logout URL as default
  • Validates user-provided URL
  • Falls back to default URL if validation fails
  • Logs the final URL used

525-525: LGTM: Added logout URL to user registration.

The logout URL is correctly passed to the user registration method.

@gustavotrott

Copy link
Copy Markdown
Contributor

I sent a PR with a fix to the failing automated-tests step, can you take a look @jaapjansma ?

jaapjansma#1

Small fixes for end meeting
@jaapjansma

Copy link
Copy Markdown
Contributor Author

@gustavotrott thanks!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (5)
docs/docs/data/join.tsx (2)

70-75: Consider consistent parameter naming.

The parameter structure and description are well-documented. However, for consistency with the existing errorRedirectUrl parameter, consider using logoutUrl instead of logoutURL.

-    "name": "logoutURL",
+    "name": "logoutUrl",

74-74: Enhance documentation with role-specific examples.

Given that a key use case is providing different logout URLs for moderators and viewers (as mentioned in the PR description), consider enhancing the description with examples:

-    "description": (<>A custom URL to redirect client when the user click on OK button in the meeting ended screen. By default users are redirected to the meeting's default logout URL.</>)
+    "description": (<>A custom URL to redirect client when the user click on OK button in the meeting ended screen. This enables role-specific redirection - for example, moderators can be directed to a feedback form while viewers are sent to a thank you page. By default users are redirected to the meeting's default logout URL.</>)
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (2)

459-459: Add documentation for the logoutUrl field

The logoutUrl field's purpose and usage should be documented for better code maintainability.

Consider adding a comment explaining the field's purpose:

+    // Custom logout URL for this user session, falls back to meeting's logout URL if not specified
     us.logoutUrl = logoutUrl

524-524: Consider refactoring the registerUser method to use a builder pattern

The registerUser method has 17 parameters, which makes it hard to maintain and prone to errors. The addition of logoutUrl further increases this complexity.

Consider creating a UserRegistrationParams class to encapsulate these parameters:

class UserRegistrationParams {
    String meetingID
    String internalUserId
    String fullname
    String role
    String externUserID
    String authToken
    String sessionToken
    String avatarURL
    String webcamBackgroundURL
    Boolean bot
    Boolean guest
    Boolean authed
    String guestStatus
    Boolean excludeFromDashboard
    Boolean leftGuestLobby
    String enforceLayout
    String logoutUrl
    Map<String, String> userCustomData
    
    static class Builder {
        // ... builder methods
    }
}

Then refactor the method call to:

def params = new UserRegistrationParams.Builder()
    .meetingID(us.meetingID)
    .internalUserId(us.internalUserId)
    // ... set other parameters
    .logoutUrl(us.logoutUrl)
    .userCustomData(meeting.getUserCustomData(us.externUserID))
    .build()
    
meetingService.registerUser(params)
bbb-graphql-server/bbb_schema.sql (1)

286-286: LGTM! Consider URL validation at the application level.

The logoutUrl column is well-defined with an appropriate data type and placement. While the schema definition is correct, ensure that URL validation is implemented at the application level to maintain data integrity.

Consider implementing URL validation in the application layer to ensure:

  • Valid URL format
  • Allowed protocols (e.g., https)
  • Maximum length within 500 characters
  • Protection against malicious URLs
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3e85f2c and 36b3f87.

⛔ Files ignored due to path filters (1)
  • bigbluebutton-html5/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (2 hunks)
  • bbb-graphql-server/bbb_schema.sql (2 hunks)
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (2 hunks)
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx (8 hunks)
  • bigbluebutton-html5/package.json (2 hunks)
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (3 hunks)
  • docs/docs/data/join.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • bigbluebutton-html5/imports/ui/components/meeting-ended/component.tsx
  • bigbluebutton-html5/package.json
🔇 Additional comments (6)
bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (3)

167-167: LGTM: Permission correctly added for bbb_client role

The logoutUrl column is properly added to the select permissions with appropriate row-level security filters in place.


214-214: LGTM: Permission correctly added for bbb_client_not_in_meeting role

The logoutUrl column is appropriately added to the limited set of permissions for users not in meetings, maintaining proper access control.


167-167: Consider implementing URL validation and security measures

While the permissions are correctly configured, consider implementing these additional security measures:

  1. URL validation to prevent malicious URLs
  2. URL allowlist/blocklist mechanism
  3. Logging of URL changes for security auditing
  4. Rate limiting for URL updates

This will help ensure the safety of the logout redirection process.

Let's check if URL validation is implemented elsewhere:

Also applies to: 214-214

✅ Verification successful

URL validation is implemented but could be strengthened

The codebase already implements basic URL validation through ValidationService.isValidURL(), which is used for logout URLs as evidenced in BbbWebApiGWApp.scala. However, the current implementation only checks for URL syntax validity using Java's URL/URI parsing.

To enhance security, consider strengthening the validation by:

  • Adding URL scheme restrictions (e.g., only https://)
  • Implementing domain allowlisting
  • Adding protection against SSRF attacks
  • Including validation for URL length and character set
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for URL validation patterns in the codebase
rg -i "validateurl|urlvalidation|isvalidurl" 

# Search for security-related configurations
fd -t f "security|config" -x rg -l "url.*(valid|allow|block|whitelist|blacklist)"

Length of output: 922


Script:

#!/bin/bash
# Let's examine the URL validation implementation
ast-grep --pattern 'isValidURL($$$)' 

# Check for any URL security patterns in the validation service
rg -A 10 "isValidURL" bbb-common-web/src/main/java/org/bigbluebutton/api/service/ValidationService.java

Length of output: 1020

bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy (1)

419-429: 🛠️ Refactor suggestion

Enhance URL validation and error handling for logout URLs

The current implementation has several areas that could be improved:

  1. URL validation should happen before any assignment
  2. Error handling should be more robust than just logging
  3. URL sanitization is missing
  4. Logging is inconsistent (debug vs warn)

Consider this safer implementation:

 String logoutUrl = meeting.getLogoutUrl()
 if(!StringUtils.isEmpty(params.get(ApiParams.LOGOUT_URL))) {
   String userProvidedUrl = StringUtils.strip(params.get(ApiParams.LOGOUT_URL))
   ValidationService validationService = ServiceUtils.getValidationService()
   if(!validationService.isValidURL(userProvidedUrl)) {
     log.warn("Invalid logout URL provided [meetingId={}]: {}", meeting.getInternalId(), userProvidedUrl)
     // Keep default URL from meeting
   } else {
     logoutUrl = userProvidedUrl
     log.info("Custom logout URL set for meeting [{}]: {}", meeting.getInternalId(), logoutUrl)
   }
 }

Likely invalid or redundant comment.

bbb-graphql-server/bbb_schema.sql (2)

477-477: LGTM! The view modification is correct.

The logoutUrl column is properly exposed through the v_user_current view, maintaining consistency with the base table and following the existing pattern for user attributes.


286-286: Verify schema compatibility and constraints.

Let's verify that the schema changes are complete and won't cause issues with existing functionality.

Also applies to: 477-477

✅ Verification successful

Schema changes for logoutUrl are consistent and safe

The verification shows:

  • The logoutUrl column uses varchar(500) which is consistent with other URL columns in the schema
  • No foreign key constraints or indexes are impacted by this change
  • The URL validation is handled at the application level through ValidationService.isValidURL()
  • No schema-level constraints or triggers are affected
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify schema compatibility and look for potential issues

# Check for any foreign key constraints or indexes referencing the user table
echo "Checking for dependencies on the user table..."
rg -A 5 'REFERENCES "user"' 

# Look for any URL-related columns to ensure consistent data types
echo "Checking URL column definitions for consistency..."
rg 'url.*varchar' -i

# Check for any potential validation or trigger functions that might need updating
echo "Checking for URL validation functions..."
rg 'isValidURL|validateURL|checkURL' -i

Length of output: 16556

Comment on lines +419 to +429
String logoutUrl = meeting.getLogoutUrl()
if(!StringUtils.isEmpty(params.get(ApiParams.LOGOUT_URL))) {
String userProvidedUrl = params.get(ApiParams.LOGOUT_URL)
if(!ServiceUtils.getValidationService().isValidURL(userProvidedUrl)) {
log.warn("Invalid logout URL provided: " + userProvidedUrl)
// Use default URL from meeting
} else {
logoutUrl = params.get(ApiParams.LOGOUT_URL)
log.debug "The following logout URL is present: " + logoutUrl
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Security improvements needed for URL validation

The URL validation implementation in ValidationService.java only performs basic syntax validation using URL and URI classes, which is insufficient for security. Current implementation lacks:

  • Protocol restrictions (allows any protocol including javascript:, data:)
  • Domain allowlisting
  • Protection against open redirects
  • XSS prevention

Recommended changes:

  • Add protocol whitelist (http/https only)
  • Implement domain allowlisting
  • Add checks for common attack patterns in URLs
  • Consider using a security library like OWASP's URL Validator

Location:

  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/ValidationService.java
🔗 Analysis chain

Verify URL validation implementation for security

The current URL validation needs to be verified to ensure it properly protects against:

  1. Open redirect vulnerabilities
  2. Protocol restrictions (e.g., only http/https)
  3. Domain allowlisting
  4. XSS through javascript: URLs

Let's verify the URL validation implementation:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check URL validation implementation
# Expected: Find URL validation method to verify security measures

# Search for URL validation implementation
rg -A 10 "isValidURL|validateURL" 

# Search for any URL-related security measures
ast-grep --pattern 'class ValidationService {
  $$$
  isValidURL($url) {
    $$$
  }
  $$$
}'

Length of output: 7581

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@gustavotrott

Copy link
Copy Markdown
Contributor

The URL validation makes the placeholders like %%USERNAME%% stop working for logoutURL parameter.

Maybe we can accept the PR as is, and refactor the code to handle this cases.
Once each user will have a prop logoutUrl, we can apply the placeholders values in the backend and the front don't need to handle it anymore.
Thoughts @lfzawacki ?

@jaapjansma

Copy link
Copy Markdown
Contributor Author

If needed I am happy to create a follow up PR fixing this issue

@antobinary antobinary changed the title Allow per user logout url feat: Allow per user logout url Nov 27, 2024
@gustavotrott

Copy link
Copy Markdown
Contributor

If needed I am happy to create a follow up PR fixing this issue

That would be great!
Thank you

@gustavotrott
gustavotrott merged commit dec74c1 into bigbluebutton:v3.0.x-release Nov 27, 2024
@lfzawacki

Copy link
Copy Markdown
Contributor

The URL validation makes the placeholders like %%USERNAME%% stop working for logoutURL parameter.

Maybe we can accept the PR as is, and refactor the code to handle this cases. Once each user will have a prop logoutUrl, we can apply the placeholders values in the backend and the front don't need to handle it anymore. Thoughts @lfzawacki ?

It makes sense, the reason I didn't do the substitution on the back end is because by the point we generated the logoutUrl we did not have access to all the data we needed. Doing it on a per user basis should make it possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow per-user logoutURL

4 participants