Commit graph

647 commits

Author SHA1 Message Date
Miguel de la Cruz
809ad4f76d
Adds Remote Cluster related API endpoints (#27432)
* Adds Remote Cluster related API endpoints

New endpoints for the following routes are added:

- Get Remote Clusters at `GET /api/v4/remotecluster`
- Create Remote Cluster at `POST /api/v4/remotecluster`
- Accept Remote Cluster invite at `POST
/api/v4/remotecluster/accept_invite`
- Generate Remote Cluster invite at `POST
/api/v4/remotecluster/{remote_id}/generate_invite`
- Get Remote Cluster at `GET /api/v4/remotecluster/{remote_id}`
- Patch Remote Cluster at `PATCH /api/v4/remotecluster/{remote_id}`
- Delete Remote Cluster at `DELETE /api/v4/remotecluster/{remote_id}`

These endpoints are planned to be used from the system console, and
gated through the `manage_secure_connections` permission.

* Update server/channels/api4/remote_cluster_test.go

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

* Fix AppError names

---------

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-07-04 10:35:26 +02:00
Christopher Poile
cc5e87ae24
[MM-57942] Fix a panic on password is too long (#27449)
* return error from bcrypt, handle gracefully; remove dead code

* linting

* linting

* i18n

* fix test

* fill out translations
2024-07-03 17:58:26 -04:00
Scott Bishel
0dbef88cfc
MM-58771 - Make manage_server permission, non updatable (#27481)
* make manage_server, non updatable

* remove blank line
2024-07-03 12:41:20 -06:00
Caleb Roseland
90534b13cf
MM-56774: Delete file along with bookmark (#27495) 2024-07-03 08:31:39 -05:00
Ben Cooke
1f9c9486b8
fix panic in migrations (#27494) 2024-07-02 09:08:23 -04:00
Scott Bishel
b78175c390
require Permission to user to mark channels as read (#27468) 2024-07-02 13:35:43 +02:00
Ibrahim Serdar Acikgoz
e85d34163c
Add support packet metadata (#27465) 2024-06-27 15:27:57 +02:00
Scott Bishel
817e18414e
require regenerate invite id to have invite permission (#27427) 2024-06-26 12:41:26 -06:00
Scott Bishel
6fd894953c
update for adding multiple members (#25128)
* update for adding multiple members

* fix unit test

* more test fixes

* add another unit test

* fix object passed by client4

* revert package-lock.json

* revert package-lock.json

* add length check

* limit size of lists in API requests

* revert package-lock

* add batching to front end

* add batching to front end

* fix bad merge

* update return type

* remove unnecessary permisssion check, add unit test

* fixes and add tests from review

* revert changes adding limits to other apis

* fixes

* clean-up from code review

* fix unit test call

* revert back to interface{}, fix unit test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-25 12:25:28 -06:00
Doug Lauder
6773d13dee
MM-58255 Ensure remote users do not get valid email addresses (#27421)
* remote users don't get valid email addresses; remote users cannot have access tokens

* block notification emails for remote users

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-25 09:26:08 -04:00
Arya Khochare
a8b18ac807
MM-57013 Added download button for downloading logs from server logs page in system console (#26389)
* added download system logs

* download all logs

* download all logs check-lint fix

* check lint fix

* download logs api

* download logs api working

* download logs working with error log

* linting issues and code cleanup

* CI check fix

* documented the api and logs from file with error handling

* test and final changes done

* final changes done

* Fix order of server-side translations

* Fix incorrect indentation of logs.yaml

---------

Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2024-06-24 14:05:23 -04:00
Scott Bishel
71c25fb316
MM-58525 Fix upload file permissions (#27298)
* tie create_post and upload_file permissions together

* update tests

* update file name

* update migration to do in batches

* Update 000122_remove_upload_file_permission.up.sql

* fix formatting

* simplify migrations, fix regex issue

* update file names for recent merge

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-24 10:47:52 -06:00
Miguel de la Cruz
d490fdc1d9
Marks the RemoteTeamId field of RemoteClusters as deprecated (#27364)
* Marks the RemoteTeamId field of RemoteClusters as deprecated

The `RemoteTeamId` was used both in the `RemoteCluster` model and as
part of remote invites. It existed so two different remotes could have
multiple secure connections between them, and have each of those
connections scoped to a team, sharing through each only the channels
that belong to their corresponding team.

The way that we're thinking on the feature currently only contemplates
one secure connection between two servers, and shares all the
channels through that secure connection, so this field is no longer
needed.

As we don't have a system in place for the user to choose in which
team a channel should be created from an invite, this change adds a
mechanism that checks the invite for a teamId, and if it's not
present, fetches a team from the database to create the channel
into. This makes the change backwards compatible for secure
connections that already have an established behavior and allows us to
move forward with the implementation of an alternative.

* Mark invite teamId field as deprecated

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-22 23:08:55 +02:00
enzowritescode
a624c6dc87
Add saml private key to gitignore, remove unused constants (#27391) 2024-06-19 10:03:28 -06:00
Harrison Healey
5defc75e46
MM-57913 Increase maximum length of Preferences.Value column (#27297)
* MM-57913 Increase maximum length of Preferences.Value column

* Add missing column name to migration

* Lowercased table and column names
2024-06-19 10:39:37 -04:00
Devin Binnie
f41e8ad756
[MM-57489] Check for StatusCode when receiving responses from the push proxy (#27392) 2024-06-19 09:18:26 -04:00
Daniel Schalla
1bbc3b4e83
[MM-58560] Configurable session revocation during password resets (#27286)
* [MM-58560] Allow for configurable session revocation during password reset

* Missing i18n additions

* Update Settings Wording

* Update Settings Wording #2

* Update default_config.ts for Session Termination

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-18 21:13:29 +02:00
Matheus
cbd5d95bbb
[MM-57988] Fix move thread logic to not block channel admins (#27061)
* mm-57988: Allowing for channel admins to move thread

* Fix the MoveThread team admin unit test that was introduced

* Renaming the hasPermittedRole function to hasPermittedWranglerRole

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-18 13:41:49 -04:00
Ben Cooke
9187c772b6
[MM-56074] mmctl job commands (#26855)
* add job list and update  job status command to mmctl
2024-06-17 12:07:05 -04:00
Alejandro García Montoro
d81ce03168
MM-57839: Rewrite static assets only if needed (#27076)
* Rewrite static assets only if needed

Refactor UpdateAssetsSubpathInDir so that the actual rewriting of files
happen in two different functions: one for root.html, another for
manifest.json and *.css files.

I would have wanted to simply do a

  if pathToReplace == newPath { return nil }

when those two variables are defined, but the logic for root.html is not
that simple, and that may miss some edge cases, so I opted out for
simply moving the actual rewriting to individual functions, which check
for their corresponding conditions to perform the update:
  1. for root.html, check that the edited file is indeed different than
     the original one
  2. for manifest.json and *.css files, rewrite them only if
     pathToReplace != newPath, which in this case is clear that that's the
     only modification we do

* Fix expected error msg in test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-13 12:01:57 +02:00
Claudio Costa
4b0ae20ef7
Pass remote address in WebSocketMessageHasBeenPosted plugin hook (#27332) 2024-06-13 09:01:49 +02:00
Daniel Espino García
1ec2de4a95
Add mobile metrics (#27045)
* Add mobile metrics

* Fix mocks

* Add tests

* Fix lint

* Address feedback

* Fix lint

* Fix test

* Fix CI

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-12 11:33:04 +02:00
Ibrahim Serdar Acikgoz
691386a814
[MM-53356] server/app/migrations: refactor app migrations (#23958) 2024-06-12 10:08:57 +02:00
Doug Lauder
594ba6e665
MM-58577 Check remote ownership for posts and reactions (#27317)
* - ensure that posts and reactions can only be added via sync when coming from a remote that the target channel is shared with.
- ensure that posts and reactions are only modified/deleted by the remote that owns them.

* check that reaction belongs to post that belongs to channel that is shared with remote;  check that posts belong to channel shared with remote

* check for correct error type in unit test

* tweak unit test
2024-06-11 17:51:00 +02:00
Nick Misasi
b86ba51efd
Add check to not send license expiration email when in Cloud (#27308) 2024-06-10 11:20:44 -04:00
Devin Binnie
f3e760008c
[MM-58355] Send invalidate cache message across the cluster so that websocket connections on other instances are invalidated correctly (#27204)
* [MM-58355] Send invalidate cache message across the cluster so that websocket connections on other instances are invalidated correctly

* Add suggestion to clear the session cache on the local node as well

* Force read from master DB when gettting channel members for websocket to avoid any DB sync issues

* PR feedback

* Missed generated files
2024-06-07 09:38:53 -04:00
Christopher Speller
04181247f8
Move HTTP service to public for plugin use (#27284)
* Move httpservice for use in plugins

* Adapt httpservice for plugin use

* Fix lint
2024-06-05 09:58:04 -07:00
Ibrahim Serdar Acikgoz
179d28ee3f
[MM-58341] db/migrations: mysql-8.4 fix for 000027_create_status (#27080) 2024-06-05 18:52:53 +02:00
Ibrahim Serdar Acikgoz
53bd7a73a4
[MM-58086] platform/busy_test.go: increase test busy duration time (#27082) 2024-06-05 18:52:38 +02:00
Harrison Healey
2bcaa42dc0
MM-58275 Ensure image proxy site URL is updated when that changes (#27214)
* MM-58275 Ensure image proxy site URL is updated when that changes

* Check if proxy settings changed using reflection
2024-06-04 14:06:37 -04:00
Scott Bishel
206ff6e697
add translation for errors checking group name (#27196)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-06-04 07:57:55 -06:00
Doug Lauder
d40cc68b1c
MM-58349 Don't allow remote user to create sessions or reset password (#27215)
Automatic Merge
2024-06-03 17:11:30 +03:00
Devin Binnie
4ec50a7ddd
[MM-58500] Turn off PostedAck when the connection is no longer registered (#27212)
* [MM-58500] Turn off PostedAck when the connection is no longer registered

* Expose active and just check for active instead
2024-06-03 19:14:53 +05:30
Scott Bishel
b788760e17
MM-52638- Last admin cannot be demoted (#24087)
* don't allow last sysadmin to change roles

* cleanup, add comment

* only allow admin downgrade if more than one admin

* remove unused variable

* i18n-extract, unit test fixes

* Update user.go

* remove blank line

* update tests check all return values

* revert channel_store.go

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-31 14:13:46 +02:00
Harrison Healey
1bd7b6f4c2
MM-58359 Add page_load to Prometheus metrics (#27159)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-27 14:06:18 -04:00
Miguel de la Cruz
b00b68920d
Fix test that is not using context (#27164) 2024-05-27 11:38:07 +02:00
Agniva De Sarker
6f3327ce0f
MM-58038: Use context to call master for DeletePost (#27098)
Calling app.DeletePost immediately after creating a post
is susceptible to replica lag because we were calling the
replica to check for the post.

We fix this by passing a context to always query master.

https://mattermost.atlassian.net/browse/MM-58038

```release-note
NONE
```
2024-05-24 19:35:48 +05:30
Miguel de la Cruz
cd81b199b7
Cleans RemoteId when sanitizing post input from the API (#27049)
* Cleans RemoteId when sanitizing post input from the API

* Fix require check

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-23 14:29:19 +02:00
Devin Binnie
8f95656c8f
[MM-55485] Ensure user added to channel receives websocket event regardless of channel membership info retrieved in HA (#27013)
* [MM-55485] Ensure user added to channel receives websocket event regardless of channel membership info retrieved in HA

* Testing to see if group messages are also affected

* Use context from master approach

* Hardcode to master to test

* Revert "Hardcode to master to test"

This reverts commit 50ef2baed1.

* Revert "Use context from master approach"

This reverts commit 65d3584f83.

* Remove group message changes, add comment

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-22 14:45:10 -04:00
Miguel de la Cruz
a4afae5b3b
Adds RemoteId to the fields to clean when coming from the API (#27047)
* Cleans the RemoteId when creating a user through the API

* Replace bad usage of the API with an App call in tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-22 11:20:02 +02:00
Harrison Healey
441f5657c8
MM-57882 Add metric for the time it takes to open the Threads list (#26983)
* MM-57882 Add metric for the time it takes to open the Threads list

* Clean up mark because the starting mark may be missing

* Pass global threads load duration to Prometheus

* Update mocks
2024-05-21 18:04:12 -04:00
Harrison Healey
b29c211ee2
MM-58303 Report client metrics to Prometheus in seconds (#27033) 2024-05-21 13:47:44 -04:00
Maria A Nunez
72fcedd23a
Lower user limit soft warning to 5K (#27034)
Automatic Merge
2024-05-21 20:41:31 +03:00
Harshil Sharma
13d9a9b6cc
Removed post limit warning banner (#27036)
Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-20 09:13:16 +05:30
Harrison Healey
b9f7d38cb1
MM-58281 Change performance timestamps to be floats (#27046)
* MM-58281 Change performance timestamps to be floats

* Commit missed line
2024-05-17 13:52:03 -04:00
Devin Binnie
dad2cd6c27
Remove flaky test (#27041) 2024-05-17 13:48:36 +00:00
Harrison Healey
6cf93ea480
MM-58281 Allow client metrics to be floats and round timestamps (#27027)
* MM-58281 Allow client metrics to be floats and round timestamps

* MM-58281 Fix report version

* Ensure reports can contain a single timestamp

* Round timestamps in unit tests
2024-05-16 18:01:21 +00:00
Doug Lauder
65325a767c
Use ConstantTimeCompare when comparing token. (#27007) 2024-05-16 08:26:04 -04:00
Doug Lauder
5a79565244
Check user belongs to remote when updating profile image (#27008) 2024-05-16 08:21:12 -04:00
Devin Binnie
7e797cea3b
[MM-54757] Stop broadcasting channel_deleted/channel_restored messages from private channels to non-members (#27001)
* [MM-54757] Stop broadcasting channel_deleted/channel_restored messages from private channels to non-members

* Remove unnecessary return

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2024-05-15 17:18:05 -04:00