summaryrefslogtreecommitdiffstats
path: root/store/store.go
Commit message (Collapse)AuthorAgeFilesLines
* Pr 9039 (#9187)Martin Kraft2018-07-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * MM-11065: Allow to search and get archived channels from the API * Fixing more tests * Add some unit tests * Add includeDeleted parameter to session permissions check function * More test fixing * Adding archive channels list in channels search * Add restriction for archived channel edition * Reverting permissions checks modification * Changed the query parameter to include_deleted * Enable search archive channels as true by default * Adding tests for verify search on deleted channels * Allowing to override archive channels during the imports * Fixed test * Search in archive channels from the API must be explicitly requested * Removing includeDeleted parameter from GetChannelByName and GetChannelByNameForTeam * Back to ViewArchivedChannels config * Fixing tests * Reverting GetChannelByName parameter * Add include deleted parameter on GetChannel functions in plugins api * Fixing tests
* Lock bulk importing to master database node (#9012)Joram Wilander2018-06-271-0/+2
|
* Implementation of File Exists Function; Delete FileInfos upon Permanent User ↵Daniel Schalla2018-06-251-0/+2
| | | | | | | Delete (#8958) Check if file was deleted on FS Warning message if file couldnt be removed
* MM-10570: Make permissions reset command clear custom role assignments. (#8976)George Goldberg2018-06-251-0/+3
|
* MM-10233: Add scheme importing to bulk importer. (#8928)George Goldberg2018-06-211-0/+1
|
* MM-10412: Adds deleteBy prop to posts. (#8896)Martin Kraft2018-06-011-1/+1
|
* MM-10235: Make permissions reset CLI shcemes-aware. (#8773)George Goldberg2018-05-171-0/+3
| | | | | | * MM-10235: Make permissions reset CLI shcemes-aware. * Add i18n strings.
* MM-9728: Online migration for advanced permissions phase 2 (#8744)George Goldberg2018-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2Martin Kraft2018-05-111-1/+1
|\
| * MM-4998 Adding LoginIdAttribute to allow LDAP users to change their login ID ↵Christopher Speller2018-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | without losing their account (#8756) * Adding LoginIdAttribute * Modifying LDAP to use loginIDAttribute. * Adding IDAttribute migration and AD objectGUID support. * Removing unused idea. * Fix typo.
* | MM-10140: API Implementation for Schemes related Endpoints (#8615)George Goldberg2018-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2Martin Kraft2018-05-011-3/+1
|\|
| * Structured logging (#8673)Christopher Speller2018-04-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable.
* | MM-8796: Full implementation of "Schemes" in Store/Model/App layers. (#8357)George Goldberg2018-04-201-0/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* MM-10121: CLI command to reset permissions system to default state. (#8637)George Goldberg2018-04-181-0/+2
| | | | | | * MM-10121: CLI command to reset permissions system to default state. * Review comment.
* Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1Martin Kraft2018-03-271-0/+1
|\
| * Relax 4k post message limit (#8478)Jesse Hallam2018-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-131-1/+6
|\|
| * Remove query to update channel extra_update_at field on user ↵Joram Wilander2018-03-091-1/+0
| | | | | | | | activation/deactivation (#8415)
| * MM-9274- Sort Users in Channel by status (#8181)Stephen Kiers2018-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * sort by lastActivity * added status ordering to Users * sort offline before dnd * remove data not needed * added seperate call for when order=‘status’ is on GetUser request * remove PrintLn * styling fix * remove mistake * mistake 2 * better comment * explicit if statemnt * writing tests * removed manually added mocks * generated mock * ICU-668 Added unit tests * style fix * reverse dnd and offline * Fixed app.SaveStatusAndBroadcast * Fixed incorrect merge * Fixing incorrect merge again
| * MM-9664 Add invalidation metrics for store caches (#8340)Joram Wilander2018-03-051-0/+5
| | | | | | | | | | | | | | | | * Add invalidation metrics for store caches * Increment session invalidation metric * Fix tests
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-03-021-0/+1
|\|
| * PLT-7567: Integration of Team Icons (#8284)Christian Hoff2018-03-011-0/+1
| | | | | | | | | | | | | | | | | | | | * PLT-7567: Integration of Team Icons * PLT-7567: Read replica workaround, upgrade logic moved, more concrete i18n key * PLT-7567: Read replica workaround, corrections * PLT-7567: upgrade correction
* | Merge branch 'master' into advanced-permissions-phase-1George Goldberg2018-02-061-0/+1
|\|
| * ABC-79: Optimize channel autocomplete query (#8163)Chris2018-01-311-0/+1
| | | | | | | | | | | | * optimize channel autocomplete query * move to new autocomplete endpoint
* | XYZ-37: Advanced Permissions Phase 1 Backend. (#8159)George Goldberg2018-02-061-0/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | * XYZ-13: Update Permission and Role structs to new design. * XYZ-10: Role store. * XYZ-9/XYZ-44: Roles API endpoints and WebSocket message. * XYZ-8: Switch server permissions checks to store backed roles. * XYZ-58: Proper validation of roles where required. * XYZ-11/XYZ-55: Migration to store backed roles from policy config. * XYZ-37: Update unit tests to work with database roles. * XYZ-56: Remove the "guest" role. * Changes to SetDefaultRolesFromConfig. * Short-circuit the store if nothing has changed. * Address first round of review comments. * Address second round of review comments.
* ABC-90 Add POST /emoji/search and GET /emoji/autocomplete API endpoints (#8125)Joram Wilander2018-01-231-0/+1
| | | | | | * Add POST /emoji/search and GET /emoji/autocomplete API endpoints * Add constant to be clearer
* Add sort query parameter to GET /emojis (#8121)Joram Wilander2018-01-191-1/+1
|
* ABC-73 Move session clean-up to daily task (#8095)Joram Wilander2018-01-171-0/+1
| | | | | | * Move session clean-up to daily task * Split delete query into batches
* [PLT-7793] Add /users/tokens/search endpoint (#8088)Adrian Carolli2018-01-111-0/+1
| | | | | | | | * Add /users/tokens/search endpoint + tests * Fix check-style * Unnecessary deletion
* [PLT-7793] Added /users/tokens endpoint (#8038)Adrian Carolli2018-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added /users/tokens/all endpoint - UserAccessStore now has getAll method - Added tests - Added route - Added handler * Remove space fix check-style * Remove blank space check-style * Fixes for make check-style * Remove extra code that is un-needed in user_test.go * Rename endpoint + grammar - Renamed /users/tokens/all to /users/tokens - Renamed getUserAccessTokens to getUserAccessTokensForUser - Renamed getAllUserAccessTokens to getUserAccessTokens - Minor Grammar changes * Add localization for sql_user_access_token.get_all * Fix minor plural spelling
* PLT-8233: Purge ChannelMemberHistory Data when Data Retention Job runs (#7937)Jonathan2017-12-051-1/+1
| | | | | | | | | | * Changed the channel member history purge function to match pattern established by other data retention purge methods * Simplifying the channel member history store and associated tests * Regenerating mocks * Using a constant
* PLT-7503: Create Message Export Scheduled Task and CLI Command (#7612)Jonathan2017-11-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Created message export scheduled task * Added CLI command to immediately kick off an export job * Added email addresses for users joining and leaving the channel to the export * Added support for both MySQL and PostgreSQL * Fixing gofmt error * Added a new ChannelMemberHistory store and associated tests * Updating the ChannelMemberHistory channel as users create/join/leave channels * Added user email to the message export object so it can be included in the actiance export xml * Don't fail to log a leave event if a corresponding join event wasn't logged * Adding copyright notices * Adding message export settings to daily diagnostics report * Added System Console integration for message export * Cleaned up TODOs * Made batch size configurable * Added export from timestamp to CLI command * Made ChannelMemberHistory table updates best effort * Added a context-based timeout option to the message export CLI * Minor PR updates/improvements * Removed unnecessary fields from MessageExport object to reduce query overhead * Removed JSON functions from the message export query in an effort to optimize performance * Changed the way that channel member history queries and purges work to better account for edge cases * Fixing a test I missed with the last refactor * Added file copy functionality to file backend, improved config validation, added default config values * Fixed file copy tests * More concise use of the testing libraries * Fixed context leak error * Changed default export path to correctly place an 'export' directory under the 'data' directory * Can't delete records from a read replica * Fixed copy file tests * Start job workers when license is applied, if configured to do so * Suggestions from the PR * Moar unit tests * Fixed test imports
* PLT-5458: If someone posts a channel link to channel_A that you don't belong ↵Chris2017-11-281-0/+1
| | | | | | | | | | | | to, it doesn't render properly (#7833) * add channel link hints to post props * optimization * update regex, add unit test * fix rebase issue
* PLT-8131 (part2) Add plugin key value store support (#7902)Joram Wilander2017-11-271-0/+7
| | | | | | | | * Add plugin key value store support * Add localization strings * Updates per feedback
* PLT-7934: Make query for bulk elasticsearch indexing more efficient. (#7664)George Goldberg2017-10-251-1/+2
|
* refactor max users per team (#7691)Chris2017-10-201-1/+1
|
* refactor max channels per team enforcement (#7690)Chris2017-10-201-1/+1
|
* [PLT-7794] Add user access token enable/disable endpoints (#7630)Nick Frazier2017-10-191-0/+2
| | | | | | | | | | | | * Add column to UserAccessTokens table * PLT-7794 Add user access token enable/disable endpoints * replaced eliminated global variable * updates to user_access_token_store and upgrade.go * style fix and cleanup
* Fix races / finally remove global app for good (#7570)Chris2017-10-041-0/+11
| | | | | | | | | | | | * finally remove global app for good * test compilation fixes * fix races * fix deadlock * wake up write pump so it doesn't take forever to clean up
* PLT-7218: CLI to move slash commands between teams. (#7574)George Goldberg2017-10-041-0/+2
|
* PLT-7644: Improve job scheduler architecture. (#7532)George Goldberg2017-09-281-0/+2
|
* PLT-7619: Cleanup flags in data retention. (#7501)George Goldberg2017-09-221-0/+1
|
* PLT-7639: Batch delete methods for data retention. (#7444)George Goldberg2017-09-151-0/+4
|
* Renaming repoChristopher Speller2017-09-061-1/+1
|
* PLT-???? Prepare file upload infrastructure for Data Retention. (#7266)George Goldberg2017-08-251-0/+1
| | | | | | | | | | | | | | | | | * Prepare file upload infrastructure for Data Retention. This commit prepares the file upload infrastructure for the data retention feature that is under construction. Changes are: * Move file management code to utils to allow access to it from jobs. * From now on, store all file uploads in a top level folder which is the date of the day on which they were uploaded. This commit is based on Harrison Healey's branch, but updated to work with the latest master. * Use NewAppError
* PLT-1649: add response_url support for custom slash commands (#6739)Chris2017-08-161-0/+8
| | | | | | | | | | * add response_url support for custom slash commands * pr suggestions * pr update / suggestion * test fix
* Revert " #4755 Combining consecutive user join/leave system messages to ↵Saturnino Abril2017-08-011-1/+0
| | | | | | | | | | | | single message and few other changes." (#7072) * Revert "PLT-6603: Don't return all posts on invalid query. (#7061)" This reverts commit 25a2013890c7e07b4621fa9b18342e7f35363049. * Revert " #4755 Combining consecutive user join/leave system messages to single message and few other changes. (#5945)" This reverts commit 8a91235fb3cdc8d094dbc2eaa0d7baa447132b3c.
* #4755 Combining consecutive user join/leave system messages to single ↵Debanshu Kundu2017-08-011-0/+1
| | | | | | | | | message and few other changes. (#5945) fix 7 and 8 remove @ at "{username} joined the channel" refactor and update test
* PLT-6763 Implement user access tokens and new roles (server-side) (#6972)Joram Wilander2017-07-311-0/+10
| | | | | | | | | | | | | | | | * Implement user access tokens and new roles * Update config.json * Add public post permission to apiv3 * Remove old comment * Fix model unit test * Updates to store per feedback * Updates per feedback from CS