diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/app.go | 13 | ||||
-rw-r--r-- | app/scheme.go | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/app/app.go b/app/app.go index d4a663e32..16470d850 100644 --- a/app/app.go +++ b/app/app.go @@ -92,6 +92,8 @@ type App struct { clientConfig map[string]string clientConfigHash string diagnosticId string + + phase2PermissionsMigrationComplete bool } var appCount = 0 @@ -588,3 +590,14 @@ func (a *App) DoAdvancedPermissionsMigration() { mlog.Critical(fmt.Sprint(result.Err)) } } + +func (a *App) SetPhase2PermissionsMigrationStatus(isComplete bool) error { + if !isComplete { + res := <-a.Srv.Store.System().PermanentDeleteByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2) + if res.Err != nil { + return res.Err + } + } + a.phase2PermissionsMigrationComplete = isComplete + return nil +} diff --git a/app/scheme.go b/app/scheme.go index c44690954..f070e36f8 100644 --- a/app/scheme.go +++ b/app/scheme.go @@ -142,10 +142,16 @@ func (a *App) GetChannelsForScheme(scheme *model.Scheme, offset int, limit int) } func (a *App) IsPhase2MigrationCompleted() *model.AppError { + if a.phase2PermissionsMigrationComplete { + return nil + } + if result := <-a.Srv.Store.System().GetByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2); result.Err != nil { return model.NewAppError("App.IsPhase2MigrationCompleted", "app.schemes.is_phase_2_migration_completed.not_completed.app_error", nil, result.Err.Error(), http.StatusNotImplemented) } + a.phase2PermissionsMigrationComplete = true + return nil } |