Skip to content

Fix invitations by regular occupants in members-only rooms - #3457

Open
sangbingxing wants to merge 1 commit into
igniterealtime:mainfrom
sangbingxing:fix/muc-member-invites-members-only
Open

Fix invitations by regular occupants in members-only rooms#3457
sangbingxing wants to merge 1 commit into
igniterealtime:mainfrom
sangbingxing:fix/muc-member-invites-members-only

Conversation

@sangbingxing

Copy link
Copy Markdown

Problem

A regular room occupant can pass the invitation authorization check when muc#roomconfig_allowinvites is enabled. In a members-only room, Openfire then tries to add the invitee as a member using the inviter's member affiliation. MUCRoom.addMember requires an admin or owner affiliation, which rejects the invitation with forbidden.

Change

When occupant invitations are enabled, add the invitee on behalf of the room, whose self-representation has owner affiliation. When occupant invitations are disabled, retain the inviter's affiliation so the existing admin/owner permission check remains in effect. The actual inviter JID and affiliation are still passed to sendInvitation.

Add regression coverage for both configuration states.

Testing

  • mvnw.cmd -pl xmppserver -am -Dtest=MultiUserChatServiceImplTest -Dsurefire.failIfNoSpecifiedTests=false test
  • mvnw.cmd -pl xmppserver -am test (2068 tests, 0 failures, 0 errors, 3 skipped)

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a37b7263-94ed-420b-9ef0-e62b0e9df14d

📥 Commits

Reviewing files that changed from the base of the PR and between 94886ab and a2c3201.

📒 Files selected for processing (2)
  • xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImpl.java
  • xmppserver/src/test/java/org/jivesoftware/openfire/muc/spi/MultiUserChatServiceImplTest.java

📝 Walkthrough

Walkthrough

Members-only room invitations now delegate invitee membership assignment to addInviteeAsMember. The helper uses the room self occupant’s affiliation when occupant invitations are allowed and the inviter’s affiliation otherwise. Mockito tests cover both affiliation paths.

Suggested reviewers: guusdk

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the members-only MUC invitation fix and corresponding regression tests, matching the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant