Commit Graph

9861 Commits

Author SHA1 Message Date
George Goldberg
60cf74352f MM-10140: API Implementation for Schemes related Endpoints (#8615)
* Implement basic scheme CRUD endpoints.

* Get All Schemes (Paged) Endpoint and store plumbing.

* Add get teams/channels for schemes.

* Fix unit tests.

* Review fixes.

* More review fixes.
2018-05-03 09:00:26 -04:00
Martin Kraft
7d5e85e413 Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-02 07:45:20 -04:00
Martin Kraft
f4dcb4edf2 MM-10182 & MM-10183: Adds channel scheme and team scheme API endpoint. (#8680)
* MM-10183: Adds channel scheme API endpoint.

MM-10182: Adds team scheme API endpoint.

MM-10182_3: Switch from scheme_id in path to body.

* MM-10182/MM-10183: Changes path from 'schemes' to 'scheme'.

* MM-10182: Fix merge error.
2018-05-02 07:31:14 -04:00
Martin Kraft
d2cc0c5834 Merge branch 'advanced-permissions-phase-2' of github.com:mattermost/mattermost-server into advanced-permissions-phase-2 2018-05-01 19:00:15 -04:00
Martin Kraft
ff6c42309c Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-01 18:59:20 -04:00
Joram Wilander
529807c1ba Update zoom plugin to 0.1.6 (#8698) 2018-05-01 07:35:27 -07:00
Jesse Hallam
1e6553704d MM-8622: improved plugin error handling (#8692)
* don't report an error on plugin activation if already active

* improved plugin logging events

Log an error when a plugin's ServeHTTP fails, or when it unexpectedly
terminates.

Restart a plugin at most three times, allowing its failure to later
bubble up under the "failed to stay running" status.

* clarified plugin activation/deactivation

Avoid repeatedly activating when any configuration bit changes. Improved
logging.

* constrain plugin ids to ^[a-zA-Z0-9-_\.]+$ and enforce minimum length

Previously, the plugin id was used unsanitized to relocate the plugin
bundle, which allowed writing outside the `plugins/` directory by using
an `id` containing `../`.

Similarly, an empty string was accepted as an id and led to unexpected
error messages.

* remove plugins by manifest path, not id

If the id within the manifest ever diverges from the actual plugin
location, it becomes impossible to remove via the API. Instead, if the
plugin is found by id, remove the path containing the manifest.

* ignore plugins with nil manifests

If a plugin was detected, but had a manifest that couldn't be parsed, it
will be left nil but still be listed among the packages. Skip over these
in most cases to avoid segfaults.

* leverage mlog more effectively for plugins

* build issues
2018-05-01 07:34:12 -07:00
Elias Nahum
3b57422c5f translations PR 20180430 (#8696) 2018-05-01 11:07:56 -03:00
Jesús Espino
baba8fa92f Upgrading minio-go library to 6.0.0 (#8651)
* Upgrading minio-go library to 6.0.0

* Removing unnecesary Gopkg constraint
2018-04-30 14:35:10 -07:00
Derrick Anderson
a5f006b8a9 Revert "MM-9770: rewrite getParentsPosts to improve performance (#8467)" (#8659) (#8694)
This reverts commit 4b675b347b.
2018-04-30 16:06:06 -04:00
Hyeseong Kim
e73f1d7314 MM-9072/MM-10185 Force-convert the encoding of OpenGraph metadata to UTF-8 (#8631)
* Force-convert non-UTF8 HTML to UTF8 before opengraph processing

* Split the force-encoding function

* Add benchmark Test for the forceHTMLEncodingToUTF8()

```
Running tool: /home/comet/go-v1.9.2/bin/go test -benchmem -run=^$ github.com/mattermost/mattermost-server/app -bench ^BenchmarkForceHTMLEncodingToUTF8$

[03:32:58 KST 2018/04/21] [INFO] (github.com/mattermost/mattermost-server/app.TestMain:28) -test.run used, not creating temporary containers
goos: linux
goarch: amd64
pkg: github.com/mattermost/mattermost-server/app
BenchmarkForceHTMLEncodingToUTF8/with_converting-4         	  100000	     11201 ns/op	   18704 B/op	      32 allocs/op
BenchmarkForceHTMLEncodingToUTF8/without_converting-4      	  300000	      3931 ns/op	    4632 B/op	      13 allocs/op
PASS
ok  	github.com/mattermost/mattermost-server/app	2.703s
Success: Benchmarks passed.
```

* Remove an unnecessary constraint

* Add pre-check if content-type header is already utf-8

* Move the checking for utf-8 into forceHTMLEncodingToUTF8() for testing

* Revert df3f347213faa0d023c26d201fa6531f46391086..HEAD, without Gopkg.lock
2018-04-30 09:54:11 -07:00
Christopher Speller
9c5815ee41 Add stdlog interpreter. (#8691) 2018-04-30 08:18:04 -07:00
Jason Blais
2f175001b4 Add missing diagnostics for 4.10 (#8675)
* Add missing diagnostics for 4.10

* Add missing ":"
2018-04-30 10:37:15 -04:00
Elias Nahum
37d89d3955 translations PR 20180424 (#8662) 2018-04-30 08:33:44 -03:00
Saturnino Abril
30011f67e8 [MM-10354] Add feature to remove team icon (#8684)
* set team.LastTeamIconUpdate to 0 when removing team icon

* add APIv4 for removing team icon

* removed comment and updated typo on AppError
2018-04-30 17:57:57 +08:00
Christopher Speller
aa42ed8aba Fixing structured logging conflicts. 2018-04-27 14:26:58 -07:00
Christopher Speller
eb9ff34fcf Merge branch 'master' into advanced-permissions-phase-2 2018-04-27 14:12:01 -07:00
Christopher Speller
2e6b3da1d3 Fixing some merge conflicts with structured logging. (#8685) 2018-04-27 13:31:50 -07:00
Christopher Speller
686c2fbab7 Structured logging (#8673)
* Implementing structured logging

* Changes to en.json to allow refactor to run.

* Fixing global logger

* Structured logger initalization.

* Add caller.

* Do some log redirection.

* Auto refactor

* Cleaning up l4g reference and removing dependancy.

* Removing junk.

* Copyright headers.

* Fixing tests

* Revert "Changes to en.json to allow refactor to run."

This reverts commit fd8249e99b.

* Fixing some auto refactor strangeness and typo.

* Making keys more human readable.
2018-04-27 12:49:45 -07:00
Corey Hulen
2acbc77d78 MM-10375 Fixing connected socket count (#8682)
* Fixing connected socket count

* Adding unit test
2018-04-27 10:38:40 -07:00
George Goldberg
2386acb3dd Merge branch 'master' into advanced-permissions-phase-2 2018-04-27 10:53:38 +01:00
Jesse Hallam
7abd6176e9 modestly extend SQLite support (#8677)
This is primarily to unblock the advanced permissions merge. There's
still more work to do if we wanted this to be mainstream, but as it's
mainly for unit tests, I'm just focussing on the minimum.
2018-04-27 10:07:36 +01:00
Jesse Hallam
6d50d836f5 MM-10232, MM-10259: Improve error handling from invalid json (#8668)
* MM-10232: improve error handling from malformed slash command responses

Switch to json.Unmarshal, which doesn't obscure JSON parse failures like
json.Decode. The latter is primarily designed for streams of JSON, not
necessarily unmarshalling just a single object.

* rework HumanizedJsonError to expose Line and Character discretely

* MM-10259: pinpoint line and character where json config error occurs

* tweak HumanizeJsonError to accept err first
2018-04-26 11:19:25 -04:00
james-mm
d3f09b54e2 Update ISSUE_TEMPLATE.md (#8292)
* Update ISSUE_TEMPLATE.md

Customer wanted us to be more explicit on this page about searching for existing tickets in JIRA vs Github before proceeding to submit a new ticket.

* Update ISSUE_TEMPLATE.md

* Shorten proposed text
2018-04-25 15:39:58 -04:00
Martin Kraft
7294644e9d Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-04-24 10:21:18 -04:00
Saturnino Abril
3224d2f6a3 add api to convert a channel from public to private and restrict that to system_admin (#8655) 2018-04-23 08:18:58 -04:00
George Goldberg
cd55c44c8f MM-8796: Full implementation of "Schemes" in Store/Model/App layers. (#8357)
* Add Scheme model and stub store.

* Port ChannelStore to be Scheme aware.

* Make almost all the API/APP layer work with ChannelSchemes.

Only thing still hacky is UpdateChannelMemberRoles().

* Add basic SchemeStore implementation.

* Migrate UpdateChannelMemberRoles properly and fix tests.

* Update store tests and mocks so they work.

* Include creating default roles in Scheme create store function.

* Implement role deletion and start scheme deletion.

* Only use non-deleted roles for authorization.

* Add GetByScheme method to Team store.

* Add GetChannelsByScheme.

* Update store mocks.

* Implement scheme deletion in the store.

* Rename is valid function.

* Add offset and limit to queries to fetch teams and channels by scheme.

* Fix queries.

* Implement scheme awareness in Team store and add a migration.

* Tidy up ChannelStore mapping functions and add exhaustive unit tests.

* Add all missing i18n.

* Proper tests for TeamStore internal functions and fix them.

* Make additional TeamMember fields nullable.

* Make new ChannelMember fields nullable.

* Create new nullable columns without defaults.

* Make new fields in large tables nullalble.

* Fix empty list of TeamMembers.

* Deduplicate SQL queries.

* Fix spelling.

* Fix review comment.

* More review fixes.

* More review fixes.
2018-04-20 14:49:13 -04:00
Joram Wilander
853445dc2e Properly implement session deep copy (#8602) 2018-04-20 12:25:14 -04:00
Joram Wilander
283f34b9c6 MM-10007 Send an admin and regular WS events when a user is updated (#8588)
* Add user.DeepCopy() function

* Add omit admins/non-admins to WS broadcast and use for updating users

* Updates per feedback and adding unit test for ShouldSendEvent
2018-04-20 08:44:18 -04:00
Joram Wilander
7987c95fcd MM-10133 Suppress confusing personal access token message in invalid session error (#8645)
* Suppress confusing personal access token message in invalid session error

* Updates per feedback
2018-04-20 08:44:01 -04:00
Joram Wilander
514033f14c Fix panics caused by race in notification code (#8652) 2018-04-19 11:21:33 -03:00
Martin Kraft
4921fda79f MM-10122: Adds a mention for added-to-channel messages even when 'username mentions' are disabled. (#8648) 2018-04-19 11:28:04 +01:00
Christopher Speller
2b83f8c48f Removing user cache clear from SessionHasPermissionsTo (#8624) 2018-04-18 19:41:15 -07:00
Jesús Espino
0910eae31d MM-9779: Incorporate a Token into the invitations system (#8604)
* Incorporate a Token into the invitations system

* Adding unit tests

* Fixing some api4 client tests

* Removing unnecesary hash validation

* Change the Hash concept on invitations with tokenId

* Not send invitation if it wasn't able to create the Token

* Fixing some naming problems

* Changing the hash query params received from the client side

* Removed unneded data param in the token usage
2018-04-18 13:46:10 -07:00
George Goldberg
b13a228b04 MM-10121: CLI command to reset permissions system to default state. (#8637)
* MM-10121: CLI command to reset permissions system to default state.

* Review comment.
2018-04-18 10:18:07 +01:00
Joram Wilander
a1882d4004 Ignore rolled log files (#8644) 2018-04-18 08:43:55 +01:00
Joram Wilander
b15f69ea30 Handle app errors in user autocomplete endpoint (#8643) 2018-04-17 15:39:08 -07:00
Carlos Tadeu Panato Junior
51a6e95f58 add app shutdown to make sure the goroutines finish and all process are closed (#8629)
* run the send email verification as goroutine as well

* add app shutdown to make sure all go routines finish
2018-04-17 11:06:55 -04:00
George Goldberg
5511106d93 MM-9918: Trim trailing / from push proxy URL. (#8635) 2018-04-17 07:13:16 -07:00
Derrick Anderson
af98bf1d49 Merge branch 'merge49final' 2018-04-17 09:49:02 -04:00
Derrick Anderson
58e559da39 Add MM9720 changes back in for master merge 2018-04-17 09:37:20 -04:00
Derrick Anderson
885b8e51f3 Merge remote-tracking branch 'origin/release-4.9' into merge49final 2018-04-17 09:21:33 -04:00
Daniel Schalla
997df03ac1 Initial Commit of Ephemeral Message Support for System Admins (#8611)
Fixed Permission Test

Fixed and extended ephemeral message tests; Removed Online/Activity Updates

Set Create Time to current time

gofmt
2018-04-17 08:20:47 -04:00
Jesse Hallam
3a4c7603b3 MM-10020: avoid duplicating unique indexes (#8587)
* unit test TestGet(Search)Replica

This adds partial, testing-focused support for SQLite, as well as removing
some translated log messages that required initializing i18n just for
testing.

* avoid returning master twice when no replicas are configured

* remove duplicate indexes

* unit test GetAllConns
2018-04-16 18:23:20 -07:00
Christopher Speller
ba6f9075c1 Fix opengraph images not going through the image proxy. (#8627) 2018-04-16 09:00:59 -04:00
Christopher Speller
6e2cb00008 Depenancy upgrades and movign to dep. (#8630) 2018-04-16 08:37:14 -04:00
Carlos Tadeu Panato Junior
bf24f51c4e [MM-9904] Add /invite slash command to invite users to a channel (#8482)
* [MM-9904] Add /invite slash command to invite users to a channel

* Update en.json
2018-04-16 14:23:58 +02:00
Derrick Anderson
3176e13b1f revert changes from MM9720 v4.9.0 v4.9.0-rc6 2018-04-13 20:42:27 -04:00
Jesse Hallam
8056dc33e3 Prevent disabling or modifying l4g logging filters (#8628)
The underlying l4g library is not resilient to filter modifications in
the presence of concurrent goroutines. In particular, it's not safe to
call Close() on filters which might be actively held by a goroutine for
logging.

This change disables all modifications to existing filters once
initialized by the App layer. In practice, we might be able to get away
with some modifications to the existing filters (i.e. changing levels),
but the [golang memory model](https://golang.org/ref/mem) makes no
guarantees that it is safe to do so:

> Programs that modify data being simultaneously accessed by multiple goroutines must serialize such access.

We can solve this holistically by introducing the requisite locking
within our fork of the l4g library. For now, we just disable all
modifications.
2018-04-13 20:09:38 -04:00
Christopher Speller
a7fd13384b Removing user cache clear from SessionHasPermissionsTo (#8625) 2018-04-13 20:09:06 -04:00