Commit Graph

10813 Commits

Author SHA1 Message Date
George Goldberg
a69ce6d64d MM-14845: Updates default permissions. (#10590) 2019-04-12 18:00:57 +01:00
George Goldberg
e5e1c5c027 Remove no longer used enterprise string to fix build. (#10600) 2019-04-12 17:24:54 +01:00
Martin Kraft
100433f4cc MM-14757/14758: Restricts deleting team and channel members if the team or channel is group constrained. (#10553)
* MM-14757/14758: Update APIs to reject removals from group-constrained teams.

* MM-14757/14758: Tests API changes.

* MM-14757/14758: Allow users to leave channals and teams.

* MM-14757/14758: Updates translation key order.

* MM-14757/14758: Adds user to team before setting it to group-constrained b/c of new add restrictions.
2019-04-12 10:15:46 -04:00
Lev
f93ba3cd23 MM-14795 Added "from_webhook" to protected props in DoPostAction (#10593)
Per @hanzei's request https://github.com/mattermost/mattermost-server/pull/10546#issuecomment-481997493
https://mattermost.atlassian.net/browse/MM-14795
2019-04-11 16:35:29 -07:00
Jesús Espino
57a3281fea Moving the creation of the new bot permissions to permissions migrations (#10588) 2019-04-11 19:03:05 +02:00
Jesús Espino
5dee75553d MM-15006: Returning informative errors on config validation (#10585)
* MM-15006: Returning informative errors on config validation

* Adding new unit test verifying the validation and correct response
2019-04-11 08:57:25 +02:00
Lev
2e7080e68d Mitigated MM-14084 - Handling of PostAction Update props (#10546)
* Mitigated MM-14084 - Handling of PostAction Update props. Also fixed MM-14795.

- Added logic to preserve the original post's Props in their entirety
  if integration's Update.Props == nil
- Removed mandatory setting of "from_webhook"
- TODO: ?? Extend the list of protected props?

* Preserve IsPinned, HasReactions

- and so much for the tests, fixed a previous bug where UpdatePost was
not in the right place.

* Improved comments and names, as per feedback

* Added test for IsPinned, HasReactions as perfeedback
2019-04-10 16:41:29 -07:00
Harrison Healey
a5501cf3f8 MM-15302 Don't get post embeds with link previews disabled (#10587)
* MM-15302 Don't get post embeds with link previews disabled

* Enable link previews for other metadata tests
2019-04-10 15:48:15 -04:00
Christopher Speller
41d117c37b MM-14617 Dependency upgrades and adding modules support. (#10517)
* Dependency upgrades and adding modules support.

* Commenting out file tests playload verification portion.

* Fixing viper.

* Fixing hclog.
2019-04-10 07:56:17 -07:00
Martin Kraft
bd8a54bb08 MM-14811: Accepts Server rather than App in account migration interface registration. (#10568) 2019-04-10 06:04:07 -04:00
Joram Wilander
2d4d19837b Remove LogSettings.FileFormat after it was accidentally added back (#10569) 2019-04-09 12:42:24 -04:00
Carlos Tadeu Panato Junior
6bcd30d53a fix order (#10580) 2019-04-09 16:29:33 +02:00
Fernando Correa Neto
02bd35247b [MM-14779] Investigate flaky TestExportGMandDMChannels (#10534)
* fix flaky test by sorting by Type and also change helper to increase
precision in CreateAt

* better strategy is to get a smaller number

* user nanonseconds as milisenconds proved to be a bit problematic for
unit tests

* revert changes in helper function and create posts in a more controled way

* use the original value

* make post instantiation more clear
2019-04-09 09:47:41 -04:00
Martin Kraft
7bde0378cd MM-14753: Verifies that user can join teams and channels in spite of group constraints. (#10529)
* MM-147753: Verifies that users are allowed to be members of a team or a channel, based on group constraints, prior to allowing the API to add them.

* MM-14753: Allow methods to return meaningful results for deleted teams or channels.

* MM-14753: Renames methods to differentiate from permissions and other team and channel restrictions.

* MM-14753: Only check if users are team/channel members if team/channel is group constrained.

* MM-14753: Updates test function names.

* MM-14753: Changes a few method signatures.

* MM-14753: Small refactor and adds missing returns.

* MM-14753: Changes method names from Get* to Filter* name prefixes.

* MM-14753: Renames error variables.

* MM-14753: Updates method names for consistency with join table names.

* MM-14753: Adds case for non AppError return.

* Update i18n/en.json
2019-04-09 07:09:57 -04:00
Jesús Espino
43fa7e0548 Adding the client part of the new endpoint to invalidate email invites (#10561) 2019-04-09 11:55:39 +02:00
Jesús Espino
b1f73109de Removed confusing and obsolete comment (#10549) 2019-04-09 10:31:22 +01:00
James Vasky
1a102e13c8 MM-12358 Create CLI command "command modify" (#10538)
* Added ability to modify a command using the CLI

* Added ability to modify a command using the CLI

* Added TestModifyCommand to command_test.go and unit tests for new modify command

* Added ability to modify a command using the CLI

* Added TestModifyCommand to command_test.go and unit tests for new modify command
2019-04-09 10:27:15 +01:00
Carlos Tadeu Panato Junior
40b97a1a4f add check i18n en.json to the pipeline (#10557) 2019-04-09 11:22:54 +02:00
Jesús Espino
9fa6b093f3 Fixing permissions checks where related to join public channels (#10511)
* Fixing permissions checks where related to join public channels

* Addressing PR review comments

* Fixing bug

* Adding new tests

* Addressing PR review comments
2019-04-08 11:10:16 +02:00
Jesús Espino
9b73d34eaa Fixing translations (#10560)
* Fixing translations

* Add elasticsearch translations

* Adding more translations
2019-04-05 17:04:25 +02:00
happygaijin
ba34b4607c MM-14575 - Automatically serve static files for plugins (#10476)
* MM-14575 - Automatically serve static files for plugins
* Added static handler for plugin public files
* Added StaticFilesPath method to Environment for use by MainRouter
* Added "static_files" property to Manifest Server
* Added unit tests for these changes

* MM-14575: Adding comment for cache control value

* MM-14575: Moved Static Plugin Request handler to plugin_requests
* Updated testing

* MM-14575: Removing the StaticFiles from Manifest Server

* MM-14575: Removing static files from test

* MM-14575: Updating static files test

* MM14575: Removing cache directive from plugin static files

* MM14575: Moving plugin public directory to root

* MM-14575: Updating tests for changed public directory

* MM-14575: Moved compileGo to a common utils package for tests

* MM-14575: Moving plugins initialization to InitPlugins find in tests

* Update utils/test_files_compiler.go

Adding Copyright header

Co-Authored-By: happygaijin <happygaijin@users.noreply.github.com>

* MM-14575: Consistent usage of static vs public name

* Removing spurious newline

* Comment typo

Co-Authored-By: happygaijin <happygaijin@users.noreply.github.com>

* Removing spurious new line

Co-Authored-By: happygaijin <happygaijin@users.noreply.github.com>

* MM14575: Adding a test to make sure only public files can be requested

* MM-14575 Adding a test for redirects on public files
2019-04-05 10:35:51 -04:00
Daniel Schalla
7c9837d9b1 [MM-14846] Update EditAt for FileIds and Attachment in Post + Ignore FileIds Updates (#10540)
* Set EditAt for FileIds and Attachments; Disallow update/patch of FileIds in API Handler

* Add custom comparison methods for StringArray and Post Attachments

* gofmt

* Split up comparison function to child structs

* Naming consistency

* gofmt
2019-04-04 20:01:21 +02:00
Daniel Schalla
41fe33bbb1 Avoid panic from reading CSRF of nil session pointer (#10554)
* Avoid panic from reading CSRF of nil session pointer

* Reorganize CSRF Handling

* Remove autoimport added by IDE

* Remove unnecessary nil check

* gofmt
2019-04-04 18:24:40 +02:00
Harrison Healey
24c8fdb1fa Update .editorconfig (#10518)
* Update .editorconfig

* Remove webapp-specific entries from .editorconfig
2019-04-04 09:49:07 -04:00
d28park
0edad1c3fa [MM-13895] Implement config migration command (#10508)
* [MM-13895] Implement config migration command

* Discarding unused error
2019-04-04 08:15:51 +02:00
Lev
7272864bea Fixed MM-14627, was incorrectly removing props from updated post (#10545)
* Fixed MM-14627, was incorrectly removing props from updated post

- Fixed the wrong initialization of `remove`
- Consolidated the list of properties to retain in `model.PostActionRetainPropKeys`
- Added a test

* Not sure why this broke the test, reverted the change
2019-04-02 15:13:27 -07:00
Christopher Speller
0e6f335f74 Exempting bot accounts from MFA requirements. (#10527) 2019-04-02 13:27:49 -07:00
George Goldberg
0bef611f7a MM-14845: Fix Update and Patch channel for private channels. (#10539)
* MM-14845: Fix Update and Patch channel for private channels.

* Add additional failure case checks.
2019-04-02 22:09:48 +02:00
Christopher Speller
866e3fb10c Fixing prepackaged plugin build process. (#10547) 2019-04-02 22:05:41 +02:00
Miguel de la Cruz
2ce48aa6d1 Adds the endpoints and store logic to get groups by team and by channel (#10502)
* Adds the endpoints and store logic to get groups by team and by channel

* Remove TODO comments

* Fix unit tests
2019-04-02 21:02:51 +01:00
Martin Kraft
25fd962016 MM-14412: Enables force removals of team/channel members base on group constraints. (#10490)
* MM-14412: Enables force removals of team/channel members base on group constraints.

* Renames some existing methods and variables.

* Change return types to ChannelMembers and TeamMembers for some existing methods.

* Adds option to change LDAP_DATA to either 'qa' or 'test' with env variable.

* Adds methods to retrieve ChannelMembers and TeamMembers that, based on group constraints, should be deleted.

* Adds helper functions to create GroupTeams and GroupChannels.

* MM-14412: Switches to helper methods for GroupSyncable creation in test files.

* MM-14412: Style fix.

* MM-14412: Switches remaining GroupSyncable instances to be created with helper functions.

* MM-14412: Typo fix.

* MM-11412: Build fixes.

* MM-14412: Checks if user is team member before re-adding.

* MM-14412: Update for change of GroupConstrained fields type.
2019-04-02 09:22:50 -04:00
Jesse Hallam
cee65379c7 add diagnostics for EnableClickToReply and RestrictSystemAdmin (#10506)
<!-- Thank you for contributing a pull request! Here are a few tips to help you:

1. If this is your first contribution, make sure you've read the Contribution Checklist https://developers.mattermost.com/contribute/getting-started/contribution-checklist/
2. Read our blog post about "Submitting Great PRs" https://developers.mattermost.com/blog/2019-01-24-submitting-great-prs
3. Take a look at other repository specific documentation at https://developers.mattermost.com/contribute
-->

#### Summary
Add diagnostics for EnableClickToReply and RestrictSystemAdmin.

#### Ticket Link
https://mattermost.atlassian.net/browse/MM-14687
https://mattermost.atlassian.net/browse/MM-14688
<!--
If this pull request addresses a Help Wanted ticket, please link the relevant GitHub issue, e.g.

  Fixes https://github.com/mattermost/mattermost-server/issues/XXXXX

Otherwise, link the JIRA ticket.
-->
2019-04-01 14:23:49 -04:00
Lev
0f062367b5 Fixed error message displayed for FileWillBeUploaded rejections (#10535)
#### Summary
Fixed the error message displayed when an uploading file gets rejected by a plugin's FileWillBeUploaded hook.

#### Ticket Link
https://mattermost.atlassian.net/browse/MM-14803
2019-04-01 12:24:37 -04:00
Eli Yukelzon
0e534c8a49 MM-14559 Rewrite existing plugin API tests to exclusively test via actual plugin (#10494)
* initial work on rewriting test cases using the raw literal format

* split out the embedded tests into separate file and implement the test using a generic tester function

* initial work on rewriting test cases using the raw literal format

* split out the embedded tests into separate file and implement the test using a generic tester function

* moved tests to separate dir to avoid conflicts

* removed duplicate files

* added license header

* fixed plugin paths

* moved all trivial tests to separate files
created "meta-test" that scans a folder of api tests and runs them

* remove rpc tests from make

* use fileutil.FindDir instead of pwd
clean up the test files
2019-04-01 08:39:45 -07:00
Martin Kraft
d14235b4e0 MM-14590: Adds license check to LDAP test and LDAP sync API endpoints. (#10519)
* MM-14590: Adds license check to LDAP test and LDAP sync API endpoints.

* MM-14590: Improves the LdapSync and LdapTest API tests.
2019-04-01 10:48:58 -04:00
Jesús Espino
4c8bac38bb MM-14243: Remove any unused PERMANENT_DELETE_USER permission (#10516) 2019-03-29 16:33:40 +01:00
Martin Kraft
020ba82cdb MM-14768: Switches field type from sql.NullBool to a bool pointer. (#10526) 2019-03-29 09:42:25 -04:00
Jason Blais
a186592257 Update LICENSE.txt (#10512)
The `config/` folder is licensed under Apache 2.0.

Previously, this folder contained data files for default.json and timezones.json. However, in the past month, we have repurposed the config folder, which will autogenerate the config file in an upcoming release.

To account for the restructuring of the config folder, `config/` is no longer considered to be licensed with Apache 2.0. In the near term, we'll keep `config/default.json` licensed under Apache 2.0 for compatibility with previous releases, and then later remove it from the list once `default.json` is replaced with the auto-generation of the config file.
2019-03-27 14:05:34 +01:00
Harshil Sharma
f84be43937 Returned User TermsOfService Data in Certain GetUser APIs To Be Used on Webapp for Decicion Making (#10478)
* Used user TOS data embedded in user object itself

* #MI-372 Added user TOS data in getUserByUsername API and updated tests

* #MI-372 returned user TOS data only for admin or self

* #MI-372 fixed tests

* #MI-372 added user ID checks in a missing place
2019-03-27 14:01:35 +01:00
Christopher Speller
f17de7929b Setting bot accounts image to specific image. (#10497)
* Setting bot accounts image to specific image.

* A couple more places to change default.
2019-03-26 15:43:24 -07:00
Daniel Schalla
d89d931b1e Toggle DisableLegacyMFA to true by default (#10504) 2019-03-26 23:24:32 +01:00
Julien Reichardt
64562d53c0 Build tooling enhancements (#10429)
* Add LDFLAGS variable

* Replace curl by wget

* Revert "Replace curl by wget"

This reverts commit f40323c3d2.

* Use curl instead of wget

* Merge GO_LINKER_FLAGS into LDFLAGS
2019-03-26 15:19:12 -07:00
Christopher Poile
7f7f511d1c MM-11697: Environment overrides do not overwrite config.json on save (#10413)
* MM-11697: Environment overrides do not overwrite config.json on save
#10388

The config store now keeps a copy of the config as loaded from the store
without environment overrides. Whenever persisting, we now check if the
current setting is different from the loaded setting. If it is, then use
the loaded setting instead.

As described in the comments to `removeEnvOverrides` in `common.go`,
this behavior will have to change if we ever let the user change a
setting that has been environmentally overriden.

This was interesting because the `load` function in `common.go` also
persists, so we have to tee the provided `io.ReadCloser` and construct a
config that doesn't have the environment overrides. And then we have to
find the path to the (maybe) changed variable in the config struct
using reflection.

Possible WIP: I had to expose a `GetWithoutEnvOverrides` function in the
Store interface just for the tests -- this is because the `file_test`
and `database_test`s are in the config_test package instead of the
`config` package.

* added function documentation

* fixed a small problem with tests

* MM-11697: big cleanup based on Jesse's PR comments

* MM-11697: edits per PR feedback

* MM-11697: licence header

* MM-11697: now testing that on disk config is not changed by env
overrides

* MM-11697: remove unneeded exports
2019-03-26 13:28:41 -07:00
Carlos Tadeu Panato Junior
7b35242ad9 prepare db upgrade to 5.11 (#10510) 2019-03-26 21:06:40 +01:00
Miguel Alatzar
dd3c7b2f0e [MM-13744] Enable NPS plugin if prepackaged (#10485)
* Enable NPS plugin if prepackaged

* Enable NPS plugin in config.go
2019-03-26 12:04:12 -07:00
Jesús Espino
c370d30041 MM-14748: Allow to invalidate email invites (#10509) 2019-03-26 19:30:49 +01:00
Carlos Tadeu Panato Junior
3c8975780d upgrade database to 5.10.0 (#10507) 2019-03-26 13:08:25 -04:00
Christopher Speller
50ef597a69 Fixing GetLDAPUserAttributes to work with SAML as well. (#10498) 2019-03-26 08:36:35 -04:00
George Goldberg
c3c8b28eb7 MM-14626: Make license expiry checks behave how they are meant to. (#10495) 2019-03-26 10:32:59 +00:00
Hanzei
eaeede66b2 Update pull request template (#10142)
* Update pull request template

* Changes as requested

* Link to https://developers.mattermost.com/contribute/server/developer-workflow/#running-only-specific-server-unit-tests

* Move PR and issue template to .github

* Update per feedback

See https://community.mattermost.com/core/pl/1ikmqhzw1ffsfepzyb4575bkih

* Changes as requested

* Remove checklist
2019-03-22 08:31:02 -04:00