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!: LDAP sync triggers multiple cron jobs in case an invalid sync interval is provided #32285

Open
wants to merge 132 commits into
base: release-7.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
f7a8bb8
chore: bump 7.0.0
ggazzo Apr 8, 2024
79baee8
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
2958f02
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
3063cc2
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
e9ef2db
fix: use settings' packageValue as a fallback to LDAP sync intervals
matheusbsilva137 Apr 22, 2024
20d8682
fix: add migration to update the packageValue of LDAP sync interval s…
matheusbsilva137 Apr 22, 2024
80677d9
Create changeset
matheusbsilva137 Apr 22, 2024
3fd076a
Merge branch 'release-7.0.0' into fix/ldap-triggers-multiple-cron-jobs
matheusbsilva137 Apr 22, 2024
ac117fb
chore: bump 7.0.0
ggazzo Apr 8, 2024
0cf25be
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
e190a8c
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
472825d
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
7dc9cca
Merge branch 'release-7.0.0' into fix/ldap-triggers-multiple-cron-jobs
matheusbsilva137 Apr 24, 2024
5cea67f
chore: bump 7.0.0
ggazzo Apr 8, 2024
9b3d017
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
8d5b603
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
c2ab323
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
68fee68
rebase with mongo
ggazzo Apr 24, 2024
60f19e6
Merge branch 'release-7.0.0' into fix/ldap-triggers-multiple-cron-jobs
matheusbsilva137 Apr 24, 2024
ac7eb53
update migration to not use cached settings
matheusbsilva137 Apr 26, 2024
a4b6342
remove unrelated changes
matheusbsilva137 Apr 26, 2024
9fa7f1e
Fix typecheck
matheusbsilva137 Apr 26, 2024
94b238d
chore: bump 7.0.0
ggazzo Apr 8, 2024
fcc9265
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
cd0313b
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
405da2a
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
ce31b9d
rebase with mongo
ggazzo Apr 24, 2024
1c13d06
chore!: Improve permissions check on channels endpoints (#32330)
matheusbsilva137 May 3, 2024
8f45647
chore: Improve permissions check on cloud endpoints (#32331)
matheusbsilva137 May 3, 2024
ecaa003
chore: Improve permissions check on instances endpoints (#32334)
matheusbsilva137 May 3, 2024
5ee72d7
chore: Improve permissions check on LDAP endpoints (#32335)
matheusbsilva137 May 3, 2024
cb2fa7f
chore!: Improve permissions check on mailer endpoints (#32336)
matheusbsilva137 May 3, 2024
c42eef9
chore: Improve permissions check on users endpoints (#32353)
matheusbsilva137 May 7, 2024
f835ba3
Merge branch 'release-7.0.0' into fix/ldap-triggers-multiple-cron-jobs
matheusbsilva137 May 7, 2024
f2574d3
chore: bump 7.0.0
ggazzo Apr 8, 2024
45c5a67
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
a13fbfa
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
b3c25be
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
029be94
rebase with mongo
ggazzo Apr 24, 2024
69fb031
chore!: Improve permissions check on channels endpoints (#32330)
matheusbsilva137 May 3, 2024
1e059f9
chore: Improve permissions check on cloud endpoints (#32331)
matheusbsilva137 May 3, 2024
0e3f714
chore: Improve permissions check on instances endpoints (#32334)
matheusbsilva137 May 3, 2024
9475643
chore: Improve permissions check on LDAP endpoints (#32335)
matheusbsilva137 May 3, 2024
b730942
chore!: Improve permissions check on mailer endpoints (#32336)
matheusbsilva137 May 3, 2024
2688a7c
chore: Improve permissions check on users endpoints (#32353)
matheusbsilva137 May 7, 2024
4d0d2cf
chore!: Improve permissions check on groups endpoints (#32332)
matheusbsilva137 May 7, 2024
ec82d0f
chore!: Improve permissions check on integrations endpoints (#32355)
matheusbsilva137 May 7, 2024
47ba37b
chore!: Improve permissions check on oauth-apps endpoints (#32338)
matheusbsilva137 May 9, 2024
a3e9e9b
chore!: Improve permissions check on teams endpoints (#32351)
matheusbsilva137 May 9, 2024
14ac8c0
Merge branch 'release-7.0.0' into fix/ldap-triggers-multiple-cron-jobs
matheusbsilva137 May 10, 2024
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
bba2a7e
chore!: Improve permissions check on roles endpoints (#32347)
matheusbsilva137 May 20, 2024
fe1a4c1
Merge branch 'release-7.0.0' of https://github.com/RocketChat/Rocket.…
matheusbsilva137 May 20, 2024
260ae8c
chore: bump 7.0.0
ggazzo Apr 8, 2024
ade7679
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
d1fb25a
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
4456bfd
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
f2085dc
chore!: Improve permissions check on channels endpoints (#32330)
matheusbsilva137 May 3, 2024
4e6f41d
chore: Improve permissions check on cloud endpoints (#32331)
matheusbsilva137 May 3, 2024
5fae04d
chore: Improve permissions check on instances endpoints (#32334)
matheusbsilva137 May 3, 2024
c6e57c9
chore: Improve permissions check on LDAP endpoints (#32335)
matheusbsilva137 May 3, 2024
8d9063d
chore!: Improve permissions check on mailer endpoints (#32336)
matheusbsilva137 May 3, 2024
b7756c7
chore: Improve permissions check on users endpoints (#32353)
matheusbsilva137 May 7, 2024
0e8dca3
chore!: Improve permissions check on groups endpoints (#32332)
matheusbsilva137 May 7, 2024
74af7e0
chore!: Improve permissions check on integrations endpoints (#32355)
matheusbsilva137 May 7, 2024
9ebd374
chore!: Improve permissions check on oauth-apps endpoints (#32338)
matheusbsilva137 May 9, 2024
36d10f4
chore!: Improve permissions check on teams endpoints (#32351)
matheusbsilva137 May 9, 2024
39a17fa
chore!: Improve permissions check on im endpoints (#32333)
matheusbsilva137 May 13, 2024
3da3ab7
chore!: Improve permissions check on permissions endpoints (#32343)
matheusbsilva137 May 13, 2024
de514b1
chore!: Improve permissions check on settings endpoints (#32350)
matheusbsilva137 May 13, 2024
d9184e2
chore!: Improve permissions check on licenses endpoints (#32354)
matheusbsilva137 May 13, 2024
f90b4a7
test: fix im.messages.others endpoint tests (#32426)
matheusbsilva137 May 14, 2024
a486bcc
chore!: Improve permissions check on misc endpoints (#32337)
matheusbsilva137 May 14, 2024
0d4352b
chore!: Improve permissions check on roles endpoints (#32347)
matheusbsilva137 May 20, 2024
1eae86e
refactor!: removed listEmojiCustom method (#32542)
abhinavkrin Jun 24, 2024
932a5d4
Merge branch 'release-7.0.0' of https://github.com/RocketChat/Rocket.…
matheusbsilva137 Aug 6, 2024
239ef81
Fix changeset
matheusbsilva137 Aug 6, 2024
86b2f6b
chore: bump 7.0.0
ggazzo Apr 8, 2024
00c7c2b
fix!: api login should not suggest which credential is wrong (#32159)
ggazzo Apr 9, 2024
8cb4fc3
chore!: remove hipchat importer (#32154)
pierre-lehnen-rc Apr 11, 2024
49ca21c
chore!: Removed Mongo 4.4. support and added 7.0 (#32162)
ggazzo Apr 12, 2024
6e1486e
chore!: Improve permissions check on channels endpoints (#32330)
matheusbsilva137 May 3, 2024
c777d78
chore: Improve permissions check on cloud endpoints (#32331)
matheusbsilva137 May 3, 2024
efcfd20
chore: Improve permissions check on instances endpoints (#32334)
matheusbsilva137 May 3, 2024
d461951
chore: Improve permissions check on LDAP endpoints (#32335)
matheusbsilva137 May 3, 2024
a3d1be9
chore!: Improve permissions check on mailer endpoints (#32336)
matheusbsilva137 May 3, 2024
2dfd41b
chore: Improve permissions check on users endpoints (#32353)
matheusbsilva137 May 7, 2024
05587e1
chore!: Improve permissions check on groups endpoints (#32332)
matheusbsilva137 May 7, 2024
45c0da4
chore!: Improve permissions check on integrations endpoints (#32355)
matheusbsilva137 May 7, 2024
605a639
chore!: Improve permissions check on oauth-apps endpoints (#32338)
matheusbsilva137 May 9, 2024
7a476f2
chore!: Improve permissions check on teams endpoints (#32351)
matheusbsilva137 May 9, 2024
6a5e4ba
chore!: Improve permissions check on im endpoints (#32333)
matheusbsilva137 May 13, 2024
f4c349b
chore!: Improve permissions check on permissions endpoints (#32343)
matheusbsilva137 May 13, 2024
bced162
chore!: Improve permissions check on settings endpoints (#32350)
matheusbsilva137 May 13, 2024
ede52cf
chore!: Improve permissions check on licenses endpoints (#32354)
matheusbsilva137 May 13, 2024
73c8cf5
test: fix im.messages.others endpoint tests (#32426)
matheusbsilva137 May 14, 2024
517538f
chore!: Improve permissions check on misc endpoints (#32337)
matheusbsilva137 May 14, 2024
9d48b04
chore!: Improve permissions check on roles endpoints (#32347)
matheusbsilva137 May 20, 2024
1621750
refactor!: removed listEmojiCustom method (#32542)
abhinavkrin Jun 24, 2024
ca66865
chore!: removes view-history permission (#33042)
lucas-a-pelegrino Aug 15, 2024
8c447cf
chore!: Remove unused `omnichannelExternalFrameGenerateKey` (#32921)
dougfabris Aug 15, 2024
3325e83
Merge branch 'release-7.0.0' of https://github.com/RocketChat/Rocket.…
matheusbsilva137 Aug 16, 2024
14fd023
chore!: remove deprecated meteor eraseRoom method (#32648)
AllanPazRibeiro Aug 17, 2024
68ab73c
chore!: removed setAsset, unsetAsset, refreshClients method (#32564)
abhinavkrin Aug 17, 2024
2c9cb0e
chore!: Remove `meteor/check` from `cloud` endpoints (#32533)
matheusbsilva137 Aug 17, 2024
f05403f
chore!: removed checkUsernameAvailability method (#32488)
abhinavkrin Aug 17, 2024
bcdcfd4
refactor!: removed roomNameExists method (#32484)
abhinavkrin Aug 17, 2024
10fce25
chore!: removed reportMessage method (#32633)
abhinavkrin Aug 17, 2024
77defb5
fix: Missing retention's `ignoreThreads` param for old channels (#33028)
dougfabris Aug 17, 2024
4e90c43
chore!: Remove `meteor/check` from `chat` endpoints (#32532)
matheusbsilva137 Aug 17, 2024
3ebadc3
chore!: Remove `meteor/check` from `banners` endpoints (#32509)
matheusbsilva137 Aug 18, 2024
60f423d
Merge branch 'release-7.0.0' of https://github.com/RocketChat/Rocket.…
matheusbsilva137 Aug 19, 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
5 changes: 5 additions & 0 deletions .changeset/chilled-boats-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

This adjustment removes the deprecated `eraseRoom` method. Moving forward, use the `room.delete` endpoint to delete rooms.
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/gold-knives-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where ignore threads parameter were not being affected by retention policy overriding in old channels
5 changes: 5 additions & 0 deletions .changeset/lovely-trees-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": major
---

Removes `view-history` permission due to lack of usage
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.
5 changes: 5 additions & 0 deletions .changeset/sixty-vans-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": major
---

Fixed issue with LDAP sync triggering multiple cron jobs in case an invalid sync interval is provided
6 changes: 6 additions & 0 deletions .changeset/tiny-rice-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": major
"@rocket.chat/rest-typings": major
---

Removed `meteor/check` from `chat` endpoints
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 @@ -80,16 +80,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: Collect Workflow Telemetry
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,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 @@ -366,7 +366,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 @@ -390,7 +390,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 @@ -802,7 +802,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
15 changes: 7 additions & 8 deletions apps/meteor/app/api/server/v1/assets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { isAssetsUnsetAssetProps } from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

import { RocketChatAssets } from '../../../assets/server';
import { RocketChatAssets, setAsset, unsetAsset, refreshClients } from '../../../assets/server';
import { settings } from '../../../settings/server';
import { API } from '../api';
import { getUploadFormData } from '../lib/getUploadFormData';
Expand All @@ -27,12 +26,12 @@ API.v1.addRoute(

const isValidAsset = assetsKeys.includes(assetName);
if (!isValidAsset) {
throw new Meteor.Error('error-invalid-asset', 'Invalid asset');
throw new Error('Invalid asset');
}

await Meteor.callAsync('setAsset', fileBuffer, mimetype, assetName);
await setAsset(this.userId, fileBuffer, mimetype, assetName);
if (refreshAllClients) {
await Meteor.callAsync('refreshClients');
await refreshClients(this.userId);
}

return API.v1.success();
Expand All @@ -51,11 +50,11 @@ API.v1.addRoute(
const { assetName, refreshAllClients } = this.bodyParams;
const isValidAsset = Object.keys(RocketChatAssets.assets).includes(assetName);
if (!isValidAsset) {
throw new Meteor.Error('error-invalid-asset', 'Invalid asset');
throw Error('Invalid asset');
}
await Meteor.callAsync('unsetAsset', assetName);
await unsetAsset(this.userId, assetName);
if (refreshAllClients) {
await Meteor.callAsync('refreshClients');
await refreshClients(this.userId);
}
return API.v1.success();
},
Expand Down
47 changes: 6 additions & 41 deletions apps/meteor/app/api/server/v1/banners.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Banner } from '@rocket.chat/core-services';
import { BannerPlatform } from '@rocket.chat/core-typings';
import { Match, check } from 'meteor/check';
import { isBannersDismissProps, isBannersGetNewProps, isBannersProps } from '@rocket.chat/rest-typings';

import { API } from '../api';

Expand Down Expand Up @@ -52,17 +51,10 @@ import { API } from '../api';
*/
API.v1.addRoute(
'banners.getNew',
{ authRequired: true, deprecation: { version: '8.0.0', alternatives: ['banners/:id', 'banners'] } },
{ authRequired: true, validateParams: isBannersGetNewProps, deprecation: { version: '8.0.0', alternatives: ['banners/:id', 'banners'] } },
{
// deprecated
async get() {
check(
this.queryParams,
Match.ObjectIncluding({
platform: Match.OneOf(...Object.values(BannerPlatform)),
bid: Match.Maybe(String),
}),
);

const { platform, bid: bannerId } = this.queryParams;

const banners = await Banner.getBannersForUser(this.userId, platform, bannerId ?? undefined);
Expand Down Expand Up @@ -120,23 +112,10 @@ API.v1.addRoute(
*/
API.v1.addRoute(
'banners/:id',
{ authRequired: true },
{ authRequired: true, validateParams: isBannersProps },
{
// TODO: move to users/:id/banners
async get() {
check(
this.urlParams,
Match.ObjectIncluding({
id: Match.Where((id: unknown): id is string => typeof id === 'string' && Boolean(id.trim())),
}),
);
check(
this.queryParams,
Match.ObjectIncluding({
platform: Match.OneOf(...Object.values(BannerPlatform)),
}),
);

const { platform } = this.queryParams;
const { id } = this.urlParams;

Expand Down Expand Up @@ -186,16 +165,9 @@ API.v1.addRoute(
*/
API.v1.addRoute(
'banners',
{ authRequired: true },
{ authRequired: true, validateParams: isBannersProps },
{
async get() {
check(
this.queryParams,
Match.ObjectIncluding({
platform: Match.OneOf(...Object.values(BannerPlatform)),
}),
);

const { platform } = this.queryParams;

const banners = await Banner.getBannersForUser(this.userId, platform);
Expand Down Expand Up @@ -240,16 +212,9 @@ API.v1.addRoute(
*/
API.v1.addRoute(
'banners.dismiss',
{ authRequired: true },
{ authRequired: true, validateParams: isBannersDismissProps },
{
async post() {
check(
this.bodyParams,
Match.ObjectIncluding({
bannerId: Match.Where((id: unknown): id is string => typeof id === 'string' && Boolean(id.trim())),
}),
);

const { bannerId } = this.bodyParams;

await Banner.dismiss(this.userId, bannerId);
Expand Down
44 changes: 22 additions & 22 deletions apps/meteor/app/api/server/v1/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ import {
import { Meteor } from 'meteor/meteor';

import { isTruthy } from '../../../../lib/isTruthy';
import { eraseRoom } from '../../../../server/lib/eraseRoom';
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 +273,7 @@ API.v1.addRoute(
{
authRequired: true,
validateParams: isChannelsMessagesProps,
permissionsRequired: ['view-c-room'],
},
{
async get() {
Expand All @@ -292,9 +294,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 @@ -465,7 +464,7 @@ API.v1.addRoute(
checkedArchived: false,
});

await Meteor.callAsync('eraseRoom', room._id);
await eraseRoom(room._id, this.userId);

return API.v1.success();
},
Expand All @@ -477,13 +476,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 +851,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 +952,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 +967,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
Loading
Loading