mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUAC-932: Add permission filtering to recursive connection group query.
This commit is contained in:
		| @@ -32,34 +32,55 @@ angular.module('rest').factory('connectionGroupService', ['$http', 'authenticati | ||||
|      * Makes a request to the REST API to get an individual connection group | ||||
|      * and all descendants, returning a promise that provides the corresponding | ||||
|      * @link{ConnectionGroup} if successful. Descendant groups and connections | ||||
|      * will be stored as children of that connection group. | ||||
|      * will be stored as children of that connection group. If a permission | ||||
|      * type is specified, the result will be filtering by that permission. | ||||
|      *  | ||||
|      * @param {String} [connectionGroupID=ConnectionGroup.ROOT_IDENTIFIER] | ||||
|      *     The ID of the connection group to retrieve. If not provided, the | ||||
|      *     root connection group will be retrieved by default. | ||||
|      *                           | ||||
|      *      | ||||
|      * @param {String} [permissionType] | ||||
|      *     The permission type string of the permission that the current user | ||||
|      *     must have for a given connection or connection group to appear | ||||
|      *     within the result. Valid values are listed within | ||||
|      *     PermissionSet.ObjectType. | ||||
|      * | ||||
|      * @returns {Promise.ConnectionGroup} | ||||
|      *     A promise which will resolve with a @link{ConnectionGroup} upon | ||||
|      *     success. | ||||
|      */ | ||||
|     service.getConnectionGroupTree = function getConnectionGroupTree(connectionGroupID) { | ||||
|     service.getConnectionGroupTree = function getConnectionGroupTree(connectionGroupID, permissionType) { | ||||
|          | ||||
|         // Use the root connection group ID if no ID is passed in | ||||
|         connectionGroupID = connectionGroupID || ConnectionGroup.ROOT_IDENTIFIER; | ||||
|          | ||||
|         return $http.get("api/connectionGroup/" + connectionGroupID + "/tree?token=" + authenticationService.getCurrentToken()); | ||||
|  | ||||
|         // Build HTTP parameters set | ||||
|         var httpParameters = { | ||||
|             token : authenticationService.getCurrentToken() | ||||
|         }; | ||||
|  | ||||
|         // Add permission filter if specified | ||||
|         if (permissionType) | ||||
|             httpParameters.permission = permissionType; | ||||
|  | ||||
|         // Retrieve connection group  | ||||
|         return $http({ | ||||
|             method  : 'GET', | ||||
|             url     : 'api/connectionGroup/' + encodeURIComponent(connectionGroupID) + '/tree', | ||||
|             params  : httpParameters | ||||
|         }); | ||||
|         | ||||
|     }; | ||||
|      | ||||
|     /** | ||||
|      * Makes a request to the REST API to get an individual connection group, | ||||
|      * returning a promise that provides the corresponding | ||||
|      * @link{ConnectionGroup} if successful. | ||||
|      *  | ||||
|      * | ||||
|      * @param {String} [connectionGroupID=ConnectionGroup.ROOT_IDENTIFIER] | ||||
|      *     The ID of the connection group to retrieve. If not provided, the | ||||
|      *     root connection group will be retrieved by default. | ||||
|      *                           | ||||
|      *      | ||||
|      * @returns {Promise.<ConnectionGroup>} A promise for the HTTP call. | ||||
|      *     A promise which will resolve with a @link{ConnectionGroup} upon | ||||
|      *     success. | ||||
| @@ -69,7 +90,17 @@ angular.module('rest').factory('connectionGroupService', ['$http', 'authenticati | ||||
|         // Use the root connection group ID if no ID is passed in | ||||
|         connectionGroupID = connectionGroupID || ConnectionGroup.ROOT_IDENTIFIER; | ||||
|          | ||||
|         return $http.get("api/connectionGroup/" + connectionGroupID + "?token=" + authenticationService.getCurrentToken()); | ||||
|         // Build HTTP parameters set | ||||
|         var httpParameters = { | ||||
|             token : authenticationService.getCurrentToken() | ||||
|         }; | ||||
|  | ||||
|         // Retrieve connection group | ||||
|         return $http({ | ||||
|             method  : 'GET', | ||||
|             url     : 'api/connectionGroup/' + encodeURIComponent(connectionGroupID), | ||||
|             params  : httpParameters | ||||
|         }); | ||||
|  | ||||
|     }; | ||||
|      | ||||
|   | ||||
		Reference in New Issue
	
	Block a user