mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-1126 Clear caches on logout.
This commit is contained in:
@@ -23,4 +23,4 @@
|
|||||||
/**
|
/**
|
||||||
* The module for authentication and management of tokens.
|
* The module for authentication and management of tokens.
|
||||||
*/
|
*/
|
||||||
angular.module('auth', ['ngCookies']);
|
angular.module('auth', ['ngCookies', 'rest']);
|
||||||
|
@@ -30,6 +30,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
var $cookieStore = $injector.get('$cookieStore');
|
var $cookieStore = $injector.get('$cookieStore');
|
||||||
var $http = $injector.get('$http');
|
var $http = $injector.get('$http');
|
||||||
var $q = $injector.get('$q');
|
var $q = $injector.get('$q');
|
||||||
|
var cacheService = $injector.get('cacheService');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
@@ -193,6 +194,9 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
* successful.
|
* successful.
|
||||||
*/
|
*/
|
||||||
service.logout = function logout() {
|
service.logout = function logout() {
|
||||||
|
|
||||||
|
// Clear all caches
|
||||||
|
cacheService.clearCaches();
|
||||||
|
|
||||||
// Clear authentication data
|
// Clear authentication data
|
||||||
var token = service.getCurrentToken();
|
var token = service.getCurrentToken();
|
||||||
|
@@ -28,32 +28,42 @@ angular.module('rest').factory('cacheService', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $cacheFactory = $injector.get('$cacheFactory');
|
var $cacheFactory = $injector.get('$cacheFactory');
|
||||||
|
|
||||||
|
|
||||||
// Return service containing all caches
|
// Service containing all caches
|
||||||
return {
|
var service = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared cache used by both connectionGroupService and
|
* Shared cache used by both connectionGroupService and
|
||||||
* connectionService.
|
* connectionService.
|
||||||
*
|
*
|
||||||
* @type $cacheFactory.Cache
|
* @type $cacheFactory.Cache
|
||||||
*/
|
*/
|
||||||
connections : $cacheFactory('API-CONNECTIONS'),
|
service.connections = $cacheFactory('API-CONNECTIONS');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache used by protocolService.
|
* Cache used by protocolService.
|
||||||
*
|
*
|
||||||
* @type $cacheFactory.Cache
|
* @type $cacheFactory.Cache
|
||||||
*/
|
*/
|
||||||
protocols : $cacheFactory('API-PROTOCOLS'),
|
service.protocols = $cacheFactory('API-PROTOCOLS');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared cache used by both userService and permissionService.
|
* Shared cache used by both userService and permissionService.
|
||||||
*
|
*
|
||||||
* @type $cacheFactory.Cache
|
* @type $cacheFactory.Cache
|
||||||
*/
|
*/
|
||||||
users : $cacheFactory('API-USERS')
|
service.users = $cacheFactory('API-USERS');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all caches defined in this service.
|
||||||
|
*/
|
||||||
|
service.clearCaches = function clearCaches() {
|
||||||
|
service.protocols.removeAll();
|
||||||
|
service.connections.removeAll();
|
||||||
|
service.users.removeAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
Reference in New Issue
Block a user