* Audit logging - new schema added, old schema removed.
* fix linter error by running goimports
* Address review comments
* Address review comments
* Example usage of new audit logging API for the updateUserAuth call
* fixed unit test on auditing updating user record
* Changed the `TestUpdateConfigDiffInAuditRecord` testcase---it failed, because this PR changes how the `meta` field is serialized into the audit log records.
* fix linter error
* use string constants for record keys
* new audit api calls for api4/bot
* `Auditable` interface implementations for model classes
* New audit calls for channel api
* New audit calls for channel_local
* renamed receivers for required style reasons
* New audit calls for api4/command
* renamed receiver
* New audit calls for api4/command_local
* renamed receiver
* fix unit test to reflect changes in the Auditable implementation of the user class
* new audit calls for compliance
* new audit calls for configs
* remove auditRec.addMeta from updateConfig and patchConfig
* new audit calls for config_local
* new audit calls
* new audit calls for ldap, license apis
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* new audit calls
* fix linter error
* fixed linter error
* fixed "user update" test
* Don't include all of config when audit logging config changes. Also fix unit test on TestUpdateConfigDiffInAuditRecord
* address review comments
* Added Auditable() method for UserPatch
* Fix duplicative method declaration from merge
* Fix styling and API changes issues introduced with merge
* Fix broken test
Co-authored-by: Daniel Schalla <daniel@schalla.me>
* Audit logging - new schema added, old schema removed.
* fix linter error by running goimports
* Address review comments
* Address review comments
* Example usage of new audit logging API for the updateUserAuth call
* fixed unit test on auditing updating user record
* Changed the `TestUpdateConfigDiffInAuditRecord` testcase---it failed, because this PR changes how the `meta` field is serialized into the audit log records.
* fix linter error
* MM-45174 - split validate business email logic
* remove unnecessary interface method
* check for error just after the cloud call to prevent server panic
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
We replace expected/received with the source of the collation.
This makes it more clear as to from where the values
were retrieved.
```release-note
NONE
```
We create two new auth checks which take multiple channels
and teams. They can be used to check whenever a user needs
access to multiple entities.
These are then access in dataloaders to ease the load in the
database.
```release-note
NONE
```
* Add DB enums
```release-note
Upgrade note:
Several schema changes are made which imposes additional
DB constraints to make the data more strict.
Here are the times taken:
Postgres (131869 channels, 2 teams):
[bigdb] # CREATE TYPE channel_type AS ENUM ('P', 'G', 'O', 'D');
CREATE TYPE
Time: 14.114 ms
[bigdb] # ALTER TABLE channels alter column type type channel_type using type::channel_type;
ALTER TABLE
Time: 3856.790 ms (00:03.857)
[bigdb] # CREATE TYPE team_type AS ENUM ('I', 'O');
CREATE TYPE
Time: 4.191 ms
[bigdb] # ALTER TABLE teams alter column type type team_type using type::team_type;
ALTER TABLE
Time: 116.205 ms
[bigdb] # CREATE TYPE upload_session_type AS ENUM ('attachment', 'import');
CREATE TYPE
Time: 4.266 ms
[bigdb] # ALTER TABLE uploadsessions alter column type type upload_session_type using type::upload_session_type;
ALTER TABLE
Time: 37.099 ms
MySQL (270959 channels, 2 teams):
mysql> ALTER TABLE Channels MODIFY COLUMN Type ENUM("D", "O", "G", "P");
Query OK, 270959 rows affected (13.24 sec)
Records: 270959 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE Teams MODIFY COLUMN Type ENUM("I", "O");
Query OK, 2 rows affected (0.04 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE UploadSessions MODIFY COLUMN Type ENUM("attachment", "import");
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
All the commands were tested on a 8 core, 16GB RAM machine.
```
https://mattermost.atlassian.net/browse/MM-45508
```release-note
NONE
```
* Added migration list
```release-note
NONE
```