Commit Graph

305 Commits

Author SHA1 Message Date
Claudio Costa
c95d295dce Update CLI channel list and search commands to show if a channel is private (#11480) 2019-07-02 16:27:00 -04:00
George Goldberg
0d8377cc59 MM-16439: Print config ordered by key alphabetically for easy diff. (#11349)
* MM-16439: Print config ordered by key alphabetically for easy diff.

* Clarify comment.
2019-06-21 17:38:26 +01:00
Rodrigo Villablanca Vásquez
59e7bf1c23 Migrates Channel.GetByName to sync by default (#11187)
* Channel.GetByName and Channel.GetByNameIncludedDeleted sync by default

* Suggested changes

* Fix some vars shadowing

* Rename of vars inside goroutine

* Shadow variable corrected
2019-06-20 15:21:36 +02:00
piperRyan
2ce36c2eb1 Migrates "Channel.GetAll" to Sync by default (#11281) 2019-06-19 10:40:05 +01:00
Rodrigo Villablanca Vásquez
d1569c48d2 Migrates Channel.PermanentDeleteMembersByChannel to sync by default (#11238) 2019-06-18 09:33:42 -07:00
Jesús Espino
693017a317 Migrate Bots store to sync by default (#11182)
* Migrate Bots store to sync by default

* Fixing tests

* Fixing govet

* Fixing tests
2019-06-14 08:20:49 -07:00
Jesús Espino
76bab4f0c2 Migrating User Store VerifyEmail, GetByAuth and GetByEmail functions to sync by default (#10941) 2019-06-12 19:30:50 +02:00
Bolarinwa Balogun
88202a76d9 [MM-16159] Migrate "Team.GetByName" to Sync by default (#11107)
* [MM-16159] Migrate "Team.GetByName" to Sync by default

* Refactor to correct mistakes and remove irrelevant code
2019-06-11 09:35:17 -04:00
Jesse Hallam
719412c1a0 MM-15956: consistent params for config migrate (#11024)
This changes the syntax of the config migrate command from:

    mattermost config migrate --from <from config> --to <to config>

to:

    mattermost config migrate <from config> <to config>

making it more consistent with our other CLI commands.
2019-05-31 17:04:59 -04:00
Jesse Hallam
ca15690685 MM-15371: allow config show --json (#10918)
* MM-15371: allow config show --json

Mattermost Cloud will (temporarily?) rely on `mattermost config show` to dump the configuration for an active cluster installation. This adds support for a `--json` flag to dump the config in a format more suitable for programmatic consumption.

* indent config show --json

* ignore coverage lines too
2019-05-28 22:18:17 -05:00
Martin Kraft
b7fcddb0fc MM-15784: Prevents non-private channels from being group-constrained … (#10950)
* MM-15784: Prevents non-private channels from being group-constrained via CLI.

* MM-15786: Fixes tests.
2019-05-28 10:55:54 -04:00
Daniel Schalla
d269891476 [MM-15490] Rework default password requirements (#10844)
* Rework default password requirements

* Update API Test Lib Default User PW

* Remove unused function; Disable password reqs in dev mode

* Disable strict password requirements for unit tests

* Update unit tests
2019-05-21 11:03:36 -07:00
Martin Kraft
8d8a4d8614 MM-15485: In-channel system behaviour for at-mentions and slash commands for group-constrained channels. (#10855)
* MM-15108: Prevent non-group-members from being added to group-constrained channels.

* MM-15485: Updates ephemeral message when non-group member is invited to group-constrained channel.

* MM-15485: Prevent group-permitted members from being removed from group-constrained channels. Show custom ephemeral when attempting /kick or /remove.
2019-05-17 12:43:19 +01:00
Pradeep Murugesan
5d1ee9373f made the Restore and Delete store method to be sync (#10835) 2019-05-16 12:31:50 +02:00
Martin Kraft
1b78f9debc MM-14897: Changes to be able to add and remove groups from channels. (#10794)
* MM-15162: Changes for LDAP groups removals phase.

* MM-14897: Changes to be able to add and remove groups from channels.

* Update model/client4.go

* MM-14897: PR-requested change to string interpolation.
2019-05-15 12:03:47 -04:00
Siyuan Liu
2130e9f0b1 [GH-10800] convert bot account to user account (#10803)
* [10800] convert bot account to user account

* check password validity first

* review comments
2019-05-15 13:23:12 +01:00
Martin Kraft
480fffd3cc MM-15162: Changes for LDAP groups removals. (#10701)
* MM-15162: Changes for LDAP groups removals phase.

* MM-15162: Adds missing translation.

* MM-15162: Fixes tests.

* MM-15162: Removes some confusing branching.

* MM-15162: Make permission less restrictive.

* MM-15162: Moves counting to the DB tier.

* MM-15162: Moves CountGroupsByTeam into own store method.

* MM-15162: Adds count to tests.

* MM-15162: Fix for wrong cast type.

* MM-15162: Fix for possible null SchemeGuest column.

* MM-15162: Fixes bug whereby permissions error didn't return.

* MM-15162: Changes for LDAP groups removals phase.

* MM-15162: Adds missing translation.

* MM-15162: Fixes tests.

* MM-15162: Removes some confusing branching.

* MM-15162: Make permission less restrictive.

* MM-15162: Moves counting to the DB tier.

* MM-15162: Moves CountGroupsByTeam into own store method.

* MM-15162: Adds count to tests.

* MM-15162: Fix for wrong cast type.

* MM-15162: Fix for possible null SchemeGuest column.

* MM-15162: Fixes bug whereby permissions error didn't return.

* MM-15162: Adds missing translation blocking enterprise build.

* MM-15162: Update to group commands.
2019-05-10 11:47:21 -04:00
Miguel de la Cruz
2c0068a288 [MM-15164] Add group commands (#10812) 2019-05-10 15:53:01 +01:00
Puneeth Reddy
6ce3cc6921 MM-15290: Migrate commandStore.GetByTrigger to sync by default (#10741)
* MM-15290: migrate command.GetByTrigger to sync by default

* Fix build

* MM-15290: fix go vet issue
2019-05-07 20:44:30 +02:00
Puneeth Reddy
2d3fb4f426 MM-15288: Migrate CommandStore.Get to sync by default (#10739)
* MM-15288: Migrate Command.Get to sync by default

* addressing review comments, updating status code of err returned by Get Method
2019-05-06 18:12:41 +02:00
Siyuan Liu
fc15eda37f [MM-14719] convert users to bots through cmd (#10672)
* [MM-14719] convert users to bots through cmd

* address review comments, add / fix unit tests

* change command from "modify" to "convert"; review comments

* code review comments, clean up
2019-05-06 07:59:51 -07:00
Jesús Espino
584ec68755 MM-15021: Adding new builtin system schema for Guests (#10601)
* MM-15021: Adding new builtin system schema for Guests

* Fixing tests

* Setting properly the permissions

* Adding guests to sampledata

* Restrict more roles updates in the app layer for guests

* Adding comment to explain that permissions migration must go at the end

* Setting the default guest role for custom scheme during migration

* Fixing import and export

* Creating scheme guest roles on migration

* Fixing tests

* Fixing tests

* Fixing tests
2019-04-30 20:36:21 +02:00
Puneeth Reddy
171058eb3d MM-15289 Migrate command.GetByTeam to sync by default (#10740) 2019-04-29 10:20:51 +02:00
Puneeth Reddy
9f9620b4c8 MM-15186: Migrate "WebHook.GetOutgoingByTeam" to Sync by defa (#10707) 2019-04-26 21:20:36 +02:00
tengis b
8252eab5da [MM-15274] Migrate "Team.Get" to Sync by default (#10694)
* Migrate Team.Get to Sync by default

* change parseRange return value to ok

* fix formatting

* remove err checks

* use require.nil

* require nil
2019-04-26 18:18:07 +02:00
Puneeth Reddy
dc0441e28c change UpdateOutgoing func signature to return OutgoingWebhook and fix formatting (#10710) 2019-04-26 09:28:04 +02:00
Puneeth Reddy
ec95793b90 MM-15276: Migrate Team.Update to sync by default (#10693)
* MM-15276: Migrate Team.Update to sync by default

* MM-15276: Addressing review comments and change Update func signature similar to other interface Update method

* update store mocks for update fn

* addressing review comments
2019-04-25 15:29:02 +02:00
Andres Orozco
928ecba2d4 MM-15198 Migrate Channel.Get/GetFromMaster to Sync by default (#10667)
* MM-15198 Migrate Channel.Get/GetFromMaster to Sync by default

* MM-15198 - Update store/storetest/post_store.go

fix error handling in post_store.go test case

Co-Authored-By: andresoro <ao15@my.fsu.edu>
2019-04-24 20:28:06 +01:00
Siyuan Liu
434f343f69 [MM-15122] Migrate "WebHook.GetIncomingByTeam" to Sync by default (#10631) 2019-04-22 11:29:55 -04:00
Fede
17092e7e48 [MM-15117] Migrate "WebHook.UpdateIncoming" to Sync by default (#10637)
* SyncStore: Migrate Webhooks.UpdateIncoming method to Sync

* Changes requested by @jespino
2019-04-18 13:03:59 +01:00
Jesús Espino
12c50eb830 Initial migration of the store to be sync (#10592)
* Migrating audit store

* Final migration example for the audit store

* async example

* Ending migration

* Removing Async helper

* Fixing tests

* Fixing govet problems with the StoreResult instanstiation
2019-04-15 22:53:52 +02: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
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
Miguel de la Cruz
683f215bd9 [MM-14254] Add elasticsearch initialisation to the cmd (#10405) 2019-03-18 15:45:45 +01:00
Jesse Hallam
e94faea383 Address config startup issues (#10439)
* support --config for the jobserver

* leverage viper to map MM_CONFIG to --config
2019-03-14 16:14:18 +01:00
Miguel de la Cruz
434d01a284 [MM-14361] Initialise the translations before loading the config store (#10435) 2019-03-12 17:50:48 +00:00
Jesús Espino
200cfdd4a7 Fixing emojis and webhooks permissions split (#10420) 2019-03-08 11:40:44 +01:00
Jesús Espino
84afd47021 Split Emojis and Webhooks permissions (#10239)
* Split Emojis and Webhooks permissions

* Fixing some tests

* Fixing more tests

* Fix more tests

* Fixed review comments

* Fixing review comments
2019-03-07 16:07:09 +01:00
Jesse Hallam
1e462da2d4 MM-14143 config cleanup final (#10374)
* TestGetLicenseFileFromDisk: avoid using fileutils.FindConfigFile

* config: abstract config-related file access, extend memory store

* simplify config validate to avoid file knowledge

* fix relative file tests

* cluster: fix ConfigChanged event

The old and new configurations were swapped when notifying the enterprise code of configuration changes, creating needless instability in propagating config updates across a cluster.

* config/database: ignore duplicates

* test cleanup

* remove unnecessary Save() in test
2019-03-06 15:06:45 -05:00
Dmytro Chukmasov
3716918c57 [MM-12365] Create CLI command "team rename" (#9764) (#10083)
Allow renaming teams like in `channel rename` command

Example: `team rename myteam newteamname --display_name "My New Team Name`
2019-03-06 18:48:49 +01:00
Saturnino Abril
d85dff81a8 skip tutorial steps for sysadmin, user-1 and user-2 from generated sample data (#10387) 2019-03-01 20:11:38 +08:00
Christopher Poile
8bd182c38f MM-14145: The config store Set will now Save automatically (#10377)
* MM-14145: The config store Set will now Save automatically

When UpdateConfig (and configStore.Set) is called in admin.go and
config.go, commonStore.Set now takes a store-specific persist function.
It uses that persist function to save the configuration automatically.

Removed: Now callers do not have to call configStore.Save or
app.PersistConfig, and those functions have been removed.

Possible downside: this means a "failed to persist config" error can now
be thrown during a app.UpdateConfig or commonStore.Set call. But
considering application code never really sets a config without saving
it (except in the test cases, which were testing that -- see below), it
seems fine to group these responsibilities.

Also removed: tests for 'set without save'. Since that can not happen
anymore, the tests are not needed.

* Removed Save completely, cleaned up formatting, joined save test with
set tests.

* fixed shadowed variable error
2019-02-28 10:51:42 -05:00
Jesse Hallam
72448d12a9 deprecate timezones.json (#10311) 2019-02-25 12:07:45 -04:00
Daniel Schalla
f046163a12 [MM-13840] Change eMail as a post-verification action (#10253)
* Change eMail as a post-verification action

* Fix broken test

* comment for special behavior, tests

* govet

* Check for already existent eMails when require email verification is turned on before accepting update
2019-02-20 15:50:52 +01:00
Sandeep Sukhani
29060acb45 [MM-13828] Initialize tests in each package with a new temp folder with all test resources (#10261)
* [MM-13828] Running tests from a new temp folder with all test resources

Possible fix for #10132

All packages which have a TestMain and use testlib.MainHelper will have a new current working directory which will have all the test
resources copied.

Note: default.json is copied as config.json as well to make sure tests don't have any impact due to changes in config by devs

* [MM-13828] Added TestMain to remaining packages to use testlib.MainHelper

This makes sure tests from all packages run with same test resources, setup in a new temp folder for each package

* Updated Jenkins file to not not config/default.json

This makes sure CI has same config files as a dev's machine

* [MM-13828] Changes requested from code review

Added accessor methods to testlib.MainHelper for accessing members
Fixed some broken tests due to change in cwd while tests run
Some other code refactoring and improvements

* [MM-13828] Added new factory method with options for creating test main helper and some code refactoring

testlib.NewMainHelperWithOptions supports options to turn on/off test dependencies and environment setup
Some other code refactoring

* Exporting members of testlib.MainHelper to make enterprise tests work

* Fixed gofmt error

* [MM-13828] removed unwanted dependency on plugins directory while setting up test resources

* [MM-13828] Fixed some tests failing due to them being running from temp folder

* [MM-13828] Some code changes suggested in PR review

* Fixed gofmt error
2019-02-19 09:20:11 -05:00
Adzim Zul Fahmi
f4249b5456 [MM-12304] Add channel search support in mattermost cli (#10093)
#### Summary
add command search on channel group.
it could search channel by name or id in general
and search channel with team by team name or id

#### Ticket Link
Fixes https://github.com/mattermost/mattermost-server/issues/9491
https://mattermost.atlassian.net/browse/MM-12304

#### Checklist
- [x] Added or updated unit tests (required for all new features)
2019-02-19 07:42:30 +01:00
Jesse Hallam
9bf5687311 MM-11262: database config store (#10281)
* vendor github.com/jmoiron/sqlx

* MM-11262: introduce a database store

* revert unnecessary fmt.Errorf

* simplify unit test helper methods

* remote TODO re: retry

* relocate initializeConfigurationsTable for clarity

* factor out a commonStore

* acquire database config lock on close for safety

* add missing header

* fix lock comment
2019-02-15 10:05:29 -04:00
Jesse Hallam
285b646d67 MM-13893: introduce file store (#10243)
* config file store

Introduce an interface and concrete implementation for accessing the config.

This mostly maps 1:1 with the exiting usage in `App`, except for internalizing the watcher. A future change will likely eliminate `App.PersistConfig()` and make this implicit on `Set` or `Patch`

* experimental file test changes

* emoji: move file driver checks from api4 to app

It is no longer possible to app.UpdateConfig and provide an invalid configuration, making it hard to test this case. This check doesn't really belong in the api anyway, since it's a configuration validity check and not a permissions check. Either way, the check now occurs at the App level.

* api4: generate valid public link salts for test

* TestStartServerRateLimiterCriticalError: use mock store to test invalid config

* remove config_test.go

* remove needsSave, and have Load() save to the backing store as necessary

* restore README.md

* move ldap UserFilter check to model isValid checks

* remove databaseStore until ready

* remove unimplemented Patch

* simplify unlockOnce implementation

* revert forgetting to set s.Ldap

* config/file.go: rename ReadOnlyConfigurationError to ErrReadOnlyConfiguration

* config: export FileStore

* add TestFileStoreSave

* improved config/utils test coverage

* restore config/README.md copy

* tweaks

* file store: acquire a write lock on Save/Close to safely close watcher

* fix unmarshal_test.go
2019-02-12 10:19:01 -08:00
Jesse Hallam
3a71709103 MM-13893: refactor config (#10230)
* refactor utils/config* to config/

* pull validateLdapFilter into app

* clean up Config/GetConfig/GetSanitizedConfig usage

Eliminate app.GetConfig() in favour of just using app.Config() directly,
but expose app.GetSanitizedConfig() for when the old behaviour was
required.

* web: isolate config setup

* TestInvitePeopleProvider: make config explicit

* regenerateClientConfig: avoid racey map access

* integrate watch flag into app.ConfigFile option

* make app.Option return an error

* release.mk: only cp static files from config/

* release.mk: fix cp static files from config/

* api4: TestPlugin cleanup

* s/c/cfg/ for clarity

* fix merge conflict

* testlib: allow customization of testlib driver name
2019-02-12 08:37:54 -05:00
Carlos Tadeu Panato Junior
86aa01cf36 fix test (#10212) 2019-01-31 13:07:49 -04:00