Skip to content

Commit

Permalink
Invalidate dashboards data after logout (Graylog2#3700)
Browse files Browse the repository at this point in the history
Listen to SessionStore events to ensure we reset the dashboards after a
logout, so users are not able to see data from previous sessions.

Fixes Graylog2#3693
  • Loading branch information
edmundoa authored and joschi committed Apr 12, 2017
1 parent 5869d00 commit e80ef78
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions graylog2-web-interface/src/stores/dashboards/DashboardsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const PermissionsMixin = require('util/PermissionsMixin');

const StoreProvider = require('injection/StoreProvider');
const CurrentUserStore = StoreProvider.getStore('CurrentUser');
const SessionStore = StoreProvider.getStore('Session');

interface Dashboard {
id: string;
Expand All @@ -28,10 +29,21 @@ class DashboardsStore {
private _onDashboardsChanged: {(dashboards: Immutable.List<Dashboard>): void; }[] = [];

constructor() {
this._initializeDashboards();
SessionStore.listen(this.onSessionChange, this);
}

_initializeDashboards() {
this._dashboards = Immutable.List<Dashboard>();
this._writableDashboards = Immutable.Map<string, Dashboard>();
}

onSessionChange() {
if (!SessionStore.isLoggedIn()) {
this._initializeDashboards();
}
}

get dashboards(): Immutable.List<Dashboard> {
return this._dashboards;
}
Expand Down

0 comments on commit e80ef78

Please sign in to comment.