Commit Graph

730 Commits

Author SHA1 Message Date
Carlos Tadeu Panato Junior
9517cccab0 Relese5.0 merge master 20180611 (#8939)
* Add missing diagnostics (#8911)

* Update diagnostics.go

* Update diagnostics.go

* Fix push notification styling backwards compatibility (#8913)

* MM-10803: remove premature user sanitization on deactivation (#8926)

* remove unused UpdateNonSSOUserActive

* MM-10803: stop prematurely sanitizing users on deactivate

This change was preceded by the removal of UpdateNonSSOUserActive to
ensure there are no APIs relying on the sanitized return value.

* MM-10803: test websocket events after UpdateUserActive

* MM-10264: Adds system scheme to permissions import/export. (#8924)

* MM-10264: Adds system scheme to permissions import/export.

* MM-10264: Switches to more likely unique name.

* MM-10264: Changed collision prevention string.

* MM-10264: Rolls back created schemes in all error cases.

* MM-10264: Test fix for more rollback cases.

* Fix idempotency of scheme migrations. (#8935)

This fixes the issue where if the migration tries to migrate an already
scheme-aware member object it would end up removing it's scheme-derived
roles.

Instead, only if the member object is unmigrated do we default to
setting the scheme-derived role booleans to false. We tell if it is an
unmigrated member object by checking if the booleans are set to null.
2018-06-11 20:09:38 +02:00
Carlos Tadeu Panato Junior
bfba142e2b Uncomment upgrade for 5.0.0 (#8914) 2018-06-05 20:17:53 +02:00
Martin Kraft
260d7a0f85 MM-10412: Adds deleteBy prop to posts. (#8896) 2018-06-01 12:45:46 -04:00
Jesús Espino
5992a729c5 MM-10760: Using master for any Exec call (#8895) 2018-06-01 14:11:22 +01:00
George Goldberg
516a097e1a MM-10757: Default roles from scheme should be keyed by name not ID. (#8894)
* MM-10757: Default roles from scheme should be keyed by name not ID.

* Update permissions import/export.
2018-06-01 12:49:02 +01:00
Jesús Espino
e88fe4bb1d MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions (#8860)
* MM-8853: Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS permissions

* MM-8853: Removing unnecesary emoji enterprise feature

* Create emojis migration

* Adding MANAGE_EMOJIS and MANAGE_OTHERS_EMOJIS always to system admins

* Simplifing permissions checks

* Revert "Simplifing permissions checks"

This reverts commit e2cafc1905.
2018-05-29 15:58:12 +01:00
Jesús Espino
f1cd33c822 Add autogenerate scheme.name for new schemes without explicit name (#8848) 2018-05-25 11:24:29 -04:00
Martin Kraft
69304fb54d Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-24 08:40:52 -04:00
Jesse Hallam
0a666a5656 MM-10649: soften Channels.ExtraUpdateAt deprecation (#8843)
The previous complete removal of this field resulted in an
incompatibility with 4.x servers that could not handle the now null
column field.

Instead, ensure this field is at least always set to 0, with a plan to
remove it altogether in a future release.
2018-05-23 10:28:19 -04:00
Martin Kraft
e46b94fa66 fmt fix. 2018-05-22 16:22:20 -04:00
Martin Kraft
f40666f9e8 Merge branch 'master' into advanced-permissions-phase-2 2018-05-22 14:15:54 -04:00
George Goldberg
8fb070fecf MM-10352: Add locking incoming webhooks to a single channel. (#8835) 2018-05-22 11:06:14 -07:00
George Goldberg
8a0702e0c3 Reinstate upgrade code that mysteriously vanished during some merge. 2018-05-18 12:47:27 +01:00
George Goldberg
eddb38bbef Fix tests. 2018-05-18 11:54:46 +01:00
Martin Kraft
e0390632b3 MM-10264: Adds CLI command to import and export permissions. (#8787)
* MM-10264: Adds CLI command to import and export permissions.

* MM-10264: Changes Scheme Name to DisplayName and adds Name slug field.

* MM-10264: Changes display name max size.

* MM-10264: Another merge fix.

* MM-10264: Changes for more Schemes methods checking for migration.

* MM-10264: More updates for Schemes migration checking.
2018-05-17 11:37:00 -04:00
George Goldberg
a09dc68e1d MM-10235: Make permissions reset CLI shcemes-aware. (#8773)
* MM-10235: Make permissions reset CLI shcemes-aware.

* Add i18n strings.
2018-05-17 16:28:14 +01:00
George Goldberg
319d61123a MM-10615: Reset teams/channels to default scheme on delete scheme. (#8811) 2018-05-17 12:48:31 +01:00
George Goldberg
16bbbc2abc Fix build failure from bad merge. 2018-05-16 12:02:43 +01:00
Martin Kraft
f82cc7896d Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-15 07:45:28 -04:00
George Goldberg
51bd710ecd MM-9728: Online migration for advanced permissions phase 2 (#8744)
* MM-9728: Online migration for advanced permissions phase 2

* Add unit tests for new store functions.

* Move migration specific code to own file.

* Add migration state function test.

* Style fixes.

* Add i18n strings.

* Fix mocks.

* Add TestMain to migrations package tests.

* Fix typo.

* Fix review comments.

* Fix up the "Check if migration is done" check to actually work.
2018-05-14 15:59:04 +01:00
Jesse Hallam
7e7c551987 MM-9739: deprecate the now unused Channels.ExtraUpdateAt (#8762) 2018-05-14 09:43:06 -04:00
Martin Kraft
91557bbd97 Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-11 08:05:23 -04:00
Christopher Speller
d8dd271e43 MM-4998 Adding LoginIdAttribute to allow LDAP users to change their login ID without losing their account (#8756)
* Adding LoginIdAttribute

* Modifying LDAP to use loginIDAttribute.

* Adding IDAttribute migration and AD objectGUID support.

* Removing unused idea.

* Fix typo.
2018-05-10 09:46:09 -07:00
Martin Kraft
d3e14a1bf8 Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2 2018-05-09 15:00:07 -04:00
Derrick Anderson
c1853c7f40 prep code for 5.0 (#8743) 2018-05-08 09:27:37 -04:00
Derrick Anderson
e555b7454d Uncomment upgrade for 4.10 (#8727)
* uncomment upgrade code

* ping jenkins

* add 4.10.0 to version.go
2018-05-04 17:01:14 -04:00
Jesús Espino
7c680cacab MM-10319: Use normalized email for Saml (migration) (#8711) 2018-05-04 16:10:43 -04:00
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
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
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
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
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
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
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
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
Derrick Anderson
f9015a37f3 uncomment 4.9 upgrade code (#8582)
* set db to 4.9

* add prepatory code for 4.10

* bug from old example
2018-04-05 11:45:55 -04:00
Jesús Espino
014a3b6a60 Fixing misspell errors (#8544) 2018-03-29 10:04:54 -04:00
Jesse Hallam
d4c0494360 MM-9661: tweak post message size log (#8517)
Call out the number of supported characters explicitly, moving the byte
limit to parentheses.
2018-03-29 10:02:58 -04:00
Jesse Hallam
9c9a9ade12 Remove the index on Channels.DisplayName. (#8530)
As outlined in [this
discussion](https://pre-release.mattermost.com/core/pl/uw5bwmkb6irkbkn6pk9rkzpytr),
this index causes issues with MySQL's query planner, leading to full
table scans in a case where it would have made more sense to leverage a
filesort.
2018-03-28 09:22:55 -07:00
Jesse Hallam
1ccad749f1 Add unit test coverage for SqlStatusStore.GetAllFromTeam (#8520)
I added this as part of a separate PR that was deferred for now, but
figured the unit test coverage would still be useful.
2018-03-28 09:20:39 -07:00
George Goldberg
a28f6e7748 Fix roles table ID max length so MySQL 5.6 doesn't fail. (#8532) 2018-03-28 09:58:00 +01:00
Martin Kraft
e13e64711f Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1 2018-03-27 09:01:42 -04:00
Jesse Hallam
8491ba5740 Relax 4k post message limit (#8478)
* MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1

* MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests

* MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2

* MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000)

This is safe to do in a production instance since the underyling type is
not changing. We explicitly don't do this automatically for MySQL, but
also don't need to since the ORM would have already created a TEXT column
for MySQL in that case.

* MM-9661: emit MaxPostSize in client config

This value remains unconfigurable at this time, but exposes the current
limit to the client. The limit remains at 4k in this commit.

* MM-9661: introduce and use SqlPostStore.GetMaxPostSize

Enforce a byte limitation in the database, and use 1/4 of that value as
the rune count limitation (assuming a worst case UTF-8 representation).

* move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore

* address feedback from code review:

* ensure sqlstore unit tests are actually being run
* move global caches into SqlPostStore
* leverage sync.Once to address a race condition

* modify upgrade semantics to match new db semantics

gorp's behaviour on creating columns with a maximum length on Postgres
differs from MySQL:
* Postgres
  * gorp uses TEXT for string columns without a maximum length
  * gorp uses VARCHAR(N) for string columns with a maximum length of N
* MySQL
  * gorp uses TEXT for string columns with a maximum length >= 256
  * gorp uses VARCHAR(N) for string columns with a maximum length of N
  * gorp defaults to a maximum length of 255, implying VARCHAR(255)

So the Message column has been TEXT on MySQL but VARCHAR(4000) on
Postgres. With the new, longer limits of 65535, and without changes to
gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on
Postgres. This commit makes the upgrade semantics match the new database
semantics.

Ideally, we'd revisit the gorp behaviour at a later time.

* allow TestMaxPostSize test cases to actually run in parallel

* default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics

* fix casting error

* MM-9661: skip the schema migration for Postgres

It turns out resizing VARCHAR requires a rewrite in some versions of
Postgres, but migrating VARCHAR to TEXT does not. Given the increasing
complexity, let's defer the migration to the enduser instead.
2018-03-26 17:55:35 -04:00