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

feat!: Merge LDAP Teams Sync and Channels Sync into a new Rooms Sync section #32390

Draft
wants to merge 25 commits into
base: release-7.0.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8276593
chore: bump 7.0.0
ggazzo Apr 8, 2024
f5584c6
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
cead04d
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
fe1dae5
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
8192bc6
rebase with mongo
ggazzo Apr 24, 2024
782aa4a
chore!: Improve permissions check on channels endpoints (#32330)
matheusbsilva137 May 3, 2024
e9d5829
chore: Improve permissions check on cloud endpoints (#32331)
matheusbsilva137 May 3, 2024
4ca1ada
chore: Improve permissions check on instances endpoints (#32334)
matheusbsilva137 May 3, 2024
7695ede
chore: Improve permissions check on LDAP endpoints (#32335)
matheusbsilva137 May 3, 2024
5156a40
chore!: Improve permissions check on mailer endpoints (#32336)
matheusbsilva137 May 3, 2024
6316f17
chore: Improve permissions check on users endpoints (#32353)
matheusbsilva137 May 7, 2024
5d7e447
chore!: Improve permissions check on groups endpoints (#32332)
matheusbsilva137 May 7, 2024
2b70392
chore!: Improve permissions check on integrations endpoints (#32355)
matheusbsilva137 May 7, 2024
e268d52
chore!: Improve permissions check on oauth-apps endpoints (#32338)
matheusbsilva137 May 9, 2024
f468881
chore!: Improve permissions check on teams endpoints (#32351)
matheusbsilva137 May 9, 2024
9c4ca83
chore!: Improve permissions check on im endpoints (#32333)
matheusbsilva137 May 13, 2024
1ec86c0
chore!: Improve permissions check on permissions endpoints (#32343)
matheusbsilva137 May 13, 2024
d8154d7
chore!: Improve permissions check on settings endpoints (#32350)
matheusbsilva137 May 13, 2024
b12fc8e
chore!: Improve permissions check on licenses endpoints (#32354)
matheusbsilva137 May 13, 2024
fe55884
test: fix im.messages.others endpoint tests (#32426)
matheusbsilva137 May 14, 2024
d2530d3
chore!: Improve permissions check on misc endpoints (#32337)
matheusbsilva137 May 14, 2024
b4ddfa2
feat: Merge LDAP Sync Teams and Sync Channels in a new Sync Rooms sec…
matheusbsilva137 May 8, 2024
a8a8edd
i18n: Update settings' translations
matheusbsilva137 May 8, 2024
e25d242
improve: Update Sync Rooms on Login setting default value to true
matheusbsilva137 May 8, 2024
62b6189
improve: Move Group name field setting from Teams Sync to the new org…
matheusbsilva137 May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/fair-seahorses-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@rocket.chat/meteor': major
---

As per MongoDB Lifecycle Schedules ([mongodb.com/legal/support-policy/lifecycles](https://www.mongodb.com/legal/support-policy/lifecycles)) we're removing official support to MongoDB version 4.4 that has reached end of life in February 2024.

We recommend upgrading to at least MongoDB 6.0+, though 5.0 is still a supported version.

Here are official docs on how to upgrade to some of the supported versions:

- [mongodb.com/docs/manual/release-notes/5.0-upgrade-replica-set](https://www.mongodb.com/docs/manual/release-notes/5.0-upgrade-replica-set/)
- [mongodb.com/docs/manual/release-notes/6.0-upgrade-replica-set](https://www.mongodb.com/docs/manual/release-notes/6.0-upgrade-replica-set/)
- [mongodb.com/docs/manual/release-notes/7.0-upgrade-replica-set](https://www.mongodb.com/docs/manual/release-notes/7.0-upgrade-replica-set/)
5 changes: 5 additions & 0 deletions .changeset/fluffy-knives-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": major
---

Added MongoDB 7.0 support
7 changes: 7 additions & 0 deletions .changeset/fuzzy-cherries-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": major
---

Api login should not suggest which credential is wrong (password/username)

Failed login attemps will always return `Unauthorized` instead of the internal fail reason
5 changes: 5 additions & 0 deletions .changeset/quiet-kings-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---

Removed the ability to import data in the HipChat Enterprise format, as it was discontinued over five years ago.
8 changes: 4 additions & 4 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
transporter:
type: string
mongodb-version:
default: "['4.4', '6.0']"
default: "['5.0', '7.0']"
required: false
type: string
release:
Expand Down Expand Up @@ -78,16 +78,16 @@ jobs:
test:
runs-on: ubuntu-20.04
env:
RC_DOCKERFILE: ${{ matrix.mongodb-version == '6.0' && inputs.rc-dockerfile-alpine || inputs.rc-dockerfile }}
RC_DOCKER_TAG: ${{ matrix.mongodb-version == '6.0' && inputs.rc-docker-tag-alpine || inputs.rc-docker-tag }}
RC_DOCKERFILE: ${{ matrix.mongodb-version == '7.0' && inputs.rc-dockerfile-alpine || inputs.rc-dockerfile }}
RC_DOCKER_TAG: ${{ matrix.mongodb-version == '7.0' && inputs.rc-docker-tag-alpine || inputs.rc-docker-tag }}

strategy:
fail-fast: false
matrix:
mongodb-version: ${{ fromJSON(inputs.mongodb-version) }}
shard: ${{ fromJSON(inputs.shard) }}

name: MongoDB ${{ matrix.mongodb-version }}${{ inputs.db-watcher-disabled == 'true' && ' [no watchers]' || '' }} (${{ matrix.shard }}/${{ inputs.total-shard }})${{ matrix.mongodb-version == '6.0' && ' - Alpine' || '' }}
name: MongoDB ${{ matrix.mongodb-version }}${{ inputs.db-watcher-disabled == 'true' && ' [no watchers]' || '' }} (${{ matrix.shard }}/${{ inputs.total-shard }})${{ matrix.mongodb-version == '7.0' && ' - Alpine' || '' }}

steps:
- name: Login to GitHub Container Registry
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
fi;

curl -H "Content-Type: application/json" -H "X-Update-Token: $UPDATE_TOKEN" -d \
"{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"compatibleMongoVersions\": [\"4.4\", \"5.0\", \"6.0\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"draft\", \"draftAs\": \"$RC_RELEASE\"}" \
"{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"compatibleMongoVersions\": [\"5.0\", \"6.0\", \"7.0\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"draft\", \"draftAs\": \"$RC_RELEASE\"}" \
https://releases.rocket.chat/update

packages-build:
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:
release: ee
transporter: 'nats://nats:4222'
enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }}
mongodb-version: "['4.4']"
mongodb-version: "['5.0']"
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
Expand All @@ -372,7 +372,7 @@ jobs:
enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }}
shard: '[1, 2, 3, 4, 5]'
total-shard: 5
mongodb-version: "['4.4']"
mongodb-version: "['5.0']"
node-version: ${{ needs.release-versions.outputs.node-version }}
lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }}
rc-dockerfile: ${{ needs.release-versions.outputs.rc-dockerfile }}
Expand Down Expand Up @@ -750,7 +750,7 @@ jobs:
fi;

curl -H "Content-Type: application/json" -H "X-Update-Token: $UPDATE_TOKEN" -d \
"{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"compatibleMongoVersions\": [\"4.4\", \"5.0\", \"6.0\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"$RC_RELEASE\"}" \
"{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"compatibleMongoVersions\": [\"5.0\", \"6.0\", \"7.0\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"$RC_RELEASE\"}" \
https://releases.rocket.chat/update

# Makes build fail if the release isn't there
Expand Down
1 change: 0 additions & 1 deletion FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- Incoming / Outgoing Webhooks
- Data Importer
- Import from Slack
- Import from Hipchat
- Slack Bridge
- Profiles
- Custom avatars
Expand Down
41 changes: 20 additions & 21 deletions apps/meteor/app/api/server/v1/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { findUsersOfRoom } from '../../../../server/lib/findUsersOfRoom';
import { hideRoomMethod } from '../../../../server/methods/hideRoom';
import { removeUserFromRoomMethod } from '../../../../server/methods/removeUserFromRoom';
import { canAccessRoomAsync } from '../../../authorization/server';
import { hasPermissionAsync, hasAtLeastOnePermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { saveRoomSettings } from '../../../channel-settings/server/methods/saveRoomSettings';
import { mountIntegrationQueryBasedOnPermissions } from '../../../integrations/server/lib/mountQueriesBasedOnPermission';
import { addUsersToRoomMethod } from '../../../lib/server/methods/addUsersToRoom';
Expand Down Expand Up @@ -272,6 +272,7 @@ API.v1.addRoute(
{
authRequired: true,
validateParams: isChannelsMessagesProps,
permissionsRequired: ['view-c-room'],
},
{
async get() {
Expand All @@ -292,9 +293,6 @@ API.v1.addRoute(
) {
return API.v1.unauthorized();
}
if (!(await hasPermissionAsync(this.userId, 'view-c-room'))) {
return API.v1.unauthorized();
}

const { cursor, totalCount } = await Messages.findPaginated(ourQuery, {
sort: sort || { ts: -1 },
Expand Down Expand Up @@ -477,13 +475,10 @@ API.v1.addRoute(
{
authRequired: true,
validateParams: isChannelsConvertToTeamProps,
permissionsRequired: ['create-team'],
},
{
async post() {
if (!(await hasPermissionAsync(this.userId, 'create-team'))) {
return API.v1.unauthorized();
}

const { channelId, channelName } = this.bodyParams;

if (!channelId && !channelName) {
Expand Down Expand Up @@ -855,20 +850,22 @@ API.v1.addRoute(

API.v1.addRoute(
'channels.getIntegrations',
{ authRequired: true },
{
async get() {
if (
!(await hasAtLeastOnePermissionAsync(this.userId, [
authRequired: true,
permissionsRequired: {
GET: {
permissions: [
'manage-outgoing-integrations',
'manage-own-outgoing-integrations',
'manage-incoming-integrations',
'manage-own-incoming-integrations',
]))
) {
return API.v1.unauthorized();
}

],
operation: 'hasAny',
},
},
},
{
async get() {
const findResult = await findChannelByIdOrName({
params: this.queryParams,
checkedArchived: false,
Expand Down Expand Up @@ -954,7 +951,12 @@ API.v1.addRoute(

API.v1.addRoute(
'channels.list',
{ authRequired: true },
{
authRequired: true,
permissionsRequired: {
GET: { permissions: ['view-c-room', 'view-joined-room'], operation: 'hasAny' },
},
},
{
async get() {
const { offset, count } = await getPaginationItems(this.queryParams);
Expand All @@ -964,9 +966,6 @@ API.v1.addRoute(
const ourQuery: Record<string, any> = { ...query, t: 'c' };

if (!hasPermissionToSeeAllPublicChannels) {
if (!(await hasPermissionAsync(this.userId, 'view-joined-room'))) {
return API.v1.unauthorized();
}
const roomIds = (
await Subscriptions.findByUserIdAndType(this.userId, 'c', {
projection: { rid: 1 },
Expand Down
25 changes: 4 additions & 21 deletions apps/meteor/app/api/server/v1/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { check } from 'meteor/check';

import { CloudWorkspaceRegistrationError } from '../../../../lib/errors/CloudWorkspaceRegistrationError';
import { SystemLogger } from '../../../../server/lib/logger/system';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { hasRoleAsync } from '../../../authorization/server/functions/hasRole';
import { getCheckoutUrl } from '../../../cloud/server/functions/getCheckoutUrl';
import { getConfirmationPoll } from '../../../cloud/server/functions/getConfirmationPoll';
Expand All @@ -20,17 +19,13 @@ import { API } from '../api';

API.v1.addRoute(
'cloud.manualRegister',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['register-on-cloud'] },
{
async post() {
check(this.bodyParams, {
cloudBlob: String,
});

if (!(await hasPermissionAsync(this.userId, 'register-on-cloud'))) {
return API.v1.unauthorized();
}

const registrationInfo = await retrieveRegistrationStatus();

if (registrationInfo.workspaceRegistered) {
Expand All @@ -48,18 +43,14 @@ API.v1.addRoute(

API.v1.addRoute(
'cloud.createRegistrationIntent',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['manage-cloud'] },
{
async post() {
check(this.bodyParams, {
resend: Boolean,
email: String,
});

if (!(await hasPermissionAsync(this.userId, 'manage-cloud'))) {
return API.v1.unauthorized();
}

const intentData = await startRegisterWorkspaceSetupWizard(this.bodyParams.resend, this.bodyParams.email);

if (intentData) {
Expand All @@ -73,32 +64,24 @@ API.v1.addRoute(

API.v1.addRoute(
'cloud.registerPreIntent',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['manage-cloud'] },
{
async post() {
if (!(await hasPermissionAsync(this.userId, 'manage-cloud'))) {
return API.v1.unauthorized();
}

return API.v1.success({ offline: !(await registerPreIntentWorkspaceWizard()) });
},
},
);

API.v1.addRoute(
'cloud.confirmationPoll',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['manage-cloud'] },
{
async get() {
const { deviceCode } = this.queryParams;
check(this.queryParams, {
deviceCode: String,
});

if (!(await hasPermissionAsync(this.userId, 'manage-cloud'))) {
return API.v1.unauthorized();
}

if (!deviceCode) {
return API.v1.failure('Invalid query');
}
Expand Down
31 changes: 13 additions & 18 deletions apps/meteor/app/api/server/v1/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import { findUsersOfRoom } from '../../../../server/lib/findUsersOfRoom';
import { hideRoomMethod } from '../../../../server/methods/hideRoom';
import { removeUserFromRoomMethod } from '../../../../server/methods/removeUserFromRoom';
import { canAccessRoomAsync, roomAccessAttributes } from '../../../authorization/server';
import {
hasAllPermissionAsync,
hasAtLeastOnePermissionAsync,
hasPermissionAsync,
} from '../../../authorization/server/functions/hasPermission';
import { hasAllPermissionAsync, hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { saveRoomSettings } from '../../../channel-settings/server/methods/saveRoomSettings';
import { mountIntegrationQueryBasedOnPermissions } from '../../../integrations/server/lib/mountQueriesBasedOnPermission';
import { createPrivateGroupMethod } from '../../../lib/server/methods/createPrivateGroup';
Expand Down Expand Up @@ -412,20 +408,22 @@ API.v1.addRoute(

API.v1.addRoute(
'groups.getIntegrations',
{ authRequired: true },
{
async get() {
if (
!(await hasAtLeastOnePermissionAsync(this.userId, [
authRequired: true,
permissionsRequired: {
GET: {
permissions: [
'manage-outgoing-integrations',
'manage-own-outgoing-integrations',
'manage-incoming-integrations',
'manage-own-incoming-integrations',
]))
) {
return API.v1.unauthorized();
}

],
operation: 'hasAny',
},
},
},
{
async get() {
const findResult = await findPrivateGroupByIdOrName({
params: this.queryParams,
userId: this.userId,
Expand Down Expand Up @@ -670,12 +668,9 @@ API.v1.addRoute(

API.v1.addRoute(
'groups.listAll',
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['view-room-administration'] },
{
async get() {
if (!(await hasPermissionAsync(this.userId, 'view-room-administration'))) {
return API.v1.unauthorized();
}
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();
const ourQuery = Object.assign({}, query, { t: 'p' as RoomType });
Expand Down
12 changes: 2 additions & 10 deletions apps/meteor/app/api/server/v1/im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ API.v1.addRoute(

API.v1.addRoute(
['dm.messages.others', 'im.messages.others'],
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['view-room-administration'] },
{
async get() {
if (settings.get('API_Enable_Direct_Message_History_EndPoint') !== true) {
Expand All @@ -404,10 +404,6 @@ API.v1.addRoute(
});
}

if (!(await hasPermissionAsync(this.userId, 'view-room-administration'))) {
return API.v1.unauthorized();
}

const { roomId } = this.queryParams;
if (!roomId) {
throw new Meteor.Error('error-roomid-param-not-provided', 'The parameter "roomId" is required');
Expand Down Expand Up @@ -483,13 +479,9 @@ API.v1.addRoute(

API.v1.addRoute(
['dm.list.everyone', 'im.list.everyone'],
{ authRequired: true },
{ authRequired: true, permissionsRequired: ['view-room-administration'] },
{
async get() {
if (!(await hasPermissionAsync(this.userId, 'view-room-administration'))) {
return API.v1.unauthorized();
}

const { offset, count }: { offset: number; count: number } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();

Expand Down
Loading
Loading