mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-956: Use "Guacamole-Token" header in favor of "token" query parameter when invoking REST API from client.
This commit is contained in:
@@ -409,5 +409,36 @@ angular.module('auth').factory('authenticationService', ['$injector',
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes an HTTP request leveraging the requestService(), automatically
|
||||
* including the user's authentication token using the "Guacamole-Token"
|
||||
* header. If the user is not logged in, the "Guacamole-Token" header is
|
||||
* simply omitted. The provided configuration object is not modified by
|
||||
* this function.
|
||||
*
|
||||
* @param {Object} object
|
||||
* A configuration object describing the HTTP request to be made by
|
||||
* requestService(). As described by requestService(), this object must
|
||||
* be a configuration object accepted by AngularJS' $http service.
|
||||
*
|
||||
* @returns {Promise.<Object>}
|
||||
* A promise that will resolve with the data from the HTTP response for
|
||||
* the underlying requestService() call if successful, or reject with
|
||||
* an @link{Error} describing the failure.
|
||||
*/
|
||||
service.request = function request(object) {
|
||||
|
||||
// Add "Guacamole-Token" header if an authentication token is available
|
||||
var token = service.getCurrentToken();
|
||||
if (token) {
|
||||
object = _.merge({
|
||||
headers : { 'Guacamole-Token' : token }
|
||||
}, object);
|
||||
}
|
||||
|
||||
return requestService(object);
|
||||
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
||||
|
@@ -47,16 +47,10 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
*/
|
||||
service.getActiveConnection = function getActiveConnection(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve active connection
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/activeConnections/' + encodeURIComponent(id),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/activeConnections/' + encodeURIComponent(id)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -79,17 +73,13 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
*/
|
||||
service.getActiveConnections = function getActiveConnections(dataSource, permissionTypes) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Add permission filter if specified
|
||||
var httpParameters = {};
|
||||
if (permissionTypes)
|
||||
httpParameters.permission = permissionTypes;
|
||||
|
||||
// Retrieve tunnels
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/activeConnections',
|
||||
params : httpParameters
|
||||
@@ -111,11 +101,6 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
*/
|
||||
service.deleteActiveConnections = function deleteActiveConnections(dataSource, identifiers) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Convert provided array of identifiers to a patch
|
||||
var activeConnectionPatch = [];
|
||||
identifiers.forEach(function addActiveConnectionPatch(identifier) {
|
||||
@@ -126,10 +111,9 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
});
|
||||
|
||||
// Perform active connection deletion via PATCH
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PATCH',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/activeConnections',
|
||||
params : httpParameters,
|
||||
data : activeConnectionPatch
|
||||
});
|
||||
|
||||
@@ -154,18 +138,12 @@ angular.module('rest').factory('activeConnectionService', ['$injector',
|
||||
*/
|
||||
service.getSharingCredentials = function getSharingCredentials(dataSource, id, sharingProfile) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Generate sharing credentials
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource)
|
||||
+ '/activeConnections/' + encodeURIComponent(id)
|
||||
+ '/sharingCredentials/' + encodeURIComponent(sharingProfile),
|
||||
params : httpParameters
|
||||
+ '/sharingCredentials/' + encodeURIComponent(sharingProfile)
|
||||
});
|
||||
|
||||
};
|
||||
|
@@ -59,17 +59,13 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
||||
// Use the root connection group ID if no ID is passed in
|
||||
connectionGroupID = connectionGroupID || ConnectionGroup.ROOT_IDENTIFIER;
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Add permission filter if specified
|
||||
var httpParameters = {};
|
||||
if (permissionTypes)
|
||||
httpParameters.permission = permissionTypes;
|
||||
|
||||
// Retrieve connection group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroupID) + '/tree',
|
||||
@@ -96,17 +92,11 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
||||
// Use the root connection group ID if no ID is passed in
|
||||
connectionGroupID = connectionGroupID || ConnectionGroup.ROOT_IDENTIFIER;
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve connection group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroupID),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroupID)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -126,17 +116,11 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
||||
*/
|
||||
service.saveConnectionGroup = function saveConnectionGroup(dataSource, connectionGroup) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// If connection group is new, add it and set the identifier automatically
|
||||
if (!connectionGroup.identifier) {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'POST',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups',
|
||||
params : httpParameters,
|
||||
data : connectionGroup
|
||||
})
|
||||
|
||||
@@ -153,10 +137,9 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
||||
|
||||
// Otherwise, update the existing connection group
|
||||
else {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroup.identifier),
|
||||
params : httpParameters,
|
||||
data : connectionGroup
|
||||
})
|
||||
|
||||
@@ -184,16 +167,10 @@ angular.module('rest').factory('connectionGroupService', ['$injector',
|
||||
*/
|
||||
service.deleteConnectionGroup = function deleteConnectionGroup(dataSource, connectionGroup) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Delete connection group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'DELETE',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroup.identifier),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connectionGroups/' + encodeURIComponent(connectionGroup.identifier)
|
||||
})
|
||||
|
||||
// Clear the cache
|
||||
|
@@ -47,17 +47,11 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
*/
|
||||
service.getConnection = function getConnection(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve connection
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -76,16 +70,10 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
*/
|
||||
service.getConnectionHistory = function getConnectionHistory(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve connection history
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id) + '/history',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id) + '/history'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -104,17 +92,11 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
*/
|
||||
service.getConnectionParameters = function getConnectionParameters(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve connection parameters
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id) + '/parameters',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(id) + '/parameters'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -134,17 +116,11 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
*/
|
||||
service.saveConnection = function saveConnection(dataSource, connection) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// If connection is new, add it and set the identifier automatically
|
||||
if (!connection.identifier) {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'POST',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections',
|
||||
params : httpParameters,
|
||||
data : connection
|
||||
})
|
||||
|
||||
@@ -161,10 +137,9 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
|
||||
// Otherwise, update the existing connection
|
||||
else {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(connection.identifier),
|
||||
params : httpParameters,
|
||||
data : connection
|
||||
})
|
||||
|
||||
@@ -192,16 +167,10 @@ angular.module('rest').factory('connectionService', ['$injector',
|
||||
*/
|
||||
service.deleteConnection = function deleteConnection(dataSource, connection) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Delete connection
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'DELETE',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(connection.identifier),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/connections/' + encodeURIComponent(connection.identifier)
|
||||
})
|
||||
|
||||
// Clear the cache
|
||||
|
@@ -60,10 +60,7 @@ angular.module('rest').factory('historyService', ['$injector',
|
||||
service.getConnectionHistory = function getConnectionHistory(dataSource,
|
||||
requiredContents, sortPredicates) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
var httpParameters = {};
|
||||
|
||||
// Filter according to contents if restrictions are specified
|
||||
if (requiredContents)
|
||||
@@ -74,7 +71,7 @@ angular.module('rest').factory('historyService', ['$injector',
|
||||
httpParameters.order = sortPredicates;
|
||||
|
||||
// Retrieve connection history
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/history/connections',
|
||||
params : httpParameters
|
||||
|
@@ -41,17 +41,11 @@ angular.module('rest').factory('languageService', ['$injector',
|
||||
*/
|
||||
service.getLanguages = function getLanguages() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available languages
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.languages,
|
||||
method : 'GET',
|
||||
url : 'api/languages',
|
||||
params : httpParameters
|
||||
url : 'api/languages'
|
||||
});
|
||||
|
||||
};
|
||||
|
@@ -144,17 +144,11 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
*/
|
||||
service.getUserGroups = function getUserGroups(dataSource, identifier, group) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve parent groups
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : getUserGroupsResourceURL(dataSource, identifier, group),
|
||||
params : httpParameters
|
||||
url : getUserGroupsResourceURL(dataSource, identifier, group)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -193,16 +187,10 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
service.patchUserGroups = function patchUserGroups(dataSource, identifier,
|
||||
addToUserGroups, removeFromUserGroups, group) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update parent user groups
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PATCH',
|
||||
url : getUserGroupsResourceURL(dataSource, identifier, group),
|
||||
params : httpParameters,
|
||||
data : getRelatedObjectPatch(addToUserGroups, removeFromUserGroups)
|
||||
})
|
||||
|
||||
@@ -232,17 +220,11 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
*/
|
||||
service.getMemberUsers = function getMemberUsers(dataSource, identifier) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve member users
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUsers',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUsers'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -275,16 +257,10 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
service.patchMemberUsers = function patchMemberUsers(dataSource, identifier,
|
||||
usersToAdd, usersToRemove) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update member users
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PATCH',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUsers',
|
||||
params : httpParameters,
|
||||
data : getRelatedObjectPatch(usersToAdd, usersToRemove)
|
||||
})
|
||||
|
||||
@@ -316,17 +292,11 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
*/
|
||||
service.getMemberUserGroups = function getMemberUserGroups(dataSource, identifier) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve member user groups
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUserGroups',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUserGroups'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -360,16 +330,10 @@ angular.module('rest').factory('membershipService', ['$injector',
|
||||
service.patchMemberUserGroups = function patchMemberUserGroups(dataSource,
|
||||
identifier, userGroupsToAdd, userGroupsToRemove) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update member user groups
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PATCH',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier) + '/memberUserGroups',
|
||||
params : httpParameters,
|
||||
data : getRelatedObjectPatch(userGroupsToAdd, userGroupsToRemove)
|
||||
})
|
||||
|
||||
|
@@ -42,17 +42,11 @@ angular.module('rest').factory('patchService', ['$injector',
|
||||
*/
|
||||
service.getPatches = function getPatches() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve all applicable HTML patches
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.patches,
|
||||
method : 'GET',
|
||||
url : 'api/patches',
|
||||
params : httpParameters
|
||||
url : 'api/patches'
|
||||
});
|
||||
|
||||
};
|
||||
|
@@ -105,17 +105,11 @@ angular.module('rest').factory('permissionService', ['$injector',
|
||||
*/
|
||||
service.getEffectivePermissions = function getEffectivePermissions(dataSource, userID) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve user permissions
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : getEffectivePermissionsResourceURL(dataSource, userID),
|
||||
params : httpParameters
|
||||
url : getEffectivePermissionsResourceURL(dataSource, userID)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -198,17 +192,11 @@ angular.module('rest').factory('permissionService', ['$injector',
|
||||
*/
|
||||
service.getPermissions = function getPermissions(dataSource, identifier, group) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve user/group permissions
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : getPermissionsResourceURL(dataSource, identifier, group),
|
||||
params : httpParameters
|
||||
url : getPermissionsResourceURL(dataSource, identifier, group)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -333,11 +321,6 @@ angular.module('rest').factory('permissionService', ['$injector',
|
||||
|
||||
var permissionPatch = [];
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Add all the add operations to the patch
|
||||
addPatchOperations(permissionPatch, PermissionPatch.Operation.ADD, permissionsToAdd);
|
||||
|
||||
@@ -345,10 +328,9 @@ angular.module('rest').factory('permissionService', ['$injector',
|
||||
addPatchOperations(permissionPatch, PermissionPatch.Operation.REMOVE, permissionsToRemove);
|
||||
|
||||
// Patch user/group permissions
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PATCH',
|
||||
url : getPermissionsResourceURL(dataSource, identifier, group),
|
||||
params : httpParameters,
|
||||
data : permissionPatch
|
||||
})
|
||||
|
||||
|
@@ -49,17 +49,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getUserAttributes = function getUserAttributes(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available user attributes
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/userAttributes',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/userAttributes'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -83,17 +77,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getUserGroupAttributes = function getUserGroupAttributes(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available user group attributes
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/userGroupAttributes',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/userGroupAttributes'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -117,17 +105,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getConnectionAttributes = function getConnectionAttributes(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available connection attributes
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/connectionAttributes',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/connectionAttributes'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -151,17 +133,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getSharingProfileAttributes = function getSharingProfileAttributes(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available sharing profile attributes
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/sharingProfileAttributes',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/sharingProfileAttributes'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -185,17 +161,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getConnectionGroupAttributes = function getConnectionGroupAttributes(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available connection group attributes
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/connectionGroupAttributes',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/connectionGroupAttributes'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -216,17 +186,11 @@ angular.module('rest').factory('schemaService', ['$injector',
|
||||
*/
|
||||
service.getProtocols = function getProtocols(dataSource) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve available protocols
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.schema,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/protocols',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/schema/protocols'
|
||||
});
|
||||
|
||||
};
|
||||
|
@@ -49,17 +49,11 @@ angular.module('rest').factory('sharingProfileService', ['$injector',
|
||||
*/
|
||||
service.getSharingProfile = function getSharingProfile(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve sharing profile
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(id),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(id)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -78,17 +72,11 @@ angular.module('rest').factory('sharingProfileService', ['$injector',
|
||||
*/
|
||||
service.getSharingProfileParameters = function getSharingProfileParameters(dataSource, id) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve sharing profile parameters
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.connections,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(id) + '/parameters',
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(id) + '/parameters'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -109,17 +97,11 @@ angular.module('rest').factory('sharingProfileService', ['$injector',
|
||||
*/
|
||||
service.saveSharingProfile = function saveSharingProfile(dataSource, sharingProfile) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// If sharing profile is new, add it and set the identifier automatically
|
||||
if (!sharingProfile.identifier) {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'POST',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles',
|
||||
params : httpParameters,
|
||||
data : sharingProfile
|
||||
})
|
||||
|
||||
@@ -136,10 +118,9 @@ angular.module('rest').factory('sharingProfileService', ['$injector',
|
||||
|
||||
// Otherwise, update the existing sharing profile
|
||||
else {
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(sharingProfile.identifier),
|
||||
params : httpParameters,
|
||||
data : sharingProfile
|
||||
})
|
||||
|
||||
@@ -168,16 +149,10 @@ angular.module('rest').factory('sharingProfileService', ['$injector',
|
||||
*/
|
||||
service.deleteSharingProfile = function deleteSharingProfile(dataSource, sharingProfile) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Delete sharing profile
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'DELETE',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(sharingProfile.identifier),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/sharingProfiles/' + encodeURIComponent(sharingProfile.identifier)
|
||||
})
|
||||
|
||||
// Clear the cache
|
||||
|
@@ -65,16 +65,10 @@ angular.module('rest').factory('tunnelService', ['$injector',
|
||||
*/
|
||||
service.getTunnels = function getTunnels() {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve tunnels
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/tunnels',
|
||||
params : httpParameters
|
||||
url : 'api/session/tunnels'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -124,17 +118,11 @@ angular.module('rest').factory('tunnelService', ['$injector',
|
||||
*/
|
||||
service.getSharingProfiles = function getSharingProfiles(tunnel) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve all associated sharing profiles
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/tunnels/' + encodeURIComponent(tunnel)
|
||||
+ '/activeConnection/connection/sharingProfiles',
|
||||
params : httpParameters
|
||||
+ '/activeConnection/connection/sharingProfiles'
|
||||
});
|
||||
|
||||
};
|
||||
@@ -160,18 +148,12 @@ angular.module('rest').factory('tunnelService', ['$injector',
|
||||
*/
|
||||
service.getSharingCredentials = function getSharingCredentials(tunnel, sharingProfile) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Generate sharing credentials
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'GET',
|
||||
url : 'api/session/tunnels/' + encodeURIComponent(tunnel)
|
||||
+ '/activeConnection/sharingCredentials/'
|
||||
+ encodeURIComponent(sharingProfile),
|
||||
params : httpParameters
|
||||
+ encodeURIComponent(sharingProfile)
|
||||
});
|
||||
|
||||
};
|
||||
|
@@ -52,17 +52,13 @@ angular.module('rest').factory('userGroupService', ['$injector',
|
||||
*/
|
||||
service.getUserGroups = function getUserGroups(dataSource, permissionTypes) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Add permission filter if specified
|
||||
var httpParameters = {};
|
||||
if (permissionTypes)
|
||||
httpParameters.permission = permissionTypes;
|
||||
|
||||
// Retrieve user groups
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups',
|
||||
@@ -89,17 +85,11 @@ angular.module('rest').factory('userGroupService', ['$injector',
|
||||
*/
|
||||
service.getUserGroup = function getUserGroup(dataSource, identifier) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve user group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(identifier)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -122,16 +112,10 @@ angular.module('rest').factory('userGroupService', ['$injector',
|
||||
*/
|
||||
service.deleteUserGroup = function deleteUserGroup(dataSource, userGroup) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Delete user group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'DELETE',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(userGroup.identifier),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(userGroup.identifier)
|
||||
})
|
||||
|
||||
// Clear the cache
|
||||
@@ -160,16 +144,10 @@ angular.module('rest').factory('userGroupService', ['$injector',
|
||||
*/
|
||||
service.createUserGroup = function createUserGroup(dataSource, userGroup) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Create user group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'POST',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups',
|
||||
params : httpParameters,
|
||||
data : userGroup
|
||||
})
|
||||
|
||||
@@ -198,16 +176,10 @@ angular.module('rest').factory('userGroupService', ['$injector',
|
||||
*/
|
||||
service.saveUserGroup = function saveUserGroup(dataSource, userGroup) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update user group
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/userGroups/' + encodeURIComponent(userGroup.identifier),
|
||||
params : httpParameters,
|
||||
data : userGroup
|
||||
})
|
||||
|
||||
|
@@ -56,17 +56,13 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
*/
|
||||
service.getUsers = function getUsers(dataSource, permissionTypes) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Add permission filter if specified
|
||||
var httpParameters = {};
|
||||
if (permissionTypes)
|
||||
httpParameters.permission = permissionTypes;
|
||||
|
||||
// Retrieve users
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users',
|
||||
@@ -93,17 +89,11 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
*/
|
||||
service.getUser = function getUser(dataSource, username) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Retrieve user
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
cache : cacheService.users,
|
||||
method : 'GET',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(username),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(username)
|
||||
});
|
||||
|
||||
};
|
||||
@@ -126,16 +116,10 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
*/
|
||||
service.deleteUser = function deleteUser(dataSource, user) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Delete user
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'DELETE',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(user.username),
|
||||
params : httpParameters
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(user.username)
|
||||
})
|
||||
|
||||
// Clear the cache
|
||||
@@ -164,16 +148,10 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
*/
|
||||
service.createUser = function createUser(dataSource, user) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Create user
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'POST',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users',
|
||||
params : httpParameters,
|
||||
data : user
|
||||
})
|
||||
|
||||
@@ -202,16 +180,10 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
*/
|
||||
service.saveUser = function saveUser(dataSource, user) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update user
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(user.username),
|
||||
params : httpParameters,
|
||||
data : user
|
||||
})
|
||||
|
||||
@@ -247,16 +219,10 @@ angular.module('rest').factory('userService', ['$injector',
|
||||
service.updateUserPassword = function updateUserPassword(dataSource, username,
|
||||
oldPassword, newPassword) {
|
||||
|
||||
// Build HTTP parameters set
|
||||
var httpParameters = {
|
||||
token : authenticationService.getCurrentToken()
|
||||
};
|
||||
|
||||
// Update user password
|
||||
return requestService({
|
||||
return authenticationService.request({
|
||||
method : 'PUT',
|
||||
url : 'api/session/data/' + encodeURIComponent(dataSource) + '/users/' + encodeURIComponent(username) + '/password',
|
||||
params : httpParameters,
|
||||
data : new UserPasswordUpdate({
|
||||
oldPassword : oldPassword,
|
||||
newPassword : newPassword
|
||||
|
Reference in New Issue
Block a user