mattermost/server/channels/api4
Rajat Dabade c7f6efdfb0
Guest cannot add file to post without upload_file permission (#34538)
* Guest cannot add file to post without upload_file permission

* Move checks to api layer, addd checks in update patch post scheduled post

* Minor

* Linter fixes

* i18n translations

* removed the duplicated check from scheduled_post app layer

* Move scheduled post permission test from app layer to API layer

The permission check for updating scheduled posts belonging to other
users was moved from the app layer to the API layer in the PR. This
commit moves the corresponding test to the API layer to match.

* Move scheduled post delete permission check to API layer

Move the permission check for deleting scheduled posts from the app
layer to the API layer, consistent with update permission check.
Also enhance API tests to verify posts aren't modified after forbidden
operations.

* Fix inconsistent status code for non-existent scheduled post

Return StatusNotFound instead of StatusInternalServerError when a
scheduled post doesn't exist in UpdateScheduledPost, matching the
API layer behavior.

* Fix flaky TestAddUserToChannelCreatesChannelMemberHistoryRecord test

Use ElementsMatch instead of Equal to compare user ID slices since the
order returned from GetUsersInChannelDuring is not guaranteed.

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Jesse Hallam <jesse@mattermost.com>
2026-01-07 10:40:05 -04:00
..
access_control.go [MM-65956] Tweak auto add to make it consistent with child policies (#33990) 2025-11-19 20:18:45 +00:00
access_control_local.go [MM-65956] Tweak auto add to make it consistent with child policies (#33990) 2025-11-19 20:18:45 +00:00
access_control_test.go [MM-65956] Tweak auto add to make it consistent with child policies (#33990) 2025-11-19 20:18:45 +00:00
agents.go Add common code for AI workflows (#34381) 2025-11-04 10:16:43 -05:00
api.go Add common code for AI workflows (#34381) 2025-11-04 10:16:43 -05:00
apitestlib.go [MM-61758] Burn on read feature (#34703) 2025-12-11 07:59:50 +01: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 MM-66424: Improve team filtering in common teams API (#34454) 2025-12-15 15:06:48 -04:00
channel_bookmark.go MM-63240: Always allow viewing archived channels (#32162) 2025-08-15 13:50:20 -03: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 Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
cloud.go Add support for dynamic fetching of preview modal content from S3 bucket (#33380) 2025-07-15 12:58:18 -04:00
cloud_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01: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 Integration permission management changes (#34421) 2025-11-13 11:12:30 +00: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 Bor post disable flagging (#34759) 2025-12-22 12:25:54 +05:30
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 Replace Hard-coded HTTP Verbs with Constants (#27219) 2024-07-15 08:52:03 -06: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 Content flagging file downloads (#34480) 2025-11-19 14:22:07 +05:30
file_test.go Content flagging file downloads (#34480) 2025-11-19 14:22:07 +05:30
group.go MM-66071: Do not error on empty slice in /groups/names (#34021) 2025-10-02 09:59:09 +02: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 Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01: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-64486: Remove telemetry (#33606) 2025-09-04 18:46:18 +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 Dynamic Select for Interactive Dialog (#33586) 2025-08-28 07:47:28 -06: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 Guest cannot add file to post without upload_file permission (#34538) 2026-01-07 10:40:05 -04: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 Guest cannot add file to post without upload_file permission (#34538) 2026-01-07 10:40:05 -04:00
post_utils.go Guest cannot add file to post without upload_file permission (#34538) 2026-01-07 10:40:05 -04:00
preference.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
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 fix: reaction errcheck issues (#28513) 2024-10-08 09:25:34 +02:00
reaction_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
remote_cluster.go use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
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 cursor-based Posts Reporting API for compliance and auditing (#34252) 2025-11-17 09:02:19 -07: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 Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01: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 Guest cannot add file to post without upload_file permission (#34538) 2026-01-07 10:40:05 -04: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 use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
shared_channel_metadata_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +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 Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01: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-64485] Remove separate notification log file (#33473) 2025-08-20 10:17:45 +02: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 use consts for audit events (#33433) 2025-07-16 10:17:03 +05:30
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 [MM-66708] Disallow interacting with password and login method for magic link accounts (#34615) 2025-12-11 17:38:39 +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-66757: Improve WebSocket user update events (#34600) 2025-12-10 15:15:31 -04:00
user_viewmembers_test.go Fix errcheck linter errors in helpers (#31578) 2025-11-12 13:00:51 +01:00
webhook.go Integration permission management changes (#34421) 2025-11-13 11:12:30 +00: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