Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable deletion for federated users #32852

Merged
merged 12 commits into from
Aug 14, 2024
Merged

fix: disable deletion for federated users #32852

merged 12 commits into from
Aug 14, 2024

Conversation

debdutdeb
Copy link
Member

@debdutdeb debdutdeb commented Jul 21, 2024

Proposed changes (including videos or screenshots)

This PR disables the possibility of delete federated users.

Issue(s)

Steps to test or reproduce

Further comments

CORE-519

Copy link
Contributor

dionisio-bot bot commented Jul 21, 2024

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

Copy link

changeset-bot bot commented Jul 21, 2024

🦋 Changeset detected

Latest commit: e968252

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

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

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

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

Copy link

codecov bot commented Jul 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.40%. Comparing base (19824bd) to head (e968252).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #32852   +/-   ##
========================================
  Coverage    59.40%   59.40%           
========================================
  Files         2541     2541           
  Lines        63181    63181           
  Branches     14222    14222           
========================================
  Hits         37531    37531           
  Misses       22935    22935           
  Partials      2715     2715           
Flag Coverage Δ
unit 76.04% <ø> (ø)

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

@debdutdeb debdutdeb marked this pull request as ready for review July 21, 2024 21:42
@debdutdeb debdutdeb requested a review from a team as a code owner July 21, 2024 21:42
@debdutdeb debdutdeb added this to the 6.11 milestone Jul 21, 2024
@Gustrb
Copy link
Contributor

Gustrb commented Jul 22, 2024

Could you add API tests to assure the fix??

.changeset/empty-toys-smell.md Outdated Show resolved Hide resolved
apps/meteor/server/methods/deleteUser.ts Outdated Show resolved Hide resolved
@casalsgh casalsgh modified the milestones: 6.11, 6.12 Jul 22, 2024
@debdutdeb debdutdeb marked this pull request as draft July 29, 2024 07:05
@debdutdeb
Copy link
Member Author

@Gustrb I don't think we can.

a federated user (user.federated === true) can not be created externally. This kind of record is internally created.

public static createLocalInstanceOnly(params: IFederatedUserCreationParams): IUser {
return {
username: params.username,
name: params.name,
type: 'user',
status: UserStatus.ONLINE,
active: true,
roles: ['user'],
requirePasswordChange: false,
federated: !params.existsOnlyOnProxyServer,
} as unknown as IUser;
}

example event, before a dm is created -

public async beforeDirectMessageRoomCreation(dmBeforeRoomCreationInput: FederationBeforeDirectMessageRoomCreationDto): Promise<void> {

If user is "external", then -

const externalUsersToBeCreatedLocally = invitees.filter(
(invitee) =>
!FederatedUserEE.isOriginalFromTheProxyServer(
this.bridge.extractHomeserverOrigin(invitee.rawInviteeId),
this.internalHomeServerDomain,
),
);

Right now, we could trigger for this user to be created. Problem is, we are blocking this in another pr until all of federation configuration is correct.

@debdutdeb
Copy link
Member Author

Similar is for a user who participated in federation, i.e. have a mapped user in synapse.

@Gustrb
Copy link
Contributor

Gustrb commented Jul 29, 2024

I see, thanks for such a great explanation :)

@debdutdeb debdutdeb marked this pull request as ready for review July 29, 2024 13:46
@MarcosSpessatto MarcosSpessatto added the stat: QA assured Means it has been tested and approved by a company insider label Aug 14, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Aug 14, 2024
@kodiakhq kodiakhq bot merged commit f882124 into develop Aug 14, 2024
48 checks passed
@kodiakhq kodiakhq bot deleted the CORE-519-2 branch August 14, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants