Граф коммитов

197 Коммитов

Автор SHA1 Сообщение Дата
Rodrigo Villablanca
54f86e7fb1 Migration of TeamStore Part 1 (#15246)
Automatic Merge
2020-09-03 00:29:57 -04:00
Ibrahim Serdar Acikgoz
c30fea5f2d [MM-25645] api4/user: add migrate_auth endpoints (#14966)
* api4/user: add migrate_auth endpoints

* api4/user: reflect review comments

* add translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-31 14:56:36 +03:00
Gabe Jackson
90ef61f74c Add functionality to update password with password hash (#15343)
* Add functionality to update password with password hash

This can be used to update a user's password with a direct password
hash instead of providing the password in plaintext.

* Use test helper for local mode
2020-08-26 17:28:00 +02:00
Ashish Bhate
61cc7a8680 [MM-26576] fix flaky TestCreateUserInputFilter test (#15097)
- Summary
    fix flaky TestCreateUserInputFilter test by deleting created user between interations

- Ticket Link
    https://mattermost.atlassian.net/browse/MM-26576
2020-07-31 20:08:31 +05:30
Miguel de la Cruz
46207a35f5 [MM-27130] Add local implementations for get user related endpoints (#15070)
Automatic Merge
2020-07-23 12:53:35 +02:00
Miguel de la Cruz
6b5c0bb5d2 [MM-27170] Migrate verify user by id endpoint to local mode (#15091)
* [MM-27170] Migrate verify user by id endpoint to local mode

* Update api4/user_test.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2020-07-22 18:27:44 +02:00
Ashish Bhate
7602dc0b19 [MM-25647]: ability to permanently delete users (#14944)
Summary:
    Config option to allow permanent user deletion ServiceSettings.EnableAPIUserDeletion
    Expose permanent user deletion through API
    Local mode for delete user for use in mmctl

Ticket Link:
    Server part of https://mattermost.atlassian.net/browse/MM-25647
2020-07-22 17:32:23 +05:30
Agniva De Sarker
4a2715974d MM-27149: optimize initBasic (#15063)
* MM-27149: optimize initBasic

Mostly, all tests just needed the user initialization part and not
the channel and group creation. So we move the user initialization inside
the Setup call. This avoids unnecessary DB calls which take around 250-300ms
on average.

And we make the login requests concurrently to shave off a few more ms.
According to my tests, the 2 login calls take 140 ms on average, which
shaves off 70ms.

So approximately, we shave off 350ms per test. And there are 114 occurences
of these. So around 39 seconds.

* make initlogin only for Setup/SetupEnterprise

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-22 13:50:33 +05:30
Ibrahim Serdar Acikgoz
6a4e3293f8 [MM-25648] api4: add user/bot convert endpoints (#14877)
* api4: add user/bot convert endpoints

* api4: add convert user/bot to local mode

* api4: fix linting issues

* api4/bot: reflect review comments

* api4: update convert user endpoint paths

* remove shadow decl

* fix translation problems
2020-07-17 10:00:43 +03:00
Rodrigo Villablanca
8b6a5fc5d7 TokenStore migration to return plain errors (#14875)
* TokenStore migration to return plain errors

* Fix translations

* Fix: returned error is ignored and http.StatusBadRequest is always returned

* Fix

* Fix translations

* Suggestions

* Changed from BadRequest to NotFound

* Setting the correct http status

* Changed test to expect 404 status

* Fix error
2020-07-09 12:46:27 +05:30
Jesús Espino
b977017ca7 Extracting email functions into a service (#14802)
* Extracting email functions into a service

* Fixing two shadowing errors

* Address PR review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-07 10:03:21 +02:00
Michael Kochell
11bc28b5fb [MM-26532] Support "active" filter on profile search (#14923)
* Support "active" filter on profile search

* Add tests for active user filter
2020-06-29 15:52:46 -04:00
Miguel de la Cruz
eff2209a7e [MM-25646] Adds the permanent delete all users endpoint to the local API (#14903)
* [MM-25646] Adds the permanent delete all users endpoint to the local API

* Add a check to ensure that teams and channels are not deleted

* Fix linter

* Fix audit record name for consistency with method name

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-27 23:00:01 +02:00
Mario de Frutos Dieguez
4c33b7a35d [MM-25767] Quick switch users search is always falling back to the database (#14762)
* Refactor of getListOfAllowedChannelsForTeam

Also, I've fixed some problematic scenarios:

- The quick search doesn't provide team id so it was always failing
- When the teamId was empty and view restrictions too we always
  return all the channels because if we do "strings.Contains("foo", "")
  it always returns true
- There was a case, in quick search with a guest account, where you
  get an empty result because teamId is not provided

* Error if team id is not passed when searching for the channel

If we search users passing the channel id, we must pass the team id
too so we avoid returning all the channels if we remove the empty
team id restriction we have in the getListOfAllowedChannelsForTeam

There is no known reason to search for a channel but not filtering
using the team id. Even guest accounts belong to a team
2020-06-26 20:37:35 +02:00
Ibrahim Serdar Acikgoz
f7f1f0d268 [MM-23721] api4/user: add verify user by Id endpoint (#14244)
* api4/user: add verify user by id method

* Update api4/user.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* Update model/client4.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* api4/user: reflect review comments

* Update api4/user_test.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-26 16:08:01 +03:00
Scott Bishel
938176be3e MM-24467- Use new ServiceProviderIdentifier in AuthnRequest (#14725)
* add ServiceProviderIdentifier to config

* Update config, add unit test

* fix unit test, update i18n

* add english translation for error

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-22 09:36:08 -06:00
Rodrigo Villablanca
2760497660 Migration of UserTermsOfServiceStore to return plain errors (#14788)
* Migration of UserTermsOfService Store

* Ordering translations file

* Fix imports

* Fix translations]

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-19 17:49:30 +05:30
Farhan Munshi
77bee1d4f1 MM-25263 Add group members to search and get users and create getGroupStats endpoint (#14733)
Add tests for SearchInGroup
2020-06-18 10:22:35 -04:00
Attila Molnar
66597d0fcb Expand Plugin and REST APIs to trigger user typing event (#14331) 2020-06-16 11:41:05 +02:00
Jesús Espino
f5eab1271b Removing all FakeApp usages (#14174)
* Removing some other fake apps

* More FakeApp removed

* Removing entirely FakeApp

* Fixing some tests

* Fixing get Cluster id from get plugin status

* Fixing failing tests

* Fixing tests

* Fixing test initialization for web

* Fixing InitServer for server tests

* Fixing InitServer for server tests

* Reverting go.sum and go.mod

* Removing unneded HTMLTemplates function in App layer

* Moving back some functions to its old place to easy the review

* Moving back some functions to its old place to easy the review

* Using the last struct2interface version

* Generating store layers

* Fixing merge problems

* Addressing PR comments

* Small fix

* Fixing app tests build

* Fixing tests

* fixing tests

* Fix tests

* Fixing tests

* Fixing tests

* Fixing tests

* Moving license to server struct

* Adding some fixes to the test compilation

* Fixing cluster and some jobs initialization

* Fixing some license tests compilation problems

* Fixing recursive cache invalidation

* Regenerating app layers

* Fix test compilation

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-12 13:43:50 +02:00
Ashish Bhate
f3ac33e6dc MM-25078: local mode for createUserAccessToken, revokeUserAccessToken and getUserAccessTokensForUser (#14680)
Summary
- local mode for createUserAccessToken
- local mode for revokeUserAccessToken
- local mode for getUserAccessTokensForUser, also removed a duplicate test.

Ticket Link
- https://mattermost.atlassian.net/browse/MM-25078
- https://mattermost.atlassian.net/browse/MM-25079
- https://mattermost.atlassian.net/browse/MM-25080
2020-06-12 16:29:05 +05:30
Ashish Bhate
d5e9fde8d7 MM-24865: local mode for some user handlers (#14511)
Summary
- Local mode handler for createUser
- Local mode handler for updateUser
- Local mode support for updateUserRoles
- Local mode support for sendPasswordReset
- Local mode support for updateUserMfa
- Local mode support for updateUserActive

Ticket Link
- https://mattermost.atlassian.net/browse/MM-24865
- https://mattermost.atlassian.net/browse/MM-24869
- https://mattermost.atlassian.net/browse/MM-24866
- https://mattermost.atlassian.net/browse/MM-24868
- https://mattermost.atlassian.net/browse/MM-24870
- https://mattermost.atlassian.net/browse/MM-25041
2020-06-12 12:05:09 +05:30
Rodrigo Villablanca
52cf817c8e SqlTermsOfService migrates to plain errors (#14675)
* Advances migragint TermsOfService

* Advances...

* Replaced message key

* Replaced message key

* Replaced message key

* Replaced message key

* Refactor name of errors

* Fix mixed type of error

* Fix-imports

* i18n-extract

* Rollback changes

* Rollback changes

* Rollback changes

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 22:47:52 +05:30
Jesús Espino
224b72c61e MM-24037 Adding getKnowUsers API endpoint (#14332)
* Adding getKnowUsers API endpoint

* Adding i18n strings

* Fixing golint errors

* Adding doc strings

* Remove debug line

* Updating app_iface

* Fixing gofmt
2020-04-28 12:52:43 +02:00
Attila Molnar
f77ad4992b Fix assertExpectedWebsocketEvent ignoring the passed event (#14330) 2020-04-21 11:11:25 +02:00
Doug Lauder
e2d1af17de MM-23489 Fix poor Unicode handling in display names (#14214)
Filter blacklisted Unicode characters from:

user: first name, last name, nickname, bot description, username
team: name, display name, description, company name
channel: name, display name
2020-04-07 16:56:07 -04:00
Mario de Frutos Dieguez
b162cf92cd MM-21976: Include cache layer to be tested (#13749) 2020-03-04 14:18:03 +01:00
Patryk Pomykalski
662eef6881 Cache test users to speed up testing (#13741)
* Cache test users to speed up testing

Users were recreated for many tests and hashing passwords takes a lot of
time. Testing /api4 takes around 120s less and /app 60s less.

* fix build

* simplifying a bit the approach

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
2020-03-03 14:19:54 +01:00
JtheBAB
cd36c9f041 MM-22355 - Fix typos detected by goreportcad.com (#13842)
* Update webhook_test.go

* Update user_test.go

* Update filesstore_test.go

* Update plugin_requests.go

* Update syncables.go

* Update helper.go

* Update html_entities.go

* Update user.go

* Update team.go

* Update notification.go

* Update notification_test.go

* Update plugin_api_test.go

* Update post_metadata.go

* Update channel_test.go

* Update database.go

* Update channel.go

* Update user_store.go

* Update team_test.go

* revert andd

* Revert back to infintie

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-02 17:10:40 +01:00
Miguel de la Cruz
98ccc1ccf5 [MM-22572] Modify get user by email route to accept the / character in the email (#13897)
Automatic Merge
2020-03-01 13:52:16 -05:00
Miguel de la Cruz
84f45634a8 Remove remaining t.Fatal from the codebase (#13876)
* Remove remaining t.Fatal from the codebase

* Fix job_store test

* Address review comments

* Remove comments
2020-02-13 17:53:23 +01:00
Eli Yukelzon
17523fa5d9 MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
2020-02-13 13:26:58 +01:00
Jesús Espino
1d1ab03c38 Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions

* Fixing build
2020-02-10 19:31:41 +01:00
Mario de Frutos Dieguez
0581ff7cb8 User Management > User role change not reflected in the UI without a refresh (#13683) 2020-01-23 19:30:13 +01:00
Jesús Espino
8861d0cb33 MM-20345: Fixing etag problem not reloading all users when needed (#13640)
* MM-20345: Fixing etag problem not reloading all users when needed

* Fixing tests
2020-01-20 15:24:14 +01:00
Agniva De Sarker
2a28edcd93 MM-21481: Fixed several issues from user marshalling (#13627)
* MM-21481: Fixed several issues from user marshalling

- Fixed the root cause for panic by properly converting
the map to a User struct.
- Added a check for type conversion for extra safety.
- Fixed a somewhat unrelated issue of a pointer to pointer reference.

* Fix tests
2020-01-16 09:18:08 +01:00
catalintomai
37ce413b7d MM-20698: Add server support for getting SAML metadata and updating S… (#13311)
* MM-20698: Add server support for getting SAMl metadata and updating SAMl settings
2020-01-09 21:25:20 -08:00
Claudio Costa
80dd2915db [MM-19914] Fix data races in WebSocketEvent (#13039)
* Make WebSocketEvent type immutable

* Update code to use updated immutable WebSocketEvent type

* Export WebSocketEvent fields and mark them as deprecated
2019-12-24 09:32:11 +01:00
Jesús Espino
b3e49ec45c Use require/assert.Empty instead of require/assert.Len(t, X, 0) (#13413) 2019-12-22 12:35:31 +01:00
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Claudio Costa
eeec08c071 [MM-19979] Stop sending new_user websocket event to guests (#13191)
* Stop sending new_user websocket event to guests

* Remove debug msg

* Revert go.mod/go.sum

* Fix linting issues
2019-11-28 14:24:04 +00:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Jesús Espino
7031f51b41 Deactivating and invalidating sessions of guest users on guest disable (#13007)
Automatic Merge
2019-11-15 09:43:52 -05:00
Vinício Augusto
10e1fa4382 Migrate tests from "api4/user_test.go" to use testify (#12967)
* testify in api4/user_test.go

* more semantic treatments for require.Nil

* fix err shadowing

* gofmt

* trying to pass require.NoError problems

* trying to pass more require.NoError problems
2019-11-15 09:13:32 -05:00
Scott Bishel
e07e114def don't clear AuthService/AuthData if user is System Admin (#12986) 2019-11-07 12:12:37 -07:00
Ben Schumacher
7a665aacdd Run gosimple against codebase (#12928) 2019-10-29 07:45:09 +01:00
Agniva De Sarker
20ff7032a6 Fixed some ineffective assignments (#12543) 2019-10-03 15:45:27 +03:00
Jesús Espino
ecbc5ef5e1 Fixing autocomplete endpoint for in/out of channels (#12147) 2019-09-18 20:27:32 +02:00
Daniel Schalla
a92c830e57 Add additional input validation for user creation (#11937) 2019-08-27 10:39:01 +02:00
Micah Thompson
903085feb8 Migrate "User.UpdateMfaActive" to Sync by default (#11566) 2019-07-10 14:55:17 -04:00