mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-526: Merge handle absolutely all promise rejections.
This commit is contained in:
@@ -21,5 +21,6 @@
|
|||||||
* The module for authentication and management of tokens.
|
* The module for authentication and management of tokens.
|
||||||
*/
|
*/
|
||||||
angular.module('auth', [
|
angular.module('auth', [
|
||||||
|
'rest',
|
||||||
'storage'
|
'storage'
|
||||||
]);
|
]);
|
||||||
|
@@ -46,10 +46,9 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
var Error = $injector.get('Error');
|
var Error = $injector.get('Error');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $http = $injector.get('$http');
|
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var $rootScope = $injector.get('$rootScope');
|
var $rootScope = $injector.get('$rootScope');
|
||||||
var localStorageService = $injector.get('localStorageService');
|
var localStorageService = $injector.get('localStorageService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
@@ -155,27 +154,8 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
*/
|
*/
|
||||||
service.authenticate = function authenticate(parameters) {
|
service.authenticate = function authenticate(parameters) {
|
||||||
|
|
||||||
var authenticationProcess = $q.defer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the given authentication data within the browser and marks
|
|
||||||
* the authentication process as completed.
|
|
||||||
*
|
|
||||||
* @param {Object} data
|
|
||||||
* The authentication data returned by the token REST endpoint.
|
|
||||||
*/
|
|
||||||
var completeAuthentication = function completeAuthentication(data) {
|
|
||||||
|
|
||||||
// Store auth data
|
|
||||||
setAuthenticationResult(new AuthenticationResult(data));
|
|
||||||
|
|
||||||
// Process is complete
|
|
||||||
authenticationProcess.resolve();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// Attempt authentication
|
// Attempt authentication
|
||||||
$http({
|
return requestService({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: 'api/tokens',
|
url: 'api/tokens',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -185,44 +165,32 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
})
|
})
|
||||||
|
|
||||||
// If authentication succeeds, handle received auth data
|
// If authentication succeeds, handle received auth data
|
||||||
.then(function authenticationSuccessful(response) {
|
.then(function authenticationSuccessful(data) {
|
||||||
var data = response.data;
|
|
||||||
|
|
||||||
var currentToken = service.getCurrentToken();
|
var currentToken = service.getCurrentToken();
|
||||||
|
setAuthenticationResult(new AuthenticationResult(data));
|
||||||
|
|
||||||
// If a new token was received, ensure the old token is invalidated,
|
// If a new token was received, ensure the old token is invalidated,
|
||||||
// if any, and notify listeners of the new token
|
// if any, and notify listeners of the new token
|
||||||
if (data.authToken !== currentToken) {
|
if (data.authToken !== currentToken) {
|
||||||
|
|
||||||
// If an old token existed, explicitly logout first
|
// If an old token existed, request that the token be revoked
|
||||||
if (currentToken) {
|
if (currentToken) {
|
||||||
service.logout()
|
service.logout().catch(angular.noop)
|
||||||
['finally'](function logoutComplete() {
|
|
||||||
completeAuthentication(data);
|
|
||||||
$rootScope.$broadcast('guacLogin', data.authToken);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, simply complete authentication and notify of login
|
// Notify of login and new token
|
||||||
else {
|
$rootScope.$broadcast('guacLogin', data.authToken);
|
||||||
completeAuthentication(data);
|
|
||||||
$rootScope.$broadcast('guacLogin', data.authToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, just finish the auth process
|
// Authentication was successful
|
||||||
else
|
return data;
|
||||||
completeAuthentication(data);
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// If authentication fails, propogate failure to returned promise
|
// If authentication fails, propogate failure to returned promise
|
||||||
['catch'](function authenticationFailed(response) {
|
['catch'](requestService.createErrorCallback(function authenticationFailed(error) {
|
||||||
|
|
||||||
// Ensure error object exists, even if the error response is not
|
|
||||||
// coming from the authentication REST endpoint
|
|
||||||
var error = new Error(response.data);
|
|
||||||
|
|
||||||
// Request credentials if provided credentials were invalid
|
// Request credentials if provided credentials were invalid
|
||||||
if (error.type === Error.Type.INVALID_CREDENTIALS)
|
if (error.type === Error.Type.INVALID_CREDENTIALS)
|
||||||
@@ -232,10 +200,10 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
else if (error.type === Error.Type.INSUFFICIENT_CREDENTIALS)
|
else if (error.type === Error.Type.INSUFFICIENT_CREDENTIALS)
|
||||||
$rootScope.$broadcast('guacInsufficientCredentials', parameters, error);
|
$rootScope.$broadcast('guacInsufficientCredentials', parameters, error);
|
||||||
|
|
||||||
authenticationProcess.reject(error);
|
// Authentication failed
|
||||||
});
|
throw error;
|
||||||
|
|
||||||
return authenticationProcess.promise;
|
}));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -317,7 +285,7 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
|||||||
$rootScope.$broadcast('guacLogout', token);
|
$rootScope.$broadcast('guacLogout', token);
|
||||||
|
|
||||||
// Delete old token
|
// Delete old token
|
||||||
return $http({
|
return requestService({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: 'api/tokens/' + token
|
url: 'api/tokens/' + token
|
||||||
});
|
});
|
||||||
|
@@ -37,6 +37,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var iconService = $injector.get('iconService');
|
var iconService = $injector.get('iconService');
|
||||||
var preferenceService = $injector.get('preferenceService');
|
var preferenceService = $injector.get('preferenceService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var tunnelService = $injector.get('tunnelService');
|
var tunnelService = $injector.get('tunnelService');
|
||||||
var userPageService = $injector.get('userPageService');
|
var userPageService = $injector.get('userPageService');
|
||||||
|
|
||||||
@@ -161,7 +162,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
name : "CLIENT.ACTION_LOGOUT",
|
name : "CLIENT.ACTION_LOGOUT",
|
||||||
className : "logout button",
|
className : "logout button",
|
||||||
callback : function logoutCallback() {
|
callback : function logoutCallback() {
|
||||||
authenticationService.logout()['finally'](function logoutComplete() {
|
authenticationService.logout()
|
||||||
|
['catch'](requestService.IGNORE)
|
||||||
|
['finally'](function logoutComplete() {
|
||||||
$location.url('/');
|
$location.url('/');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -188,7 +191,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action which replaces the current client with a newly-connected client.
|
* Action which replaces the current client with a newly-connected client.
|
||||||
@@ -447,7 +450,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
|
|
||||||
// Sync local clipboard as long as the menu is not open
|
// Sync local clipboard as long as the menu is not open
|
||||||
if (!$scope.menu.shown)
|
if (!$scope.menu.shown)
|
||||||
clipboardService.setLocalClipboard(data);
|
clipboardService.setLocalClipboard(data)['catch'](angular.noop);
|
||||||
|
|
||||||
// Associate new clipboard data with any currently-pressed key
|
// Associate new clipboard data with any currently-pressed key
|
||||||
for (var keysym in keysCurrentlyPressed)
|
for (var keysym in keysCurrentlyPressed)
|
||||||
@@ -466,7 +469,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
tunnelService.getSharingProfiles(uuid)
|
tunnelService.getSharingProfiles(uuid)
|
||||||
.then(function sharingProfilesRetrieved(sharingProfiles) {
|
.then(function sharingProfilesRetrieved(sharingProfiles) {
|
||||||
$scope.sharingProfiles = sharingProfiles;
|
$scope.sharingProfiles = sharingProfiles;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -576,7 +579,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
// key was pressed (if any) as long as the menu is not open
|
// key was pressed (if any) as long as the menu is not open
|
||||||
var clipboardData = clipboardDataFromKey[keysym];
|
var clipboardData = clipboardDataFromKey[keysym];
|
||||||
if (clipboardData && !$scope.menu.shown)
|
if (clipboardData && !$scope.menu.shown)
|
||||||
clipboardService.setLocalClipboard(clipboardData);
|
clipboardService.setLocalClipboard(clipboardData)['catch'](angular.noop);
|
||||||
|
|
||||||
// Deal with substitute key presses
|
// Deal with substitute key presses
|
||||||
if (substituteKeysPressed[keysym]) {
|
if (substituteKeysPressed[keysym]) {
|
||||||
@@ -614,6 +617,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
|
|
||||||
// Re-authenticate to verify auth status at end of connection
|
// Re-authenticate to verify auth status at end of connection
|
||||||
authenticationService.updateCurrentToken($location.search())
|
authenticationService.updateCurrentToken($location.search())
|
||||||
|
['catch'](requestService.IGNORE)
|
||||||
|
|
||||||
// Show the requested status once the authentication check has finished
|
// Show the requested status once the authentication check has finished
|
||||||
['finally'](function authenticationCheckComplete() {
|
['finally'](function authenticationCheckComplete() {
|
||||||
@@ -714,7 +718,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
// Sync with local clipboard
|
// Sync with local clipboard
|
||||||
clipboardService.getLocalClipboard().then(function clipboardRead(data) {
|
clipboardService.getLocalClipboard().then(function clipboardRead(data) {
|
||||||
$scope.$broadcast('guacClipboard', data);
|
$scope.$broadcast('guacClipboard', data);
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
// Hide status notification
|
// Hide status notification
|
||||||
guacNotification.showStatus(false);
|
guacNotification.showStatus(false);
|
||||||
|
@@ -272,7 +272,7 @@ angular.module('client').directive('guacFileBrowser', [function guacFileBrowser(
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}); // end retrieve file template
|
}, angular.noop); // end retrieve file template
|
||||||
|
|
||||||
// Refresh file browser when any upload completes
|
// Refresh file browser when any upload completes
|
||||||
$scope.$on('guacUploadComplete', function uploadComplete(event, filename) {
|
$scope.$on('guacUploadComplete', function uploadComplete(event, filename) {
|
||||||
|
@@ -42,6 +42,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var connectionService = $injector.get('connectionService');
|
var connectionService = $injector.get('connectionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var tunnelService = $injector.get('tunnelService');
|
var tunnelService = $injector.get('tunnelService');
|
||||||
var guacAudio = $injector.get('guacAudio');
|
var guacAudio = $injector.get('guacAudio');
|
||||||
var guacHistory = $injector.get('guacHistory');
|
var guacHistory = $injector.get('guacHistory');
|
||||||
@@ -514,7 +515,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id)
|
connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id)
|
||||||
.then(function connectionRetrieved(connection) {
|
.then(function connectionRetrieved(connection) {
|
||||||
managedClient.name = managedClient.title = connection.name;
|
managedClient.name = managedClient.title = connection.name;
|
||||||
});
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If using a connection group, pull connection name
|
// If using a connection group, pull connection name
|
||||||
@@ -522,7 +523,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
connectionGroupService.getConnectionGroup(clientIdentifier.dataSource, clientIdentifier.id)
|
connectionGroupService.getConnectionGroup(clientIdentifier.dataSource, clientIdentifier.id)
|
||||||
.then(function connectionGroupRetrieved(group) {
|
.then(function connectionGroupRetrieved(group) {
|
||||||
managedClient.name = managedClient.title = group.name;
|
managedClient.name = managedClient.title = group.name;
|
||||||
});
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
return managedClient;
|
return managedClient;
|
||||||
@@ -634,7 +635,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
credentialRequest.then(function sharingCredentialsReceived(sharingCredentials) {
|
credentialRequest.then(function sharingCredentialsReceived(sharingCredentials) {
|
||||||
client.shareLinks[sharingProfile.identifier] =
|
client.shareLinks[sharingProfile.identifier] =
|
||||||
ManagedShareLink.getInstance(sharingProfile, sharingCredentials);
|
ManagedShareLink.getInstance(sharingProfile, sharingCredentials);
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
return credentialRequest;
|
return credentialRequest;
|
||||||
|
|
||||||
|
@@ -28,7 +28,8 @@ angular.module('client').factory('ManagedFileUpload', ['$rootScope', '$injector'
|
|||||||
var ManagedFileTransferState = $injector.get('ManagedFileTransferState');
|
var ManagedFileTransferState = $injector.get('ManagedFileTransferState');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var tunnelService = $injector.get('tunnelService');
|
var requestService = $injector.get('requestService');
|
||||||
|
var tunnelService = $injector.get('tunnelService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object which serves as a surrogate interface, encapsulating a Guacamole
|
* Object which serves as a surrogate interface, encapsulating a Guacamole
|
||||||
@@ -171,7 +172,7 @@ angular.module('client').factory('ManagedFileUpload', ['$rootScope', '$injector'
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Notify if upload fails
|
// Notify if upload fails
|
||||||
function uploadFailed(error) {
|
requestService.createErrorCallback(function uploadFailed(error) {
|
||||||
|
|
||||||
// Use provide status code if the error is coming from the stream
|
// Use provide status code if the error is coming from the stream
|
||||||
if (error.type === Error.Type.STREAM_ERROR)
|
if (error.type === Error.Type.STREAM_ERROR)
|
||||||
@@ -185,7 +186,7 @@ angular.module('client').factory('ManagedFileUpload', ['$rootScope', '$injector'
|
|||||||
ManagedFileTransferState.StreamState.ERROR,
|
ManagedFileTransferState.StreamState.ERROR,
|
||||||
Guacamole.Status.Code.INTERNAL_ERROR);
|
Guacamole.Status.Code.INTERNAL_ERROR);
|
||||||
|
|
||||||
});
|
}));
|
||||||
|
|
||||||
// Ignore all further acks
|
// Ignore all further acks
|
||||||
stream.onack = null;
|
stream.onack = null;
|
||||||
|
@@ -415,81 +415,79 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
|
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
// Mark read attempt as in progress
|
// Track the originally-focused element prior to changing focus
|
||||||
pendingRead = deferred.promise;
|
var originalElement = document.activeElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to paste the clipboard contents into the
|
||||||
|
* currently-focused element. The promise related to the current
|
||||||
|
* attempt to read the clipboard will be resolved or rejected
|
||||||
|
* depending on whether the attempt to paste succeeds.
|
||||||
|
*/
|
||||||
|
var performPaste = function performPaste() {
|
||||||
|
|
||||||
|
// Attempt paste local clipboard into clipboard DOM element
|
||||||
|
if (document.execCommand('paste')) {
|
||||||
|
|
||||||
|
// If the pasted data is a single image, resolve with a blob
|
||||||
|
// containing that image
|
||||||
|
var currentImage = service.getImageContent(clipboardContent);
|
||||||
|
if (currentImage) {
|
||||||
|
|
||||||
|
// Convert the image's data URL into a blob
|
||||||
|
var blob = service.parseDataURL(currentImage);
|
||||||
|
if (blob) {
|
||||||
|
deferred.resolve(new ClipboardData({
|
||||||
|
type : blob.type,
|
||||||
|
data : blob
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reject if conversion fails
|
||||||
|
else
|
||||||
|
deferred.reject();
|
||||||
|
|
||||||
|
} // end if clipboard is an image
|
||||||
|
|
||||||
|
// Otherwise, assume the clipboard contains plain text
|
||||||
|
else
|
||||||
|
deferred.resolve(new ClipboardData({
|
||||||
|
type : 'text/plain',
|
||||||
|
data : clipboardContent.value
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, reading from the clipboard has failed
|
||||||
|
else
|
||||||
|
deferred.reject();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Mark read attempt as in progress, cleaning up event listener and
|
||||||
|
// selection once the paste attempt has completed
|
||||||
|
pendingRead = deferred.promise['finally'](function cleanupReadAttempt() {
|
||||||
|
|
||||||
|
// Do not use future changes in focus
|
||||||
|
clipboardContent.removeEventListener('focus', performPaste);
|
||||||
|
|
||||||
|
// Unfocus the clipboard DOM event to avoid mobile keyboard opening,
|
||||||
|
// restoring whichever element was originally focused
|
||||||
|
clipboardContent.blur();
|
||||||
|
originalElement.focus();
|
||||||
|
popSelection();
|
||||||
|
|
||||||
|
// No read is pending any longer
|
||||||
|
pendingRead = null;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Wait for the next event queue run before attempting to read
|
// Wait for the next event queue run before attempting to read
|
||||||
// clipboard data (in case the copy/cut has not yet completed)
|
// clipboard data (in case the copy/cut has not yet completed)
|
||||||
$window.setTimeout(function deferredClipboardRead() {
|
$window.setTimeout(function deferredClipboardRead() {
|
||||||
|
|
||||||
// Track the originally-focused element prior to changing focus
|
|
||||||
var originalElement = document.activeElement;
|
|
||||||
pushSelection();
|
pushSelection();
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to paste the clipboard contents into the
|
|
||||||
* currently-focused element. The promise related to the current
|
|
||||||
* attempt to read the clipboard will be resolved or rejected
|
|
||||||
* depending on whether the attempt to paste succeeds.
|
|
||||||
*/
|
|
||||||
var performPaste = function performPaste() {
|
|
||||||
|
|
||||||
// Attempt paste local clipboard into clipboard DOM element
|
|
||||||
if (document.execCommand('paste')) {
|
|
||||||
|
|
||||||
// If the pasted data is a single image, resolve with a blob
|
|
||||||
// containing that image
|
|
||||||
var currentImage = service.getImageContent(clipboardContent);
|
|
||||||
if (currentImage) {
|
|
||||||
|
|
||||||
// Convert the image's data URL into a blob
|
|
||||||
var blob = service.parseDataURL(currentImage);
|
|
||||||
if (blob) {
|
|
||||||
deferred.resolve(new ClipboardData({
|
|
||||||
type : blob.type,
|
|
||||||
data : blob
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reject if conversion fails
|
|
||||||
else
|
|
||||||
deferred.reject();
|
|
||||||
|
|
||||||
} // end if clipboard is an image
|
|
||||||
|
|
||||||
// Otherwise, assume the clipboard contains plain text
|
|
||||||
else
|
|
||||||
deferred.resolve(new ClipboardData({
|
|
||||||
type : 'text/plain',
|
|
||||||
data : clipboardContent.value
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, reading from the clipboard has failed
|
|
||||||
else
|
|
||||||
deferred.reject();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// Clean up event listener and selection once the paste attempt has
|
|
||||||
// completed
|
|
||||||
deferred.promise['finally'](function cleanupReadAttempt() {
|
|
||||||
|
|
||||||
// Do not use future changes in focus
|
|
||||||
clipboardContent.removeEventListener('focus', performPaste);
|
|
||||||
|
|
||||||
// Unfocus the clipboard DOM event to avoid mobile keyboard opening,
|
|
||||||
// restoring whichever element was originally focused
|
|
||||||
clipboardContent.blur();
|
|
||||||
originalElement.focus();
|
|
||||||
popSelection();
|
|
||||||
|
|
||||||
// No read is pending any longer
|
|
||||||
pendingRead = null;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Ensure clipboard element is blurred (and that the "focus" event
|
// Ensure clipboard element is blurred (and that the "focus" event
|
||||||
// will fire)
|
// will fire)
|
||||||
clipboardContent.blur();
|
clipboardContent.blur();
|
||||||
@@ -506,7 +504,8 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
|
|
||||||
}, CLIPBOARD_READ_DELAY);
|
}, CLIPBOARD_READ_DELAY);
|
||||||
|
|
||||||
return deferred.promise;
|
return pendingRead;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
@@ -60,6 +60,7 @@ angular.module('form').directive('guacFormField', [function formField() {
|
|||||||
controller: ['$scope', '$injector', '$element', function formFieldController($scope, $injector, $element) {
|
controller: ['$scope', '$injector', '$element', function formFieldController($scope, $injector, $element) {
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
|
var $log = $injector.get('$log');
|
||||||
var formService = $injector.get('formService');
|
var formService = $injector.get('formService');
|
||||||
var translationStringService = $injector.get('translationStringService');
|
var translationStringService = $injector.get('translationStringService');
|
||||||
|
|
||||||
@@ -116,7 +117,9 @@ angular.module('form').directive('guacFormField', [function formField() {
|
|||||||
// Append field content
|
// Append field content
|
||||||
if (field) {
|
if (field) {
|
||||||
formService.insertFieldElement(fieldContent[0],
|
formService.insertFieldElement(fieldContent[0],
|
||||||
field.type, $scope);
|
field.type, $scope)['catch'](function fieldCreationFailed() {
|
||||||
|
$log.warn('Failed to retrieve field with type "' + field.type + '"');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -94,6 +94,7 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
|
|||||||
// Required services
|
// Required services
|
||||||
var activeConnectionService = $injector.get('activeConnectionService');
|
var activeConnectionService = $injector.get('activeConnectionService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var GroupListItem = $injector.get('GroupListItem');
|
var GroupListItem = $injector.get('GroupListItem');
|
||||||
@@ -221,7 +222,7 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
|
|||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of data source identifier to the root connection group of that data
|
* Map of data source identifier to the root connection group of that data
|
||||||
@@ -126,6 +127,6 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
|
|||||||
)
|
)
|
||||||
.then(function rootGroupsRetrieved(rootConnectionGroups) {
|
.then(function rootGroupsRetrieved(rootConnectionGroups) {
|
||||||
$scope.rootConnectionGroups = rootConnectionGroups;
|
$scope.rootConnectionGroups = rootConnectionGroups;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
@@ -102,6 +102,10 @@ angular.module('index').config(['$routeProvider', '$locationProvider',
|
|||||||
route.resolve();
|
route.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
['catch'](function tokenUpdateFailed() {
|
||||||
|
route.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return promise that will resolve only if the requested page is the
|
// Return promise that will resolve only if the requested page is the
|
||||||
|
@@ -137,7 +137,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
var checkClipboard = function checkClipboard() {
|
var checkClipboard = function checkClipboard() {
|
||||||
clipboardService.getLocalClipboard().then(function clipboardRead(data) {
|
clipboardService.getLocalClipboard().then(function clipboardRead(data) {
|
||||||
$scope.$broadcast('guacClipboard', data);
|
$scope.$broadcast('guacClipboard', data);
|
||||||
});
|
}, angular.noop);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attempt to read the clipboard if it may have changed
|
// Attempt to read the clipboard if it may have changed
|
||||||
|
@@ -25,9 +25,6 @@ angular.module('index').filter('toArray', [function toArrayFactory() {
|
|||||||
|
|
||||||
return function toArrayFiter(input) {
|
return function toArrayFiter(input) {
|
||||||
|
|
||||||
|
|
||||||
console.log(input)
|
|
||||||
|
|
||||||
// If no object is available, just return an empty array
|
// If no object is available, just return an empty array
|
||||||
if (!input) {
|
if (!input) {
|
||||||
return [];
|
return [];
|
||||||
|
@@ -77,7 +77,7 @@ angular.module('list').directive('guacUserItem', [function guacUserItem() {
|
|||||||
$translate('LIST.TEXT_ANONYMOUS_USER')
|
$translate('LIST.TEXT_ANONYMOUS_USER')
|
||||||
.then(function retrieveAnonymousDisplayName(anonymousDisplayName) {
|
.then(function retrieveAnonymousDisplayName(anonymousDisplayName) {
|
||||||
$scope.displayName = anonymousDisplayName;
|
$scope.displayName = anonymousDisplayName;
|
||||||
});
|
}, angular.noop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For all other users, use the username verbatim
|
// For all other users, use the username verbatim
|
||||||
|
@@ -68,6 +68,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
// Required services
|
// Required services
|
||||||
var $route = $injector.get('$route');
|
var $route = $injector.get('$route');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A description of the error that occurred during login, if any.
|
* A description of the error that occurred during login, if any.
|
||||||
@@ -153,7 +154,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Reset upon failure
|
// Reset upon failure
|
||||||
['catch'](function loginFailed(error) {
|
['catch'](requestService.createErrorCallback(function loginFailed(error) {
|
||||||
|
|
||||||
// Clear out passwords if the credentials were rejected for any reason
|
// Clear out passwords if the credentials were rejected for any reason
|
||||||
if (error.type !== Error.Type.INSUFFICIENT_CREDENTIALS) {
|
if (error.type !== Error.Type.INSUFFICIENT_CREDENTIALS) {
|
||||||
@@ -178,7 +179,7 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -38,21 +38,10 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
var connectionService = $injector.get('connectionService');
|
var connectionService = $injector.get('connectionService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var schemaService = $injector.get('schemaService');
|
var schemaService = $injector.get('schemaService');
|
||||||
var translationStringService = $injector.get('translationStringService');
|
var translationStringService = $injector.get('translationStringService');
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to showStatus which
|
|
||||||
* closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "MANAGE_CONNECTION.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the data source containing the connection being
|
* The unique identifier of the data source containing the connection being
|
||||||
* edited.
|
* edited.
|
||||||
@@ -186,7 +175,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
schemaService.getConnectionAttributes($scope.selectedDataSource)
|
schemaService.getConnectionAttributes($scope.selectedDataSource)
|
||||||
.then(function attributesReceived(attributes) {
|
.then(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull connection group hierarchy
|
// Pull connection group hierarchy
|
||||||
connectionGroupService.getConnectionGroupTree(
|
connectionGroupService.getConnectionGroupTree(
|
||||||
@@ -196,7 +185,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
)
|
)
|
||||||
.then(function connectionGroupReceived(rootGroup) {
|
.then(function connectionGroupReceived(rootGroup) {
|
||||||
$scope.rootGroup = rootGroup;
|
$scope.rootGroup = rootGroup;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Query the user's permissions for the current connection
|
// Query the user's permissions for the current connection
|
||||||
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
||||||
@@ -226,18 +215,18 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Get protocol metadata
|
// Get protocol metadata
|
||||||
schemaService.getProtocols($scope.selectedDataSource)
|
schemaService.getProtocols($scope.selectedDataSource)
|
||||||
.then(function protocolsReceived(protocols) {
|
.then(function protocolsReceived(protocols) {
|
||||||
$scope.protocols = protocols;
|
$scope.protocols = protocols;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Get history date format
|
// Get history date format
|
||||||
$translate('MANAGE_CONNECTION.FORMAT_HISTORY_START').then(function historyDateFormatReceived(historyDateFormat) {
|
$translate('MANAGE_CONNECTION.FORMAT_HISTORY_START').then(function historyDateFormatReceived(historyDateFormat) {
|
||||||
$scope.historyDateFormat = historyDateFormat;
|
$scope.historyDateFormat = historyDateFormat;
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
// If we are editing an existing connection, pull its data
|
// If we are editing an existing connection, pull its data
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
@@ -246,7 +235,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
connectionService.getConnection($scope.selectedDataSource, identifier)
|
connectionService.getConnection($scope.selectedDataSource, identifier)
|
||||||
.then(function connectionRetrieved(connection) {
|
.then(function connectionRetrieved(connection) {
|
||||||
$scope.connection = connection;
|
$scope.connection = connection;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull connection history
|
// Pull connection history
|
||||||
connectionService.getConnectionHistory($scope.selectedDataSource, identifier)
|
connectionService.getConnectionHistory($scope.selectedDataSource, identifier)
|
||||||
@@ -258,13 +247,13 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
$scope.historyEntryWrappers.push(new HistoryEntryWrapper(historyEntry));
|
$scope.historyEntryWrappers.push(new HistoryEntryWrapper(historyEntry));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull connection parameters
|
// Pull connection parameters
|
||||||
connectionService.getConnectionParameters($scope.selectedDataSource, identifier)
|
connectionService.getConnectionParameters($scope.selectedDataSource, identifier)
|
||||||
.then(function parametersReceived(parameters) {
|
.then(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are cloning an existing connection, pull its data instead
|
// If we are cloning an existing connection, pull its data instead
|
||||||
@@ -277,7 +266,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
|
|
||||||
// Clear the identifier field because this connection is new
|
// Clear the identifier field because this connection is new
|
||||||
delete $scope.connection.identifier;
|
delete $scope.connection.identifier;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Do not pull connection history
|
// Do not pull connection history
|
||||||
$scope.historyEntryWrappers = [];
|
$scope.historyEntryWrappers = [];
|
||||||
@@ -286,7 +275,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
connectionService.getConnectionParameters($scope.selectedDataSource, cloneSourceIdentifier)
|
connectionService.getConnectionParameters($scope.selectedDataSource, cloneSourceIdentifier)
|
||||||
.then(function parametersReceived(parameters) {
|
.then(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are creating a new connection, populate skeleton connection data
|
// If we are creating a new connection, populate skeleton connection data
|
||||||
@@ -390,17 +379,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
connectionService.saveConnection($scope.selectedDataSource, $scope.connection)
|
connectionService.saveConnection($scope.selectedDataSource, $scope.connection)
|
||||||
.then(function savedConnection() {
|
.then(function savedConnection() {
|
||||||
$location.url('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.url('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
.error(function connectionSaveFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -440,17 +419,7 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
|
|||||||
connectionService.deleteConnection($scope.selectedDataSource, $scope.connection)
|
connectionService.deleteConnection($scope.selectedDataSource, $scope.connection)
|
||||||
.then(function deletedConnection() {
|
.then(function deletedConnection() {
|
||||||
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
.error(function connectionDeletionFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -34,20 +34,9 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var schemaService = $injector.get('schemaService');
|
var schemaService = $injector.get('schemaService');
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to showStatus which
|
|
||||||
* closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "MANAGE_CONNECTION_GROUP.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the data source containing the connection group
|
* The unique identifier of the data source containing the connection group
|
||||||
* being edited.
|
* being edited.
|
||||||
@@ -131,7 +120,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
schemaService.getConnectionGroupAttributes($scope.selectedDataSource)
|
schemaService.getConnectionGroupAttributes($scope.selectedDataSource)
|
||||||
.then(function attributesReceived(attributes) {
|
.then(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Query the user's permissions for the current connection group
|
// Query the user's permissions for the current connection group
|
||||||
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
||||||
@@ -152,7 +141,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
|| PermissionSet.hasConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.DELETE, identifier)
|
|| PermissionSet.hasConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.DELETE, identifier)
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
|
|
||||||
// Pull connection group hierarchy
|
// Pull connection group hierarchy
|
||||||
@@ -163,14 +152,14 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
)
|
)
|
||||||
.then(function connectionGroupReceived(rootGroup) {
|
.then(function connectionGroupReceived(rootGroup) {
|
||||||
$scope.rootGroup = rootGroup;
|
$scope.rootGroup = rootGroup;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// If we are editing an existing connection group, pull its data
|
// If we are editing an existing connection group, pull its data
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
connectionGroupService.getConnectionGroup($scope.selectedDataSource, identifier)
|
connectionGroupService.getConnectionGroup($scope.selectedDataSource, identifier)
|
||||||
.then(function connectionGroupReceived(connectionGroup) {
|
.then(function connectionGroupReceived(connectionGroup) {
|
||||||
$scope.connectionGroup = connectionGroup;
|
$scope.connectionGroup = connectionGroup;
|
||||||
});
|
}, requestService.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are creating a new connection group, populate skeleton connection group data
|
// If we are creating a new connection group, populate skeleton connection group data
|
||||||
@@ -232,17 +221,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
connectionGroupService.saveConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
connectionGroupService.saveConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
||||||
.then(function savedConnectionGroup() {
|
.then(function savedConnectionGroup() {
|
||||||
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function connectionGroupSaveFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -282,17 +261,7 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
|
|||||||
connectionGroupService.deleteConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
connectionGroupService.deleteConnectionGroup($scope.selectedDataSource, $scope.connectionGroup)
|
||||||
.then(function deletedConnectionGroup() {
|
.then(function deletedConnectionGroup() {
|
||||||
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function connectionGroupDeletionFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_CONNECTION_GROUP.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -34,22 +34,11 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
var connectionService = $injector.get('connectionService');
|
var connectionService = $injector.get('connectionService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var schemaService = $injector.get('schemaService');
|
var schemaService = $injector.get('schemaService');
|
||||||
var sharingProfileService = $injector.get('sharingProfileService');
|
var sharingProfileService = $injector.get('sharingProfileService');
|
||||||
var translationStringService = $injector.get('translationStringService');
|
var translationStringService = $injector.get('translationStringService');
|
||||||
|
|
||||||
/**
|
|
||||||
* An action which can be provided along with the object sent to showStatus
|
|
||||||
* to allow the user to acknowledge (and close) the currently-shown status
|
|
||||||
* dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "MANAGE_SHARING_PROFILE.ACTION_ACKNOWLEDGE",
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An action to be provided along with the object sent to showStatus which
|
* An action to be provided along with the object sent to showStatus which
|
||||||
* closes the currently-shown status dialog, effectively canceling the
|
* closes the currently-shown status dialog, effectively canceling the
|
||||||
@@ -172,7 +161,7 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
schemaService.getSharingProfileAttributes($scope.selectedDataSource)
|
schemaService.getSharingProfileAttributes($scope.selectedDataSource)
|
||||||
.then(function attributesReceived(attributes) {
|
.then(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Query the user's permissions for the current sharing profile
|
// Query the user's permissions for the current sharing profile
|
||||||
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
permissionService.getEffectivePermissions($scope.selectedDataSource, authenticationService.getCurrentUsername())
|
||||||
@@ -208,13 +197,13 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Get protocol metadata
|
// Get protocol metadata
|
||||||
schemaService.getProtocols($scope.selectedDataSource)
|
schemaService.getProtocols($scope.selectedDataSource)
|
||||||
.then(function protocolsReceived(protocols) {
|
.then(function protocolsReceived(protocols) {
|
||||||
$scope.protocols = protocols;
|
$scope.protocols = protocols;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// If we are editing an existing sharing profile, pull its data
|
// If we are editing an existing sharing profile, pull its data
|
||||||
if (identifier) {
|
if (identifier) {
|
||||||
@@ -223,13 +212,13 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
sharingProfileService.getSharingProfile($scope.selectedDataSource, identifier)
|
sharingProfileService.getSharingProfile($scope.selectedDataSource, identifier)
|
||||||
.then(function sharingProfileRetrieved(sharingProfile) {
|
.then(function sharingProfileRetrieved(sharingProfile) {
|
||||||
$scope.sharingProfile = sharingProfile;
|
$scope.sharingProfile = sharingProfile;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull sharing profile parameters
|
// Pull sharing profile parameters
|
||||||
sharingProfileService.getSharingProfileParameters($scope.selectedDataSource, identifier)
|
sharingProfileService.getSharingProfileParameters($scope.selectedDataSource, identifier)
|
||||||
.then(function parametersReceived(parameters) {
|
.then(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,13 +235,13 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
// Clear the identifier field because this sharing profile is new
|
// Clear the identifier field because this sharing profile is new
|
||||||
delete $scope.sharingProfile.identifier;
|
delete $scope.sharingProfile.identifier;
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull sharing profile parameters from cloned sharing profile
|
// Pull sharing profile parameters from cloned sharing profile
|
||||||
sharingProfileService.getSharingProfileParameters($scope.selectedDataSource, cloneSourceIdentifier)
|
sharingProfileService.getSharingProfileParameters($scope.selectedDataSource, cloneSourceIdentifier)
|
||||||
.then(function parametersReceived(parameters) {
|
.then(function parametersReceived(parameters) {
|
||||||
$scope.parameters = parameters;
|
$scope.parameters = parameters;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,11 +261,12 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
$scope.$watch('sharingProfile.primaryConnectionIdentifier',
|
$scope.$watch('sharingProfile.primaryConnectionIdentifier',
|
||||||
function retrievePrimaryConnection(identifier) {
|
function retrievePrimaryConnection(identifier) {
|
||||||
|
|
||||||
// Pull data from existing sharing profile
|
if (identifier) {
|
||||||
connectionService.getConnection($scope.selectedDataSource, identifier)
|
connectionService.getConnection($scope.selectedDataSource, identifier)
|
||||||
.then(function connectionRetrieved(connection) {
|
.then(function connectionRetrieved(connection) {
|
||||||
$scope.primaryConnection = connection;
|
$scope.primaryConnection = connection;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -353,17 +343,7 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
sharingProfileService.saveSharingProfile($scope.selectedDataSource, $scope.sharingProfile)
|
sharingProfileService.saveSharingProfile($scope.selectedDataSource, $scope.sharingProfile)
|
||||||
.then(function savedSharingProfile() {
|
.then(function savedSharingProfile() {
|
||||||
$location.url('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.url('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function sharingProfileSaveFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_SHARING_PROFILE.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -391,17 +371,7 @@ angular.module('manage').controller('manageSharingProfileController', ['$scope',
|
|||||||
sharingProfileService.deleteSharingProfile($scope.selectedDataSource, $scope.sharingProfile)
|
sharingProfileService.deleteSharingProfile($scope.selectedDataSource, $scope.sharingProfile)
|
||||||
.then(function deletedSharingProfile() {
|
.then(function deletedSharingProfile() {
|
||||||
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
$location.path('/settings/' + encodeURIComponent($scope.selectedDataSource) + '/connections');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function sharingProfileDeletionFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_SHARING_PROFILE.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var schemaService = $injector.get('schemaService');
|
var schemaService = $injector.get('schemaService');
|
||||||
var translationStringService = $injector.get('translationStringService');
|
var translationStringService = $injector.get('translationStringService');
|
||||||
var userService = $injector.get('userService');
|
var userService = $injector.get('userService');
|
||||||
@@ -531,7 +532,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
// Pull user attribute schema
|
// Pull user attribute schema
|
||||||
schemaService.getUserAttributes(selectedDataSource).then(function attributesReceived(attributes) {
|
schemaService.getUserAttributes(selectedDataSource).then(function attributesReceived(attributes) {
|
||||||
$scope.attributes = attributes;
|
$scope.attributes = attributes;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Pull user data and permissions if we are editing an existing user
|
// Pull user data and permissions if we are editing an existing user
|
||||||
if (username) {
|
if (username) {
|
||||||
@@ -550,7 +551,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
'username' : username
|
'username' : username
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// The current user will be associated with username of the existing
|
// The current user will be associated with username of the existing
|
||||||
// user in the retrieved permission set
|
// user in the retrieved permission set
|
||||||
@@ -562,9 +563,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
})
|
})
|
||||||
|
|
||||||
// If permissions cannot be retrieved, use empty permissions
|
// If permissions cannot be retrieved, use empty permissions
|
||||||
['catch'](function permissionRetrievalFailed() {
|
['catch'](requestService.createErrorCallback(function permissionRetrievalFailed() {
|
||||||
$scope.permissionFlags = new PermissionFlagSet();
|
$scope.permissionFlags = new PermissionFlagSet();
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are cloning an existing user, pull his/her data instead
|
// If we are cloning an existing user, pull his/her data instead
|
||||||
@@ -577,7 +578,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
$scope.users = {};
|
$scope.users = {};
|
||||||
$scope.user = users[selectedDataSource];
|
$scope.user = users[selectedDataSource];
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// The current user will be associated with cloneSourceUsername in the
|
// The current user will be associated with cloneSourceUsername in the
|
||||||
// retrieved permission set
|
// retrieved permission set
|
||||||
@@ -591,9 +592,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
})
|
})
|
||||||
|
|
||||||
// If permissions cannot be retrieved, use empty permissions
|
// If permissions cannot be retrieved, use empty permissions
|
||||||
['catch'](function permissionRetrievalFailed() {
|
['catch'](requestService.createErrorCallback(function permissionRetrievalFailed() {
|
||||||
$scope.permissionFlags = new PermissionFlagSet();
|
$scope.permissionFlags = new PermissionFlagSet();
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use skeleton data if we are creating a new user
|
// Use skeleton data if we are creating a new user
|
||||||
@@ -676,7 +677,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
$scope.rootGroups[dataSource] = GroupListItem.fromConnectionGroup(dataSource, rootGroup);
|
$scope.rootGroups[dataSource] = GroupListItem.fromConnectionGroup(dataSource, rootGroup);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Query the user's permissions for the current user
|
// Query the user's permissions for the current user
|
||||||
dataSourceService.apply(
|
dataSourceService.apply(
|
||||||
@@ -686,7 +687,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
)
|
)
|
||||||
.then(function permissionsReceived(permissions) {
|
.then(function permissionsReceived(permissions) {
|
||||||
$scope.permissions = permissions;
|
$scope.permissions = permissions;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Update default expanded state whenever connection groups and associated
|
// Update default expanded state whenever connection groups and associated
|
||||||
// permissions change
|
// permissions change
|
||||||
@@ -1140,30 +1141,9 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
permissionService.patchPermissions(selectedDataSource, $scope.user.username, permissionsAdded, permissionsRemoved)
|
permissionService.patchPermissions(selectedDataSource, $scope.user.username, permissionsAdded, permissionsRemoved)
|
||||||
.then(function patchedUserPermissions() {
|
.then(function patchedUserPermissions() {
|
||||||
$location.url('/settings/users');
|
$location.url('/settings/users');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
['catch'](function userPermissionsPatchFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'values' : error.translationValues,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
.error(function userSaveFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1203,17 +1183,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
userService.deleteUser(selectedDataSource, $scope.user)
|
userService.deleteUser(selectedDataSource, $scope.user)
|
||||||
.then(function deletedUser() {
|
.then(function deletedUser() {
|
||||||
$location.path('/settings/users');
|
$location.path('/settings/users');
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function userDeletionFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_USER.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
|
|||||||
var $location = $injector.get('$location');
|
var $location = $injector.get('$location');
|
||||||
var $route = $injector.get('$route');
|
var $route = $injector.get('$route');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var userService = $injector.get('userService');
|
var userService = $injector.get('userService');
|
||||||
var userPageService = $injector.get('userPageService');
|
var userPageService = $injector.get('userPageService');
|
||||||
|
|
||||||
@@ -110,7 +111,7 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
|
|||||||
var email = user.attributes[User.Attributes.EMAIL_ADDRESS];
|
var email = user.attributes[User.Attributes.EMAIL_ADDRESS];
|
||||||
$scope.userURL = email ? 'mailto:' + email : null;
|
$scope.userURL = email ? 'mailto:' + email : null;
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The available main pages for the current user.
|
* The available main pages for the current user.
|
||||||
@@ -141,7 +142,9 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
|
|||||||
* after logout completes.
|
* after logout completes.
|
||||||
*/
|
*/
|
||||||
$scope.logout = function logout() {
|
$scope.logout = function logout() {
|
||||||
authenticationService.logout()['finally'](function logoutComplete() {
|
authenticationService.logout()
|
||||||
|
['catch'](requestService.IGNORE)
|
||||||
|
['finally'](function logoutComplete() {
|
||||||
if ($location.path() !== '/')
|
if ($location.path() !== '/')
|
||||||
$location.url('/');
|
$location.url('/');
|
||||||
else
|
else
|
||||||
|
@@ -35,6 +35,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var translationStringService = $injector.get('translationStringService');
|
var translationStringService = $injector.get('translationStringService');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
@@ -142,7 +143,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a promise which resolves with an appropriate home page for the
|
* Returns a promise which resolves with an appropriate home page for the
|
||||||
* current user.
|
* current user. The promise will not be rejected.
|
||||||
*
|
*
|
||||||
* @returns {Promise.<Page>}
|
* @returns {Promise.<Page>}
|
||||||
* A promise which resolves with the user's default home page.
|
* A promise which resolves with the user's default home page.
|
||||||
@@ -169,7 +170,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
})
|
})
|
||||||
.then(function rootConnectionGroupsPermissionsRetrieved(data) {
|
.then(function rootConnectionGroupsPermissionsRetrieved(data) {
|
||||||
deferred.resolve(generateHomePage(data.rootGroups,data.permissionsSets));
|
deferred.resolve(generateHomePage(data.rootGroups,data.permissionsSets));
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
@@ -317,7 +318,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
/**
|
/**
|
||||||
* Returns a promise which resolves to an array of all settings pages that
|
* Returns a promise which resolves to an array of all settings pages that
|
||||||
* the current user can visit. This can include any of the various manage
|
* the current user can visit. This can include any of the various manage
|
||||||
* pages.
|
* pages. The promise will not be rejected.
|
||||||
*
|
*
|
||||||
* @returns {Promise.<Page[]>}
|
* @returns {Promise.<Page[]>}
|
||||||
* A promise which resolves to an array of all settings pages that the
|
* A promise which resolves to an array of all settings pages that the
|
||||||
@@ -337,7 +338,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
// Resolve promise using settings pages derived from permissions
|
// Resolve promise using settings pages derived from permissions
|
||||||
.then(function permissionsRetrieved(permissions) {
|
.then(function permissionsRetrieved(permissions) {
|
||||||
deferred.resolve(generateSettingsPages(permissions));
|
deferred.resolve(generateSettingsPages(permissions));
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
@@ -387,7 +388,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
* Returns a promise which resolves to an array of all main pages that the
|
* Returns a promise which resolves to an array of all main pages that the
|
||||||
* current user can visit. This can include the home page, manage pages,
|
* current user can visit. This can include the home page, manage pages,
|
||||||
* etc. In the case that there are no applicable pages of this sort, it may
|
* etc. In the case that there are no applicable pages of this sort, it may
|
||||||
* return a client page.
|
* return a client page. The promise will not be rejected.
|
||||||
*
|
*
|
||||||
* @returns {Promise.<Page[]>}
|
* @returns {Promise.<Page[]>}
|
||||||
* A promise which resolves to an array of all main pages that the
|
* A promise which resolves to an array of all main pages that the
|
||||||
@@ -418,7 +419,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
.then(function rootConnectionGroupsRetrieved(retrievedRootGroups) {
|
.then(function rootConnectionGroupsRetrieved(retrievedRootGroups) {
|
||||||
rootGroups = retrievedRootGroups;
|
rootGroups = retrievedRootGroups;
|
||||||
resolveMainPages();
|
resolveMainPages();
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Retrieve current permissions
|
// Retrieve current permissions
|
||||||
dataSourceService.apply(
|
dataSourceService.apply(
|
||||||
@@ -431,7 +432,7 @@ angular.module('navigation').factory('userPageService', ['$injector',
|
|||||||
.then(function permissionsRetrieved(retrievedPermissions) {
|
.then(function permissionsRetrieved(retrievedPermissions) {
|
||||||
permissions = retrievedPermissions;
|
permissions = retrievedPermissions;
|
||||||
resolveMainPages();
|
resolveMainPages();
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
|
@@ -21,5 +21,6 @@
|
|||||||
* The module for code used to display arbitrary notifications.
|
* The module for code used to display arbitrary notifications.
|
||||||
*/
|
*/
|
||||||
angular.module('notification', [
|
angular.module('notification', [
|
||||||
|
'rest',
|
||||||
'storage'
|
'storage'
|
||||||
]);
|
]);
|
||||||
|
@@ -25,6 +25,7 @@ angular.module('notification').factory('guacNotification', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $rootScope = $injector.get('$rootScope');
|
var $rootScope = $injector.get('$rootScope');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var sessionStorageFactory = $injector.get('sessionStorageFactory');
|
var sessionStorageFactory = $injector.get('sessionStorageFactory');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
@@ -37,6 +38,19 @@ angular.module('notification').factory('guacNotification', ['$injector',
|
|||||||
*/
|
*/
|
||||||
var storedStatus = sessionStorageFactory.create(false);
|
var storedStatus = sessionStorageFactory.create(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An action to be provided along with the object sent to showStatus which
|
||||||
|
* closes the currently-shown status dialog.
|
||||||
|
*
|
||||||
|
* @type NotificationAction
|
||||||
|
*/
|
||||||
|
service.ACKNOWLEDGE_ACTION = {
|
||||||
|
name : 'APP.ACTION_ACKNOWLEDGE',
|
||||||
|
callback : function acknowledgeCallback() {
|
||||||
|
service.showStatus(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the current status notification, which may simply be false if
|
* Retrieves the current status notification, which may simply be false if
|
||||||
* no status is currently shown.
|
* no status is currently shown.
|
||||||
@@ -79,6 +93,26 @@ angular.module('notification').factory('guacNotification', ['$injector',
|
|||||||
storedStatus(status);
|
storedStatus(status);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Promise error callback which displays a modal notification for all
|
||||||
|
* rejections due to REST errors. The message displayed to the user within
|
||||||
|
* the notification is provided by the contents of the @link{Error} object
|
||||||
|
* within the REST response. All other rejections, such as those due to
|
||||||
|
* JavaScript errors, are logged to the browser console without displaying
|
||||||
|
* any notification.
|
||||||
|
*
|
||||||
|
* @constant
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
service.SHOW_REQUEST_ERROR = requestService.createErrorCallback(function showRequestError(error) {
|
||||||
|
service.showStatus({
|
||||||
|
className : 'error',
|
||||||
|
title : 'APP.DIALOG_HEADER_ERROR',
|
||||||
|
text : error.translatableMessage,
|
||||||
|
actions : [ service.ACKNOWLEDGE_ACTION ]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Hide status upon navigation
|
// Hide status upon navigation
|
||||||
$rootScope.$on('$routeChangeSuccess', function() {
|
$rootScope.$on('$routeChangeSuccess', function() {
|
||||||
service.showStatus(false);
|
service.showStatus(false);
|
||||||
|
@@ -113,7 +113,7 @@ angular.module('osk').directive('guacOsk', [function guacOsk() {
|
|||||||
$rootScope.$broadcast('guacSyntheticKeyup', keysym);
|
$rootScope.$broadcast('guacSyntheticKeyup', keysym);
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,4 +21,6 @@
|
|||||||
* The module for code relating to communication with the REST API of the
|
* The module for code relating to communication with the REST API of the
|
||||||
* Guacamole web application.
|
* Guacamole web application.
|
||||||
*/
|
*/
|
||||||
angular.module('rest', ['auth']);
|
angular.module('rest', [
|
||||||
|
'auth'
|
||||||
|
]);
|
||||||
|
@@ -25,7 +25,6 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var requestService = $injector.get('requestService');
|
var requestService = $injector.get('requestService');
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
@@ -66,68 +65,6 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a promise which resolves with all active connections accessible
|
|
||||||
* by the current user, as a map of @link{ActiveConnection} maps, as would
|
|
||||||
* be returned by getActiveConnections(), grouped by the identifier of
|
|
||||||
* their corresponding data source. All given data sources are queried. If
|
|
||||||
* an error occurs while retrieving any ActiveConnection map, the promise
|
|
||||||
* will be rejected.
|
|
||||||
*
|
|
||||||
* @param {String[]} dataSources
|
|
||||||
* The unique identifier of the data sources containing the active
|
|
||||||
* connections to be retrieved. These identifiers correspond to
|
|
||||||
* AuthenticationProviders within the Guacamole web application.
|
|
||||||
*
|
|
||||||
* @param {String[]} [permissionTypes]
|
|
||||||
* The set of permissions to filter with. A user must have one or more
|
|
||||||
* of these permissions for an active connection to appear in the
|
|
||||||
* result. If null, no filtering will be performed. Valid values are
|
|
||||||
* listed within PermissionSet.ObjectType.
|
|
||||||
*
|
|
||||||
* @returns {Promise.<Object.<String, Object.<String, ActiveConnection>>>}
|
|
||||||
* A promise which resolves with all active connections available to
|
|
||||||
* the current user, as a map of ActiveConnection maps, as would be
|
|
||||||
* returned by getActiveConnections(), grouped by the identifier of
|
|
||||||
* their corresponding data source.
|
|
||||||
*/
|
|
||||||
service.getAllActiveConnections = function getAllActiveConnections(dataSources, permissionTypes) {
|
|
||||||
|
|
||||||
var deferred = $q.defer();
|
|
||||||
|
|
||||||
var activeConnectionRequests = [];
|
|
||||||
var activeConnectionMaps = {};
|
|
||||||
|
|
||||||
// Retrieve all active connections from all data sources
|
|
||||||
angular.forEach(dataSources, function retrieveActiveConnections(dataSource) {
|
|
||||||
activeConnectionRequests.push(
|
|
||||||
service.getActiveConnections(dataSource, permissionTypes)
|
|
||||||
.then(function activeConnectionsRetrieved(activeConnections) {
|
|
||||||
activeConnectionMaps[dataSource] = activeConnections;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Resolve when all requests are completed
|
|
||||||
$q.all(activeConnectionRequests)
|
|
||||||
.then(
|
|
||||||
|
|
||||||
// All requests completed successfully
|
|
||||||
function allActiveConnectionsRetrieved() {
|
|
||||||
deferred.resolve(userArrays);
|
|
||||||
},
|
|
||||||
|
|
||||||
// At least one request failed
|
|
||||||
function activeConnectionRetrievalFailed(e) {
|
|
||||||
deferred.reject(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a request to the REST API to delete the active connections having
|
* Makes a request to the REST API to delete the active connections having
|
||||||
* the given identifiers, effectively disconnecting them, returning a
|
* the given identifiers, effectively disconnecting them, returning a
|
||||||
|
@@ -25,7 +25,6 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var requestService = $injector.get('requestService');
|
var requestService = $injector.get('requestService');
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var cacheService = $injector.get('cacheService');
|
var cacheService = $injector.get('cacheService');
|
||||||
|
|
||||||
|
@@ -27,7 +27,8 @@ angular.module('rest').factory('dataSourceService', ['$injector',
|
|||||||
var Error = $injector.get('Error');
|
var Error = $injector.get('Error');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $q = $injector.get('$q');
|
var $q = $injector.get('$q');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
// Service containing all caches
|
// Service containing all caches
|
||||||
var service = {};
|
var service = {};
|
||||||
@@ -92,7 +93,7 @@ angular.module('rest').factory('dataSourceService', ['$injector',
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Fail on any errors (except "NOT FOUND")
|
// Fail on any errors (except "NOT FOUND")
|
||||||
function immediateRequestFailed(error) {
|
requestService.createErrorCallback(function immediateRequestFailed(error) {
|
||||||
|
|
||||||
if (error.type === Error.Type.NOT_FOUND)
|
if (error.type === Error.Type.NOT_FOUND)
|
||||||
deferredRequest.resolve();
|
deferredRequest.resolve();
|
||||||
@@ -101,7 +102,7 @@ angular.module('rest').factory('dataSourceService', ['$injector',
|
|||||||
else
|
else
|
||||||
deferredRequest.reject(error);
|
deferredRequest.reject(error);
|
||||||
|
|
||||||
});
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,9 +112,9 @@ angular.module('rest').factory('dataSourceService', ['$injector',
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Reject if at least one request fails
|
// Reject if at least one request fails
|
||||||
function requestFailed(response) {
|
requestService.createErrorCallback(function requestFailed(error) {
|
||||||
deferred.reject(response);
|
deferred.reject(error);
|
||||||
});
|
}));
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|
||||||
|
@@ -25,7 +25,6 @@ angular.module('rest').factory('permissionService', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var requestService = $injector.get('requestService');
|
var requestService = $injector.get('requestService');
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var cacheService = $injector.get('cacheService');
|
var cacheService = $injector.get('cacheService');
|
||||||
|
|
||||||
|
@@ -21,27 +21,100 @@
|
|||||||
* Service for converting $http promises that pass the entire response into
|
* Service for converting $http promises that pass the entire response into
|
||||||
* promises that pass only the data from that response.
|
* promises that pass only the data from that response.
|
||||||
*/
|
*/
|
||||||
angular.module('rest').factory('requestService', ['$q', '$http', 'Error',
|
angular.module('rest').factory('requestService', ['$injector',
|
||||||
function requestService($q, $http, Error) {
|
function requestService($injector) {
|
||||||
|
|
||||||
|
// Required services
|
||||||
|
var $http = $injector.get('$http');
|
||||||
|
var $log = $injector.get('$log');
|
||||||
|
|
||||||
|
// Required types
|
||||||
|
var Error = $injector.get('Error');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a configuration object formatted for the $http service, returns
|
* Given a configuration object formatted for the $http service, returns
|
||||||
* a promise that will resolve or reject with only the data from the $http
|
* a promise that will resolve or reject with the data from the HTTP
|
||||||
* response.
|
* response. If the promise is rejected due to the HTTP response indicating
|
||||||
|
* failure, the promise will be rejected strictly with an instance of an
|
||||||
|
* @link{Error} object.
|
||||||
*
|
*
|
||||||
* @param {Object} object
|
* @param {Object} object
|
||||||
* Configuration object for $http service call.
|
* Configuration object for $http service call.
|
||||||
*
|
*
|
||||||
* @returns {Promise}
|
* @returns {Promise.<Object>}
|
||||||
* A promise that will resolve or reject with the data from the response
|
* A promise that will resolve with the data from the HTTP response for
|
||||||
* to the $http call.
|
* the underlying $http call if successful, or reject with an @link{Error}
|
||||||
|
* describing the failure.
|
||||||
*/
|
*/
|
||||||
var wrappedHttpCall = function wrappedHttpCall(object) {
|
var service = function wrapHttpServiceCall(object) {
|
||||||
return $http(object).then(
|
return $http(object).then(
|
||||||
function success(request) { return request.data; },
|
function success(response) { return response.data; },
|
||||||
function failure(request) { throw new Error(request.data); }
|
function failure(response) {
|
||||||
);
|
|
||||||
}
|
// Wrap true error responses from $http within REST Error objects
|
||||||
|
if (response.data)
|
||||||
|
throw new Error(response.data);
|
||||||
|
|
||||||
|
// The value provided is not actually a response object from
|
||||||
|
// the $http service
|
||||||
|
throw response;
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a promise error callback which invokes the given callback only
|
||||||
|
* if the promise was rejected with a REST @link{Error} object. If the
|
||||||
|
* promise is rejected without an @link{Error} object, such as when a
|
||||||
|
* JavaScript error occurs within a callback earlier in the promise chain,
|
||||||
|
* the rejection is logged without invoking the given callback.
|
||||||
|
*
|
||||||
|
* @param {Function} callback
|
||||||
|
* The callback to invoke if the promise is rejected with an
|
||||||
|
* @link{Error} object.
|
||||||
|
*
|
||||||
|
* @returns {Function}
|
||||||
|
* A function which can be provided as the error callback for a
|
||||||
|
* promise.
|
||||||
|
*/
|
||||||
|
service.createErrorCallback = function createErrorCallback(callback) {
|
||||||
|
return (function generatedErrorCallback(error) {
|
||||||
|
|
||||||
|
// Invoke given callback ONLY if due to a legitimate REST error
|
||||||
|
if (error instanceof Error)
|
||||||
|
return callback(error);
|
||||||
|
|
||||||
|
// Log all other errors
|
||||||
|
$log.error(error);
|
||||||
|
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Promise error callback which ignores all rejections due to REST errors,
|
||||||
|
* but logs all other rejections, such as those due to JavaScript errors.
|
||||||
|
* This callback should be used in favor of angular.noop in cases where
|
||||||
|
* a REST response is being handled but REST errors should be ignored.
|
||||||
|
*
|
||||||
|
* @constant
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
service.IGNORE = service.createErrorCallback(angular.noop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Promise error callback which logs all rejections due to REST errors as
|
||||||
|
* warnings to the browser console, and logs all other rejections as
|
||||||
|
* errors. This callback should be used in favor of angular.noop or
|
||||||
|
* @link{IGNORE} if REST errors are simply not expected.
|
||||||
|
*
|
||||||
|
* @constant
|
||||||
|
* @type Function
|
||||||
|
*/
|
||||||
|
service.WARN = service.createErrorCallback(function warnRequestFailed(error) {
|
||||||
|
$log.warn(error.type, error.message || error.translatableMessage);
|
||||||
|
});
|
||||||
|
|
||||||
|
return service;
|
||||||
|
|
||||||
return wrappedHttpCall;
|
|
||||||
}]);
|
}]);
|
||||||
|
@@ -25,7 +25,6 @@ angular.module('rest').factory('userService', ['$injector',
|
|||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var requestService = $injector.get('requestService');
|
var requestService = $injector.get('requestService');
|
||||||
var $q = $injector.get('$q');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var cacheService = $injector.get('cacheService');
|
var cacheService = $injector.get('cacheService');
|
||||||
|
|
||||||
@@ -265,7 +264,7 @@ angular.module('rest').factory('userService', ['$injector',
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Clear the cache
|
// Clear the cache
|
||||||
.success(function passwordChanged(){
|
.then(function passwordChanged(){
|
||||||
cacheService.users.removeAll();
|
cacheService.users.removeAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -44,6 +44,7 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
var $translate = $injector.get('$translate');
|
var $translate = $injector.get('$translate');
|
||||||
var csvService = $injector.get('csvService');
|
var csvService = $injector.get('csvService');
|
||||||
var historyService = $injector.get('historyService');
|
var historyService = $injector.get('historyService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the currently-selected data source.
|
* The identifier of the currently-selected data source.
|
||||||
@@ -95,7 +96,7 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
// Store received date format
|
// Store received date format
|
||||||
$scope.dateFormat = retrievedDateFormat;
|
$scope.dateFormat = retrievedDateFormat;
|
||||||
|
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the connection history records have been loaded,
|
* Returns true if the connection history records have been loaded,
|
||||||
@@ -177,7 +178,7 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
$scope.historyEntryWrappers.push(new ConnectionHistoryEntryWrapper(historyEntry));
|
$scope.historyEntryWrappers.push(new ConnectionHistoryEntryWrapper(historyEntry));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -227,7 +228,7 @@ angular.module('settings').directive('guacSettingsConnectionHistory', [function
|
|||||||
// Save the result
|
// Save the result
|
||||||
saveAs(csvService.toBlob(records), translations['SETTINGS_CONNECTION_HISTORY.FILENAME_HISTORY_CSV']);
|
saveAs(csvService.toBlob(records), translations['SETTINGS_CONNECTION_HISTORY.FILENAME_HISTORY_CSV']);
|
||||||
|
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
|||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the current user.
|
* The identifier of the current user.
|
||||||
@@ -54,18 +55,6 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
|||||||
*/
|
*/
|
||||||
var currentUsername = authenticationService.getCurrentUsername();
|
var currentUsername = authenticationService.getCurrentUsername();
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to
|
|
||||||
* showStatus which closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "SETTINGS_CONNECTIONS.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the currently-selected data source.
|
* The identifier of the currently-selected data source.
|
||||||
*
|
*
|
||||||
@@ -426,9 +415,9 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
|||||||
)
|
)
|
||||||
.then(function connectionGroupsReceived(rootGroups) {
|
.then(function connectionGroupsReceived(rootGroups) {
|
||||||
$scope.rootGroups = rootGroups;
|
$scope.rootGroups = rootGroups;
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}); // end retrieve permissions
|
}, requestService.WARN); // end retrieve permissions
|
||||||
|
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
@@ -42,6 +42,7 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe
|
|||||||
var languageService = $injector.get('languageService');
|
var languageService = $injector.get('languageService');
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
var preferenceService = $injector.get('preferenceService');
|
var preferenceService = $injector.get('preferenceService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var userService = $injector.get('userService');
|
var userService = $injector.get('userService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,17 +165,7 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe
|
|||||||
},
|
},
|
||||||
actions : [ ACKNOWLEDGE_ACTION ]
|
actions : [ ACKNOWLEDGE_ACTION ]
|
||||||
});
|
});
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
['catch'](function passwordUpdateFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
className : 'error',
|
|
||||||
title : 'SETTINGS_PREFERENCES.DIALOG_HEADER_ERROR',
|
|
||||||
text : error.translatableMessage,
|
|
||||||
actions : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -186,8 +177,8 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe
|
|||||||
key: key,
|
key: key,
|
||||||
value: languages[key]
|
value: languages[key]
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Retrieve current permissions
|
// Retrieve current permissions
|
||||||
permissionService.getEffectivePermissions(dataSource, username)
|
permissionService.getEffectivePermissions(dataSource, username)
|
||||||
@@ -198,9 +189,9 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe
|
|||||||
PermissionSet.ObjectPermissionType.UPDATE, username);
|
PermissionSet.ObjectPermissionType.UPDATE, username);
|
||||||
|
|
||||||
})
|
})
|
||||||
['catch'](function permissionsFailed(error) {
|
['catch'](requestService.createErrorCallback(function permissionsFailed(error) {
|
||||||
$scope.canChangePassword = false;
|
$scope.canChangePassword = false;
|
||||||
});
|
}));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether critical data has completed being loaded.
|
* Returns whether critical data has completed being loaded.
|
||||||
|
@@ -47,6 +47,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
var connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifiers of all data sources accessible by the current
|
* The identifiers of all data sources accessible by the current
|
||||||
@@ -219,7 +220,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
// Attempt to produce wrapped list of active connections
|
// Attempt to produce wrapped list of active connections
|
||||||
wrapAllActiveConnections();
|
wrapAllActiveConnections();
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Query active sessions
|
// Query active sessions
|
||||||
dataSourceService.apply(
|
dataSourceService.apply(
|
||||||
@@ -234,7 +235,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
// Attempt to produce wrapped list of active connections
|
// Attempt to produce wrapped list of active connections
|
||||||
wrapAllActiveConnections();
|
wrapAllActiveConnections();
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
// Get session date format
|
// Get session date format
|
||||||
$translate('SETTINGS_SESSIONS.FORMAT_STARTDATE').then(function sessionDateFormatReceived(retrievedSessionDateFormat) {
|
$translate('SETTINGS_SESSIONS.FORMAT_STARTDATE').then(function sessionDateFormatReceived(retrievedSessionDateFormat) {
|
||||||
@@ -245,7 +246,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
// Attempt to produce wrapped list of active connections
|
// Attempt to produce wrapped list of active connections
|
||||||
wrapAllActiveConnections();
|
wrapAllActiveConnections();
|
||||||
|
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether critical data has completed being loaded.
|
* Returns whether critical data has completed being loaded.
|
||||||
@@ -258,18 +259,6 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
return $scope.wrappers !== null;
|
return $scope.wrappers !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to
|
|
||||||
* showStatus which closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "SETTINGS_SESSIONS.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An action to be provided along with the object sent to
|
* An action to be provided along with the object sent to
|
||||||
* showStatus which closes the currently-shown status dialog.
|
* showStatus which closes the currently-shown status dialog.
|
||||||
@@ -327,17 +316,7 @@ angular.module('settings').directive('guacSettingsSessions', [function guacSetti
|
|||||||
// Clear selection
|
// Clear selection
|
||||||
allSelectedWrappers = {};
|
allSelectedWrappers = {};
|
||||||
|
|
||||||
},
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
|
|
||||||
// Notify of any errors
|
|
||||||
function activeConnectionDeletionFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'SETTINGS_SESSIONS.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -43,25 +43,13 @@ angular.module('settings').directive('guacSettingsUsers', [function guacSettings
|
|||||||
var $translate = $injector.get('$translate');
|
var $translate = $injector.get('$translate');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
var dataSourceService = $injector.get('dataSourceService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
|
||||||
var permissionService = $injector.get('permissionService');
|
var permissionService = $injector.get('permissionService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
var userService = $injector.get('userService');
|
var userService = $injector.get('userService');
|
||||||
|
|
||||||
// Identifier of the current user
|
// Identifier of the current user
|
||||||
var currentUsername = authenticationService.getCurrentUsername();
|
var currentUsername = authenticationService.getCurrentUsername();
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to
|
|
||||||
* showStatus which closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "SETTINGS_USERS.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifiers of all data sources accessible by the current
|
* The identifiers of all data sources accessible by the current
|
||||||
* user.
|
* user.
|
||||||
@@ -129,7 +117,7 @@ angular.module('settings').directive('guacSettingsUsers', [function guacSettings
|
|||||||
// Store received date format
|
// Store received date format
|
||||||
$scope.dateFormat = retrievedDateFormat;
|
$scope.dateFormat = retrievedDateFormat;
|
||||||
|
|
||||||
});
|
}, angular.noop);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether critical data has completed being loaded.
|
* Returns whether critical data has completed being loaded.
|
||||||
@@ -287,9 +275,9 @@ angular.module('settings').directive('guacSettingsUsers', [function guacSettings
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
});
|
}, requestService.WARN);
|
||||||
|
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user