mattermost/server/channels/api4
Jesse Hallam 70a50edcf2
[MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786)
* Fix 500 errors on check-cws-connection in non-Cloud environments

The check-cws-connection endpoint was returning 500 errors in
self-hosted enterprise environments because:

1. The client only checked BuildEnterpriseReady before making the
   request, which is true for all enterprise builds
2. The server handler didn't check for a Cloud license before
   attempting to connect to CWS
3. The CWS URL is not configured in non-Cloud environments, causing
   the connection check to fail

This fix:
- Server: Add IsCloud() license check to match other cloud endpoints,
  returning 403 instead of 500 for non-Cloud licenses
- Client: Add Cloud license check to skip the request entirely in
  non-Cloud environments

* Add unit tests for check-cws-connection license check

* Return JSON status from check-cws-connection endpoint

Change the check-cws-connection endpoint to return 200 with a JSON body
containing status (available/unavailable) instead of using HTTP error
codes. This allows the endpoint to be used for air-gap detection on
self-hosted instances, not just Cloud deployments.

* i18n

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-02-02 13:41:14 +00:00
..
access_control.go [MM-67126] Deprecate UpdateAccessControlPolicyActiveStatus API in favor of new one (#34940) 2026-01-27 15:49:08 +01:00
access_control_local.go [MM-67126] Deprecate UpdateAccessControlPolicyActiveStatus API in favor of new one (#34940) 2026-01-27 15:49:08 +01:00
access_control_test.go [MM-67126] Deprecate UpdateAccessControlPolicyActiveStatus API in favor of new one (#34940) 2026-01-27 15:49:08 +01:00
agents.go Autotranslations MVP (#34696) 2026-01-26 17:05:34 -05:00
api.go [MM-66359] Recaps MVP (#34337) 2026-01-13 11:59:22 -05:00
apitestlib.go MM-66789 Restrict log downloads to a root path for support packets (#35014) 2026-01-29 13:29:55 -05:00
apitestlib_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
audit_logging.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
bot.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
bot_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
bot_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
brand.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
brand_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
channel.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
channel_bookmark.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
channel_bookmark_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
channel_category.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
channel_category_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
channel_common_teams_test.go MM-66424: Improve team filtering in common teams API (#34454) 2025-12-15 15:06:48 -04:00
channel_local.go [MM-64900] Migrate to use request.CTX instead of context.Context (#33541) 2025-09-18 16:14:24 +02:00
channel_test.go MM-67119: Remove unused Channel.Etag (#34951) 2026-01-20 17:46:17 +01:00
cloud.go [MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786) 2026-02-02 13:41:14 +00:00
cloud_test.go [MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786) 2026-02-02 13:41:14 +00:00
cluster.go [MM-29049] Fix remaining errcheck errors in app, api4 and web package (#31307) 2025-06-06 07:44:43 +02:00
cluster_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
command.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
command_help_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
command_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
command_test.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
commands_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
compliance.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
config.go [MM-66789] Restrict ImportSettings.Directory changes via API and add validation (#34653) 2026-01-06 16:30:07 +00:00
config_local.go MM-64807: Deprecate format parameter in client config endpoint (#33605) 2025-08-20 12:15:11 -03:00
config_test.go [MM-66789] Restrict ImportSettings.Directory changes via API and add validation (#34653) 2026-01-06 16:30:07 +00:00
content_flagging.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
content_flagging_test.go Bor post disable flagging (#34759) 2025-12-22 12:25:54 +05:30
cors_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
custom_profile_attributes.go Adds default values to the attrs of CPA fields and refactors the app layer (#34408) 2025-11-13 12:00:54 +01:00
custom_profile_attributes_local.go Adds value endpoints to local mode (#33950) 2025-09-26 10:57:13 +02:00
custom_profile_attributes_test.go Adds default values to the attrs of CPA fields and refactors the app layer (#34408) 2025-11-13 12:00:54 +01:00
data_retention.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
data_retention_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
doc.go Add comprehensive documentation for server/channels layers (#33449) 2025-07-22 11:53:42 +02:00
drafts.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
drafts_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
elasticsearch.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
elasticsearch_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
emoji.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
emoji_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
export.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
export_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
export_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
file.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
file_test.go Content flagging file downloads (#34480) 2025-11-19 14:22:07 +05:30
group.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
group_local.go Fixed errcheck issues in server/channels/api4/group_local.go (#28417) 2024-10-08 10:47:01 +02:00
group_test.go MM-66092 - enhance user permissions data structure validations (#34654) 2026-01-16 10:59:07 -04:00
handlers.go Premium SKU (#30396) 2025-04-03 13:07:54 +05:30
handlers_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
helpers.go Mono repo -> Master (#22553) 2023-03-22 17:22:27 -04:00
hosted_customer.go [MM-67030] Remove newsletter signup and replace with terms/privacy agreement (#34801) 2026-01-23 18:24:27 +00:00
image.go Fully deprecate /api/v4/image endpoint when image proxy is disabled (#27595) 2024-08-05 12:33:09 +02:00
image_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
import.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
import_local.go MMCTL: Add import delete cmd for removing the import files (#29764) 2025-06-10 12:06:38 +02:00
import_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
integration_action.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
integration_action_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
ip_filtering.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
ip_filtering_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
job.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
job_local.go [MM-63556] mmctl: Add compliance export download cmd (#30576) 2025-06-24 16:27:54 -04:00
job_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
ldap.go [MM-64320] Remove deprecated include_removed_members option in api/v4/ldap/sync (#31121) 2025-07-17 12:35:08 +02:00
ldap_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
ldap_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
license.go MM-63368: Remove MySQL (#33458) 2025-07-22 20:40:55 +05:30
license_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
license_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
limits.go Message History Limits in Entry Edition (#33831) 2025-09-10 22:52:19 -04:00
limits_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
main_test.go MM-63368: Remove MySQL (#33458) 2025-07-22 20:40:55 +05:30
metrics.go MM-60283 Add standard response and API docs to /client_perf API (#28124) 2024-09-10 21:11:05 +00:00
metrics_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
notify_admin.go [MM-54024] Handle JSON nulls when unmarshalling in api4 (#24656) 2023-10-05 19:25:59 +05:30
notify_admin_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
oauth.go add audit logs to DCR (#34598) 2025-11-28 11:44:15 -05:00
oauth_test.go add audit logs to DCR (#34598) 2025-11-28 11:44:15 -05:00
outgoing_oauth_connection.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
outgoing_oauth_connection_test.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
permission.go errcheck issues fixed (#28475) 2024-10-04 19:12:32 +02:00
permissions_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
plugin.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
plugin_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
plugin_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
post.go [MM-66581] Include some thread context in AI Rewrites prompt (#34931) 2026-01-30 09:14:06 -05:00
post_create_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
post_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
post_test.go MM-67055: Fix permalink embeds in WebSocket messages (#34893) 2026-01-23 16:11:16 -05:00
post_utils.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
preference.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
preference_local.go MM-56819: Introduce --local mode in MMCTL to handle user preferences. (#26972) 2024-09-09 14:12:22 +02:00
preference_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
reaction.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
reaction_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
recap.go [MM-67160] Add audit logging for recap API endpoints (#34929) 2026-01-19 13:46:43 -05:00
remote_cluster.go Add missing auditRec.Success calls; fix missing return on error. (#34954) 2026-01-27 23:07:53 +00:00
remote_cluster_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
report.go Add cursor-based Posts Reporting API for compliance and auditing (#34252) 2025-11-17 09:02:19 -07:00
report_test.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
role.go [MM-64900] Migrate to use request.CTX instead of context.Context (#33541) 2025-09-18 16:14:24 +02:00
role_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
role_test.go Use testify ElementsMatch instead of sorting slices before comparison (#34899) 2026-01-13 11:40:03 -04:00
saml.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
saml_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
scheduled_post.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
scheduled_post_test.go Guest cannot add file to post without upload_file permission (#34538) 2026-01-07 10:40:05 -04:00
scheme.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
scheme_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
shared_channel.go Add missing auditRec.Success calls; fix missing return on error. (#34954) 2026-01-27 23:07:53 +00:00
shared_channel_metadata_test.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
shared_channel_remotes_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
shared_channel_test.go Use testify ElementsMatch instead of sorting slices before comparison (#34899) 2026-01-13 11:40:03 -04:00
shared_channel_test_utils.go MM-57326: [Shared Channels] Message priority, acknowledgement and persistent notifications need to be synced (#30736) 2025-06-16 02:30:21 +02:00
status.go Ensure users status is set to offline when deactivated (#30900) 2025-05-29 10:41:14 +02:00
status_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
system.go MM-66789 Restrict log downloads to a root path for support packets (#35014) 2026-01-29 13:29:55 -05:00
system_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
system_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
team.go [MM-66827] Omit invite_id from team creation response based on permissions (#34693) 2026-01-05 13:48:19 +00:00
team_guest_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
team_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
team_test.go [MM-66827] Omit invite_id from team creation response based on permissions (#34693) 2026-01-05 13:48:19 +00:00
terms_of_service.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
terms_of_service_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
upload.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
upload_local.go Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06:00
upload_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
usage.go [MM-60932] Fix errcheck issues in server/channels/api4/usage.go (#28641) 2024-10-09 11:53:25 +02:00
usage_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
user.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
user_local.go [MM-64900] Migrate to use request.CTX instead of context.Context (#33541) 2025-09-18 16:14:24 +02:00
user_test.go [MM-67202] Validate auth method in account switch (#34981) 2026-01-29 16:14:19 +00:00
user_viewmembers_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
webhook.go Add audits for accessing posts without membership (#31266) 2026-01-20 10:38:27 +01:00
webhook_local.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
webhook_test.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00:00
websocket.go [MM-64244] Add websocket disconnect reason metric (#31032) 2025-05-30 08:15:20 -04:00
websocket_norace_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
websocket_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00