Commit Graph

10736 Commits

Author SHA1 Message Date
kosgrz
099e6f74f3 MM-13851 Added a UserWasCreated hook for server-side plugins (#10178) 2019-01-29 18:40:48 +01:00
Carlos Tadeu Panato Junior
d4250f50d8 DB upgrades (#10190)
* uncoment db upgrade to 5.8.0

* add preparatory code for db upgrade 5.9.0

* fix versions

* Update store/sqlstore/upgrade.go

Co-Authored-By: cpanato <ctadeu@gmail.com>
2019-01-29 11:14:00 -05:00
Jesús Espino
d1a758a06e MM-13873: Fix race condition on filesystem licence load (#10196) 2019-01-29 07:57:38 -08:00
Hanzei
8e44f38499 MM-13852 Migrate example manifest to JSON (#10197)
* Migrate example manifest to JSON

* Changes as requested
2019-01-29 07:55:58 -08:00
Gabriel Jackson
58ef6853f1 MM-12359 Add 'command show' CLI command (#10073)
* MM-12359 Add 'command show' CLI command

This new CLI command prints out the detailed information of a given
slash command.

* Fix typo in error returned when moving slash commands

* Move prettyPrint CLI functions to util

* Move prettyPrint CLI tests to util
2019-01-29 08:01:24 +01:00
Hanzei
179e98c245 Fix shadowed variables in various places: Part 2 of 2 (#10176)
This PR fixes shadowed variables in the following packages:
- `app`
- `utils`
- `utils/markdown`
- `services/mailservice`
2019-01-28 21:57:45 +01:00
George Goldberg
58b2a3d16e MM-13796: Don't allow pin/unpin in read-only town square. (#10184) 2019-01-28 20:42:49 +01:00
Miguel de la Cruz
48048f9e95 Starts Elasticsearch and Metrics when running the server. (#10182) 2019-01-28 08:27:46 -08:00
Harrison Healey
26684716aa MM-13664 Cache external link metadata when populating post metadata (#10128)
* MM-13664 Added LinkMetadata types

* MM-13664 Use LinkMetadata when populating post metadata

* Fix unused import

* Fix index name on SQLite

* Finish adding unit tests

* Address feedback

* Increase max length of URL column to 2048 characters
2019-01-28 16:25:08 +01:00
Carlos Tadeu Panato Junior
5c76e90a83 Add timeout for jenkins pipeline (#10180)
* Add timeout for jenkins pipeline

* setting timeout to 1 hour
2019-01-28 14:51:25 +01:00
Elias Nahum
98af5794ad translations PR 20190121 (#10126) 2019-01-28 09:28:39 -03:00
Ashutosh Kumar
9b952dce27 Team restore cli command (#9551)
Adds cli for team restore and team archive.
2019-01-28 13:04:19 +01:00
Daniel Schalla
144686148b Fix order of post list returned (#10183) 2019-01-28 12:20:05 +01:00
Christopher Speller
ce2c7110d3 Switching redirect_location route to use httpservice client and adding caching. (#10118) 2019-01-27 18:24:46 -08:00
Daniel Schalla
b890f8d007 [MM-13820] Optimize flagged post handling in preferences and web handler (#10135)
* Optimize flagged post handling in preferences and web handler
2019-01-26 20:02:46 +01:00
Carlos Tadeu Panato Junior
94e45c3466 add output when creating users using CLI (#10140)
* add output when creating users using CLI

* update per feedback

* update per feedback 2
2019-01-26 17:28:35 +01:00
Carlos Tadeu Panato Junior
0ed9fad78c add output when creating channel using cli (#10138)
* add output when creating channel using cli

* update per feedback
2019-01-26 17:08:21 +01:00
Carlos Tadeu Panato Junior
244e1a5a7a add output when creating webhooks with the CLI (#10139)
* add output when creating webhooks with the CLI

* update per feedback

* update per feedback
2019-01-25 09:39:43 -08:00
Hanzei
6d733e35f7 Fix panicing of ParseSlackAttachment for nil in attachments list (#10141) 2019-01-25 09:31:19 -08:00
Hanzei
c8fab6e313 Fix shadowed variables in app package: Part 1 of 3 (#10000)
* Fix shadowed variables: Part 1

* Remove additional variable

* Fix tests

* Refactor JoinDefaultChannels
2019-01-25 17:40:56 +01:00
Hanzei
16a8db2969 Fix shadowed variables in app package: Part 3 of 3 (#10002) 2019-01-25 17:38:16 +01:00
Hanzei
954112102e Fix shadowed variables in app package: Part 2 of 3 (#10001)
Follow up on #10000
2019-01-25 17:33:21 +01:00
Christopher Speller
9168482623 Update dependencies. (#10136) 2019-01-24 16:35:21 -08:00
Jesse Hallam
8af05aa43a Unit test fixes (#10117)
* eliminate redundant Client/AdminClient declarations

* harden TestUpdateChannelScheme to API failures

* eliminate unnecessary config restoration

* minor cleanup

* make TestGenerateMfaSecret config dependency explicit

* Update api4/user_test.go

Co-Authored-By: lieut-data <jesse.hallam@gmail.com>

* Update api4/user_test.go

Co-Authored-By: lieut-data <jesse.hallam@gmail.com>

* fix fix for TestUpdateChannelScheme...
2019-01-24 12:19:32 -08:00
Harrison Healey
ba5566d1a0 MM-10417 Add local image proxy and enable by default (#9967)
* MM-10417 Add local image proxy and enable by default

* Remove unused function

* Add dependencies for willnorris/imageproxy

* Fixed compilation errors

* Lock to the master version of willnorris/imageproxy

* Fix atmos/camo proxy when no SiteURL is specified

* Re-add default values for deprecated settings

* Fix unit tests added by merge

* Pass imageproxy to App struct

* Remove unneeded locking when creating the image proxy

* Remove empty test file
2019-01-24 16:11:32 -04:00
Nathan Lowe
e961b4cd0d MM-13826 Webhooks: Allow "true"/"false" for bool values in payload body (#10114)
* Webhooks: Allow "true"/"false" for bool values in payload body

Some slack integrations encode bool fields as "true"/"false", which
was previously unsupported in mattermost due to how encoding/json works.
This commit adds an aliased type for bool that implements json.Unmarshaler
to maintain compatibility with Slack.

* Add missing copyright header to added files
2019-01-24 11:36:10 -04:00
Hanzei
684e4cb007 Add props to plugin manifest (#10124) 2019-01-23 08:46:37 -04:00
Harrison Healey
6325c5b569 MM-13718 Prevent files from being attached to multiple posts (#10094)
* MM-13718 Prevent files from being attached to multiple posts

* Switch back to non-batched AttachToPost

* Change status code when failing to attach a file
2019-01-22 12:58:22 -08:00
Jason Blais
f12680103a Update diagnostics and error reporting for Mattermost 5.8 (#10127)
* Remove extension tracking from diagnostics.go

* Add ServiceSettings.TLSStrictTransport to diagnostics.go
2019-01-22 12:29:14 -08:00
Jason Blais
15c98c9e76 Fix extra 's' in "systems administrator" (#10071) 2019-01-18 07:49:47 -05:00
Adzim Zul Fahmi
dfb9241e82 [MM-13750] Add ability to search teams to plugin API (#10116)
Add SearchTeams in plugin/api,
2019-01-16 09:13:15 +01:00
Christopher Speller
ae76d27b7d Migrate cluster to use Server struct directly. (#10101) 2019-01-15 09:09:25 -08:00
Sheshagiri Rao Mallipedhi
004e7d383b MM-13748 Add GetTeamStats to plugin API (#10105) 2019-01-15 10:22:04 +01:00
Jesse Hallam
8ead10effb MM-13276: expose Websocket(URL|(Secure)Port) in limited client config (#10110)
This fixes a race condition client-side that fails to connect to websockets during MFA enforcement since the necessary config data isn't fetched. There are no security concerns in exposing this data to non-authenticated users, though we'd like to revisit this to tighten it down later: https://mattermost.atlassian.net/browse/MM-13785.
2019-01-14 13:54:03 -08:00
Christopher Speller
c208de7c44 MM-13312 Prevent clobbering of new fields by old plugins. (#10087)
* Prevent clobbering of new fields by old plugins.

* Apply suggestions from code review

Spelling and copy paste error.

Co-Authored-By: crspeller <crspeller@gmail.com>
2019-01-14 09:03:16 -08:00
Harrison Healey
97bd145fa3 Add exhaustive tests for AuthorizeOAuthUser (#10070)
* Add exhaustive tests for AuthorizeOAuthUser

* Address feedback
2019-01-12 09:53:27 -05:00
Koki Tomoshige
d9a7db0f19 Fix typo: (*App).CheckForClienSideCert to (*App).CheckForClientSideCert (#10092)
N/A

- [x] Includes text changes and localization file ([.../i18n/en.json](https://github.com/mattermost/platform/blob/master/i18n/en.json) and [.../webapp/i18n/en.json](https://github.com/mattermost/platform/tree/master/webapp/i18n/en.json)) updates
2019-01-11 17:38:34 -05:00
Joram Wilander
8e9df61934 MM-13725 Fix client config overriding MFA enforcement set in limited config (#10095)
* Fix client config overriding MFA enforcement set in limited config

* Add unit test
2019-01-11 15:23:52 -05:00
Pradeep Murugesan
bbee234af0 [GH-7494] Added the role to the user search filter (#9976)
* 7494 added the role to the user search filter

* 7494 changed the getUser function to accept the options

* added the role filter for the getAllProfiles method

* 7494 added the Inactive filter for AllProfiles

* 7494 refactored the where clause generation

* 7494 added the roles and inactive filters for inTeam Query

* 7494 fixed the review comments
2019-01-11 13:50:32 +00:00
Christopher Speller
09a519799f Unregistering plugin commands on disabling of plugin. (#10086) 2019-01-10 15:52:10 -05:00
Martin Kraft
6d30b21dd2 Ldap groups phase1 (#9752)
* Initial models, API, app, and persistence of groups and group syncing.

* Consistent letter casing in ldif.

* Moves group-specific migrations into func.

* Adds API endpoint to retrieve LDAP groups (and associated MM groups) one tree level at a time.

* Adds mattermost group id to SCIMGroup (if available).

* Splits user and group creation so that memberOf works. Returns users from ldap interface.

* Updates method name.

* Returns users IDs instead of User.

* Removes non-essential group data.

* MM-11807: Add GroupFilter to LDAP config. (#9513)

* MM-11807: Add GroupFilter to LDAP config.

* Add diagnostic.

* Adds new config option for using 'memberOf' overlay.

* Adds API endpoint to link a group.

* Removes debug statements.

* Adds unlink group API endpoint.

* Fix to LDAP API. Adds API method to client4 and app.

* Adds some missing app methods. Renames API unexported func.

* Fixes link/unlink API path to accept valid DNs.

* Allow any character for DN portion of path.

* Switches from DN to objectGUID or entryUUID as the remote identifier linking LDAP groups to MM groups.

* Formatting.

* Formatting.

* Setting group name field to an ID for phase 1.

* Adds an LDAP config field to Setting up configuration for local LDAP.

* Changes to LDAP and GroupStore interfaces.

* Draft of nesting groups in API response.

* Removes unnecessary tree models.

* Updates group membershipt create store method to also restore.

* Adds new config to test config.

* Accept AD format length.

* Switches to SetUniqueTogether method.

* Updates revert.

* Tweaks to syncing queries .

* Updates query for pending team and channel memberships.

* Removes old GroupSyncableScanner usage. Some formatting and renaming.

* Fixes bug setting syncable type in selecting paged.

* Adds tests for syncables populator.

* Only add users to teams and channels that are not deleted.

* Renames method.

* Updates test LDAP setup.

* Removes memberof config stuff.

* Renames.

* Updates test data.

* Fix for gofmt.

* Adds missing license.

* Adds missing teardowns.

* Test fix.

* Adds a cycle to the groups test data.

* Changes API to return flat list.

* Removes some unused interface and app methods.

* Returns empty braces if results are empty.

* Adds more LDAP test data.

* Fix for test data error.

* Adds error.

* Moves test groups.

* Adds OU for load test data.

* Moves load test ou creation to load data.

* Adds a new bool flag to SCIMGroups.

* Removes SCIMGroup completely.

* Removes FULL JOIN because it is not supported in MySQL.

* Adds tests for sync queries; renames constant.

* Bad merge fix.

* Vet fix.

* Returning OK on delete ldap group link

* Removes foreign key constraints.

* Adding total to the ldap getAllGroups api endpoint

* Adds get group members page.

* Removes pagination from groups syncables list API.

* Adding syncable check now that foreign key constraint is removes.

* Joins teams and channels to group syncables.

* Adds group member count.

* Adding GetAllChannels and SearchAllChannels for system admins only

* Fix.

* Test fix from pagination removal.

* Orders groupmembers by createat.

* Fixing search of all channels

* Test fix after removing pagination.

* JSON syntax error fix.

* Changing tests (for now) pending investigation.

* Adding GetAllChannels and SearchAllChannels tests for the store

* Adding GetAllChannels and SearchAllChannels API tests

* Omit empty JSON values of group syncables.

* Fixing GetAllChannels and SearchAllChannels tests

* Fixing GetAllChannels and SearchAllChannels store tests

* Fixing GetAllChannels api tests

* Adds 'LDAP groups' feature flag. (#9861)

* Migrate new client functions to idiomatic error handling

* Test fixes.

* Simplification of groups api (#9860)

* Simplification of groups api

* Fixing RequireSyncableType

* Test fix.

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Update api4/group.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Fix copy/paste error.

* Fix copy/paste error.

* Adds missing return, changes to correct HTTP status code.

* Adds missing return, changes status codes.

* Check for license.

* Renames variable for new signature.

* Adds client method to get a group.

* Adds client method and tests for PatchGroup.

* Adds more API tests.

* Adds groups API tests.

* Adds client method and tests for getting group syncables.

* Adds tests for patching group teams and channels.

* Update to translations.

* Removes test.

* Fix incorrect conditional.

* Removes unnecessary nil check.

* Removes unnecessary return.

* Updates comment, removes unused variable.

* Uses consistent JSON unmarshal pattern.

* Uses consistent JSON unmarshal pattern.

* Moves const block.

* Switches 'already linked' from error to success response.

* Removes commented-out code.

* Switched to status ok.

* Add parens for readability.

* Fix copy/paste error.

* Unexport some structs.

* Removes repeated validity check.

* Return without attempting commit if there's a rollback.

* Fix incorrect HTTP status code.

* Update store/sqlstore/group_supplier.go

Co-Authored-By: mkraft <martinkraft@gmail.com>

* Adds utility methods for going from groupsyncable to groupteam and groupchannel.

* Fixing george suggestions (#9911)

* Test fix.

* Adds QA data to VC with visualization.

* Fixes typo in graph image.

* Update display name when re-linking in case it has changed in LDAP.

* Adds ability to configure group display name and unique identifier. (#9923)

* Adds ability to configure group display name and unique identifier.

* Adds some configs to confi-ldap make command.

* Fix for move of session.

* Exposes method for use by SAML package.

* Switches GroupSyncableType from int to string.

* Update Jenkins build files.

* Removes unused variable assignment.

* Removes old unnecessary early return.

* Removes unnecessary variable.

* Moves param parsing before license and permissions checks.

* Removes old code.

* Compares agains underlying error rather than error id.

* Switches tests to assertions.

* Adds more assertions.

* Adds missing return.

* Adds space after comma for added legibility.

* Moves a view model to the api package.

* Unexports method.

* Uses id validator function.

* Fix docker-compose flag.

* Typo fix.

* Moves index creation to supplier.

* Removes bad merge.

* Renames parameter.

* Re-adds space.

* Removes unnecessary transaction.

* Escapes the Groups table name with backticks because it is a reserved keyword.

* Fix roles cache bug

* Removing unnecesiary deserializing function

* Switches table name rather than custom SQL everywhere for Postgres without backticks.

* Removes redundant check for sql.ErrNoRows.

* Removes redundant check for sql.ErrNoRows.

* Removes data integrity check and redundant nil conditional.

* Removes redundant check for sql.ErrNoRows.

* Removes unnecessary query.

* Removes ID length validation from persistence tier.

* Makes some supplier methods idempotent.

* Removes some empty switch defaults.

* Renames Group Type field to Source.

* Fix for mistaken field name change.

* Uses IsValidId function.

* Removes comment.

* Changes json key name.

* Removes test because no longer validating user.

* Moves model state validation to app layer.

* Don't create Groups.CanLeave column until phase 2.

* Removes state validation until properties are used in phase 2.

* Removes duplicated check.

* Removes state validation until properties are used in phase 2.

* Removes some tests until phase 2.

* Comment-out a bunch of test related to CanLeave.

* Extra unmarshal validation check. Removes more code for CanLeave.

* Removes tests for CanLeave.

* Explict error msg.

* Rewrite queries.

* Changes index name. Adds index.

* Removes assertion.

* Adds experimental feature flag.
2019-01-10 15:17:31 -05:00
Carlos Tadeu Panato Junior
f8b87cbe2d Add SendMail to plugin API (#10082)
* Add SendMail to plugin API

* Update per feedback

Co-Authored-By: cpanato <ctadeu@gmail.com>
2019-01-10 10:06:14 +01:00
Harrison Healey
1a3ccaf305 MM-13606 Remove consumeAndClose and clean up integration response handling (#10066)
* MM-13606 Remove consumeAndClose

* Allow overriding HTTPService's request timeout

* MM-13606 Clean up integration response handling

* Properly close httptest servers

* Address feedback

* Only call buf.Bytes when necessary

* Properly check for errors in doOutgoingWebhookRequest

* Add comment explaining ignored ioutil.ReadAll errors
2019-01-09 17:07:08 -05:00
Michael Kochell
e67fe4c89d handle errors in HandleCommandResponse method (#9888) 2019-01-09 15:41:53 -05:00
Jesse Hallam
66d174d80b Fix various unit tests (#10079)
* fix spurious TestMuteCommandSpecificChannel test failure

See
https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw

* fix race in TestExportUserChannels

* TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
2019-01-09 14:01:24 -05:00
Yusuke Nemoto
343a1d67e9 Add periods to docs (#10068) 2019-01-09 13:29:26 -05:00
Jesse Hallam
fa6f7f3a62 MM-13678: fix web hub deadlock (#10081)
The websocket hub, on stopping, closes all associated websocket connections, and each connection
in turn tries to unregister itself with the hub, but this naturally creates a deadlock.

This PR reverts the line commented (incorretly...) at
https://github.com/mattermost/mattermost-server/pull/9863/files#r235583929.
2019-01-09 10:14:08 -08:00
Joram Wilander
df076b457a Move MFA enforcement setting into limited client config (#10077) 2019-01-09 12:19:56 -05:00
Lev
643c54e808 MM-13659 More error checks for NewRequest (#10080) 2019-01-09 09:16:32 -08:00
Miguel Alatzar
6b59ab4ee8 [MM 12373] Create CLI command "webhook modify-outgoing" (#10028)
* Add test for modifying outgoing webhook

* Add command to modify an outgoing webhook

* Use updated test helper

* Use errors.Wrap

* Lower case error strings and use fmt.Errorf

* Clone webhook into updatedHook

* Rename error variables
2019-01-08 14:10:19 -05:00