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
* api4/channel: add ability to force move channel by removing non-members
* app/channel: add log to move channel for non taget team members
* app/channel: add tets for remove non-team members for channel
* Update api4/channel_test.go
Co-authored-by: Eli Yukelzon <reflog@gmail.com>
Co-authored-by: Eli Yukelzon <reflog@gmail.com>
* parent 48256721c4 (#14358)
author Eli Yukelzon <reflog@gmail.com> 1585814774 +0300
committer Eli Yukelzon <reflog@gmail.com> 1589111022 +0300
Sidebar caregories implemented
Apply suggestions from code review
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Update store/sqlstore/channel_store.go
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Update store/sqlstore/channel_store.go
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
code review suggestions
status messages
edge case
bugs...
timeout reverse
* MM-25126 Add a separate default sorting method for categories (#14575)
* MM-25158 Add user to initial sidebar categories when joining team (#14570)
* MM-25281 Place new categories in the correct position (#14609)
* MM-25277 Return channels that aren't in a category as part of the Channels/Direct Messages categories (#14601)
* MM-25276 Remove categories when leaving a team (#14600)
* Remove categories when leaving a team
* layers
* corrected cleanup function
* lint
* .
* corrected errors in postgres
* .
* MM-25280 Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs (#14626)
* Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs
* tests
* correct status code
* MM-25278 Change "update category" API to return 400 when changing unsupported fields (#14599)
* MM-25279 Change category migration to only populate channels in Favorites (#14627)
* MM-25157 Add API to delete custom categories (#14574)
* MM-25157 Add API to delete custom categories
* get categories fix
* maxorder fix
* Use correct websocket event when deleting category
* Fix tests and remove debug code
* Actually use the right websocket event this time
* test cleanup
* Update test for new category order
Co-authored-by: Eli Yukelzon <reflog@gmail.com>
* MM-24914 Various fixes for sidebar channel handling (#14756)
* Fix checking for channel membership when reordering channels
* Remove unique constraint on SidebarCategories
* Set column sizes for SidebarCategories and SidebarChannels tables
* Allow changing the sorting method for non-DM categories
* Fix nil pointers in error handling
* Fix orphaned channels from other team being returned in Channels category
* Fix non-orphaned channels being duplicated in the Channels category
* Remove unique constraint on SidebarChannels
* Fix category/name of favorites preferences
* Fix testSidebarChannelsMigration
* Rename err to nErr and appErr to err
* Fix channel order returned by GetSidebarCategories on MySQL
* Fix adding/removing favorites preferences
* Remove leftover TODO
* Change SidebarCategoryType enums to use full names (#14786)
* Change SidebarCategoryType enums to use full names
* Fix Channels constant
* Remove leftover debug code
* MM-24914 Fix updateCategory endpoint returning the wrong type (#14795)
* MM-24914 Make some changes to UpdateSidebarCategories (#14806)
* Fix orphaned DMs not always being returned
* MM-24914 Make some changes to UpdateSidebarCategories
* Run updateSidebarCategoryOrderT in a transaction
* Fix deleting SidebarChannels based on order of arguments to UpdateSidebarCategories
* bump for api testing
* bump for api testing
* Change CreateInitialSidebarCategories to return a plain error
* Change MigrateSidebarCategories to return a plain error
* Remove usage of UpdateColumns when updating sidebar categories (#14843)
* Remove usage of UpdateColumns when changing category order
* Add a random test case
* Remove usage of UpdateColumns when updating sidebar categories (#14843)
* Remove usage of UpdateColumns when changing category order
* Add a random test case
* Remove usage of UpdateColumns when updating sidebar categories (#14843)
* Remove usage of UpdateColumns when changing category order
* Add a random test case
* MM-26343 Make CreateInitialSidebarCategories idempotent (#14870)
* Fix bad merge
* Fix another bad merge
* Fix unintentionally removed i18n string
Co-authored-by: Eli Yukelzon <reflog@gmail.com>
* [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>
* 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>
* MM-25261: Add 'include_deleted' parameter to get all channels API request.
* MM-25261: Adds test for deleted channels.
* MM-25261: Switches to single liner.
* MM-25261: Adhere to beta config setting for viewing archived channels.
* MM-25261: Test fix.
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Initial request trial api creation
* Adding test license public certificate
* Adding go client method
* Applying changes to use production environment
* Removing accidentally added strings
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-25040: Only return team-associated groups if the team is group-constrained.
MM-25040: Prevents associating a group to a channel if the team doesn't have the group first.
* MM-25040: Fix lints.
* MM-25040: Still add the groupteam if the team is not group-constrained.
* MM-25040: Wraps groupteam upsert in else branch for efficiency.
* MM-25040: Removes unnecessary page iteration.
* MM-25040: Fix typo.
* MM-25040: Moves filtering to SQL.
* MM-25040: Updates tests, check pagination.
* MM-25040: Fix lint error.
* MM-25040: Adds some more group store tests.
* MM-25040: Fix for wrong test parameter.
* Convert bool string comparisons to strconv.ParseBool for REST parameters
* Log failed bool conversions
* Rename errors, changed log levels
* drop strconv.ParseBool error handling
If the query string parameter is omitted, strconv.ParseBool returns an error for the empty strings, which spams the logs. Instead, just assume the default semantics of a `false` return value if an error occurs.
* allow randomized Client4 booleans
It's hard to test api4's handling of the various boolean input values
accepted. Extend Client4 with support for overriding how it builds those
strings, and pick a random value on test startup.
* gofmt -s
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
* [MM-20684] Initial implementation of the Command Autocomplete (#13602)
* Implement Autocomplete Data
* Change CommandName to Trigger
* Fix Autocomplete test
* Make stylistic changes
* Rename a bunch of fields and methods
* Fix variable names, safer type assertions
* [MM-20684] plugin autocomplete implementation (#14259)
* Add an endpoint for command autocomplete suggestions
* Add full Suggestion to the AutocompleteSugestion struct
* Add Dynamic Argument support
* Tidy up things
* Fix missed test case
* Add support of the named arguments
* Update autocomplete API
Fix review issues
Implement dynamic args as a local request
* Fix ineffassign
* Add support of the uppercase letters in arguments
* Add support of the optional arguments
* Remove ineffectual assignment
* Add support for icons (#14489)
* Address couple of nits
* Add comment to IconData
* Add types to all consts
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-25006: Fix occurences of unclosed http bodies
And while here, we also use ioutil.Discard to read the remaining
body instead of reading with ioutil.ReadAll which allocates a separate
byte buffer.
* Fix mistake
* Address review comments
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* [MM-20979] Add first implementation of the Bleve search engine
* Fix i18n
* Migrate searchengine utils tests
* Fix linter
* Don't add allTermsQ if both termQueries and notTermQueries are empty
* Fix test that should work if user is system admin
* Modify naming according to review comments
* Abstract getIndexDir function
* Extracting bleve engine name as a constant
* Merge both Indexer interfaces into one
* Add worker stopped message
* Allow worker to be started/stopped with config change
* Use constants for index names
* Modify test order
* Fix linter
* Trying to unlock the CI
* add a since parameter to getGroups api
* update for lint error
* when using since, return deleted groups as well.
* update flaky test, groups have same create time
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* add getGroupsByUserId to API layer
* update for lint errors
* add check for contextId = userId or ManageSystem Permission
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-23264 Add api endpoint for get groups with members in channel
Add store tests
Add tests for api func
Gofmt
Apply changes from code review
* MM-23264 Make store layers
* MM-23264 Check read permission on channel member counts
* Trigger CI
- replace all instances of `fmt.Sprintf("whatever")` with simply "whatever".
- replace all instances of `fmt.Println(fmt.Sprintf("whatever %d", i))` with `fmt.Printf("whatever %d\n", i)`
* MM-20913 add client API to fetch server busy state and timeout
* deprecate current API that only returns timeout
* required for mmctl MM-20913
* restore deleted unit test for GetServerBusyExpires
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-22205 Add get channel moderations endpoint
* MM-22206 Add patch channel moderations endpoint
Add api tests for patch channel moderations
* MM-22205 Ensure ordered permissions returned and create struct ChannelModeratedRoles
* MM-22206 Use structs instead of map
* MM-22206 Add test cases for GetChannelModeratedPermissions
* MM-22206 Add tests for ChannelModeratedPermissionsChangedByPatch
* MM-22206 Use NewBool instead of defining booleans
* MM-22206 Tie Channel Mentions to Create Posts when building Channel Moderations
* Revert "MM-22206 Tie Channel Mentions to Create Posts when building Channel Moderations"
This reverts commit a0bfc95f17.
* MM-22206 Review changes
Modify GetSchemeRolesForChannel to return named variables
Change calls to SessionHasPermissionToChannel to SessionHasPermissionTo
Add a CreateChannelScheme method
Add a DeleteChannelScheme method
Move GetChannelModeratedPermissions to Role model
* Fix lint
* Add ChannelModeration methods to App interface
* MM-22206 Rename method to GetTeamSchemeChannelRoles
* MM-22206 Check CHANNEL_MODERATED_PERMISSIONS_MAP for existing permission before iterating through it
* Modify wording to higherScoped to match #13813
* MM-22206 Delete channel scheme between tests
* MM-22206 Fix tests
* Actually patch role
* MM-22206 Shadow declaration of err
* MM-21727 add an endpoint to move a command to another team
* endpoint
* mock / client
* unit tests
* MM-21727 PR feedback, addressed nits
* MM-21727 remove CommandMove base route
* MM-21272 replace TeamId struct with CommandMoveRequest struct
* MM-21727 fixed typo in CommandMoveRequest struct name
* MM-21727 return not-found for all getCommandById calls
* MM-21727 ensure no command ids leak
* when calling GetCommandById with invalid id return not_found
* when checking perms to manage commands for team return same not_found
* update unit tests to check for not_found
* MM-21727 Rename TeamIdFromCommandMoveRequestJson -> CommandMoveRequestFromJson
* MM-19250 add endpoint to retrieve command by id
* endpoint
* client
* unit tests
* MM-19250 update comment; remove redundant unit test
* MM-19250 rename GetCommand to GetCommandById
* MM-19250 don't filter on autocomplete flag
* MM-19250: require team_id when using GetCommandById
* team_id added to endpoint query string for GET
* unit test to check for mismatch teamid param and command teamid
* Revert "MM-19250: require team_id when using GetCommandById"
This reverts commit ed78e27964.
* MM-19250 don't leak existence of id when user doesn't have perms
* return 404 not_found when id not found
* return 404 not_found when id exists but user missing perms to view team
* return 404 not_found when id exists but user missing perms to manage commands
* MM-19250 fix typos in comments
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
* MM-20644: Add users to teams as a SchemeAdmin based on a new configuration field on GroupTeams and GroupChannels records.
* MM-20644: Adds SchemeAdmin to mapping of the GroupSyncable struct fields.
* MM-2064: Adds test to ensure SchemeAdmin field value is mapped.
* MM-20644: Adds missing index creation for fresh DBs.
* MM-20644: Duplicates UpdateMembersRole across Team and Channel stores. Adds tests.
* MM-20644: Fixes some old method name references.
* MM-20644: Moves variable declaration; removes Println statement.
* MM-20644: Use a SQL query instead of two to update Team and Channel members.
* MM-20644: Fixes tests; updates query.
* MM-20644: Fix permission check for patching a group syncable.
* MM-20644: Fixes test for change of permissions verification in group patch API request.
* MM-20644: Fix for ORM select vs insert.
* MM-20644: Linting fixes.
* MM-20644: Fixes some tests.
* MM-20644: Skips changing the role of guests.
* MM-20644: Added syncableID filtering
* 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
* MM-8607: add ability to turn off non-critical services under load
* server busy invalid param unit tests
* MM-8607: rename server busy endpoints
* MM-8607: handle case where App not initialized
* MM-8607: additional unit test cases per feedback.
* MM-8607: use decorator to check isbusy when adding endpoint route
* MM-8607: rename endpoints, use struct for json
* Update api4/system.go
Fix misspelled log output
Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>
* MM-8607: fix i18n order; max seconds for server busy expiry
* MM-18356: Adds ability to paginate channel search.
* MM-18356: Minor refactor.
* MM-18356: Adds doc.
* MM-18356: Fixes doc.
* MM-18356: Some commentary, adds the total count to non-paginated responses, and removes a stray fmt.
* MM-18356: Fixes shadowed variable.
* MM-18356: Removes paginate field and API parameter.
* MM-18356: Adds method to check if channel search is a paginated request.
* MM-18356: Vet fix.