diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index 4bda41d328e..ac61f6bd3f6 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -39,6 +39,7 @@ export class BackendSrv implements BackendService { appEvents: appEvents, contextSrv: contextSrv, logout: () => { + contextSrv.setLoggedOut(); window.location.reload(); }, }; diff --git a/public/app/core/services/context_srv.ts b/public/app/core/services/context_srv.ts index c65d763270d..ff98c016370 100644 --- a/public/app/core/services/context_srv.ts +++ b/public/app/core/services/context_srv.ts @@ -49,6 +49,14 @@ export class ContextSrv { this.minRefreshInterval = config.minRefreshInterval; } + /** + * Indicate the user has been logged out + */ + setLoggedOut() { + this.user.isSignedIn = false; + this.isSignedIn = false; + } + hasRole(role: string) { return this.user.orgRole === role; } diff --git a/public/app/features/dashboard/services/ChangeTracker.ts b/public/app/features/dashboard/services/ChangeTracker.ts index afe7b7bde8b..c9dde5246a7 100644 --- a/public/app/features/dashboard/services/ChangeTracker.ts +++ b/public/app/features/dashboard/services/ChangeTracker.ts @@ -93,6 +93,11 @@ export class ChangeTracker { return true; } + //Ignore changes if the user has been signed out + if (!this.contextSrv.isSignedIn) { + return true; + } + const meta = this.current.meta; return !meta.canSave || meta.fromScript || meta.fromFile; }