diff options
author | George Goldberg <george@gberg.me> | 2018-05-14 15:59:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 15:59:04 +0100 |
commit | 51bd710ecdca6628461c9fa2679737073e4d5059 (patch) | |
tree | b2a4837ced3ed515ee505728917a6630b0553f76 /app | |
parent | 91557bbd978500388a11b99401783164e143a966 (diff) | |
download | chat-51bd710ecdca6628461c9fa2679737073e4d5059.tar.gz chat-51bd710ecdca6628461c9fa2679737073e4d5059.tar.bz2 chat-51bd710ecdca6628461c9fa2679737073e4d5059.zip |
MM-9728: Online migration for advanced permissions phase 2 (#8744)
* 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.
Diffstat (limited to 'app')
-rw-r--r-- | app/app.go | 10 | ||||
-rw-r--r-- | app/scheme.go | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/app/app.go b/app/app.go index 2cdf333c1..d4a663e32 100644 --- a/app/app.go +++ b/app/app.go @@ -20,6 +20,7 @@ import ( "github.com/mattermost/mattermost-server/einterfaces" ejobs "github.com/mattermost/mattermost-server/einterfaces/jobs" "github.com/mattermost/mattermost-server/jobs" + tjobs "github.com/mattermost/mattermost-server/jobs/interfaces" "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/plugin/pluginenv" @@ -319,6 +320,12 @@ func RegisterJobsLdapSyncInterface(f func(*App) ejobs.LdapSyncInterface) { jobsLdapSyncInterface = f } +var jobsMigrationsInterface func(*App) tjobs.MigrationsJobInterface + +func RegisterJobsMigrationsJobInterface(f func(*App) tjobs.MigrationsJobInterface) { + jobsMigrationsInterface = f +} + var ldapInterface func(*App) einterfaces.LdapInterface func RegisterLdapInterface(f func(*App) einterfaces.LdapInterface) { @@ -413,6 +420,9 @@ func (a *App) initJobs() { if jobsLdapSyncInterface != nil { a.Jobs.LdapSync = jobsLdapSyncInterface(a) } + if jobsMigrationsInterface != nil { + a.Jobs.Migrations = jobsMigrationsInterface(a) + } } func (a *App) DiagnosticId() string { diff --git a/app/scheme.go b/app/scheme.go index b43914eb8..a8eb9ef46 100644 --- a/app/scheme.go +++ b/app/scheme.go @@ -3,7 +3,9 @@ package app -import "github.com/mattermost/mattermost-server/model" +import ( + "github.com/mattermost/mattermost-server/model" +) func (a *App) GetScheme(id string) (*model.Scheme, *model.AppError) { if result := <-a.Srv.Store.Scheme().Get(id); result.Err != nil { @@ -109,7 +111,9 @@ func (a *App) GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) } func (a *App) IsPhase2MigrationCompleted() *model.AppError { - // TODO: Actually check the Phase 2 migration has completed before permitting these actions. + if result := <-a.Srv.Store.System().GetByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2); result.Err != nil { + return result.Err + } return nil } |