fix(kube): clear kube cache on login/logout [EE-6620] (#11026)

pull/11037/head
Matt Hook 2024-01-30 10:39:12 +13:00 committed by GitHub
parent 89359dae8c
commit 70deba50ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import angular from 'angular'; import angular from 'angular';
import uuidv4 from 'uuid/v4'; import uuidv4 from 'uuid/v4';
import { getEnvironments } from '@/react/portainer/environments/environment.service'; import { getEnvironments } from '@/react/portainer/environments/environment.service';
import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper';
class AuthenticationController { class AuthenticationController {
/* @ngInject */ /* @ngInject */
@ -261,6 +262,9 @@ class AuthenticationController {
this.LocalStorage.cleanLogoutReason(); this.LocalStorage.cleanLogoutReason();
} }
// always clear the kubernetes cache on login
dispatchCacheRefreshEvent();
if (this.Authentication.isAuthenticated()) { if (this.Authentication.isAuthenticated()) {
await this.postLoginSteps(); await this.postLoginSteps();
} }

View File

@ -1,4 +1,5 @@
import angular from 'angular'; import angular from 'angular';
import { dispatchCacheRefreshEvent } from '@/portainer/services/http-request.helper';
class LogoutController { class LogoutController {
/* @ngInject */ /* @ngInject */
@ -30,6 +31,9 @@ class LogoutController {
try { try {
await this.Authentication.logout(); await this.Authentication.logout();
} finally { } finally {
// always clear the kubernetes cache
dispatchCacheRefreshEvent();
this.LocalStorage.storeLogoutReason(error); this.LocalStorage.storeLogoutReason(error);
if (settings.OAuthLogoutURI && this.Authentication.getUserDetails().ID !== 1) { if (settings.OAuthLogoutURI && this.Authentication.getUserDetails().ID !== 1) {
this.$window.location.href = settings.OAuthLogoutURI; this.$window.location.href = settings.OAuthLogoutURI;