mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 15:11:22 +00:00
GUAC-586: Add support for data sources to connection and connection group management.
This commit is contained in:
@@ -41,13 +41,18 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
||||
var PermissionSet = $injector.get('PermissionSet');
|
||||
|
||||
// Required services
|
||||
var $location = $injector.get('$location');
|
||||
var $routeParams = $injector.get('$routeParams');
|
||||
var authenticationService = $injector.get('authenticationService');
|
||||
var connectionGroupService = $injector.get('connectionGroupService');
|
||||
var dataSourceService = $injector.get('dataSourceService');
|
||||
var guacNotification = $injector.get('guacNotification');
|
||||
var permissionService = $injector.get('permissionService');
|
||||
|
||||
// Identifier of the current user
|
||||
/**
|
||||
* The identifier of the current user.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
var currentUsername = authenticationService.getCurrentUsername();
|
||||
|
||||
/**
|
||||
@@ -62,12 +67,19 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The identifier of the currently-selected data source.
|
||||
*
|
||||
* @type String
|
||||
*/
|
||||
$scope.dataSource = $routeParams.dataSource;
|
||||
|
||||
/**
|
||||
* The root connection group of the connection group hierarchy.
|
||||
*
|
||||
* @type ConnectionGroup
|
||||
* @type Object.<String, ConnectionGroup>
|
||||
*/
|
||||
$scope.rootGroup = null;
|
||||
$scope.rootGroups = null;
|
||||
|
||||
/**
|
||||
* Whether the current user can manage connections. If the current
|
||||
@@ -98,7 +110,7 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
||||
* All permissions associated with the current user, or null if the
|
||||
* user's permissions have not yet been loaded.
|
||||
*
|
||||
* @type PermissionSet
|
||||
* @type Object.<String, PermissionSet>
|
||||
*/
|
||||
$scope.permissions = null;
|
||||
|
||||
@@ -111,20 +123,25 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
||||
*/
|
||||
$scope.isLoaded = function isLoaded() {
|
||||
|
||||
return $scope.rootGroup !== null
|
||||
&& $scope.permissions !== null
|
||||
&& $scope.canManageConnections !== null
|
||||
&& $scope.canCreateConnections !== null
|
||||
&& $scope.canCreateConnectionGroups !== null;
|
||||
return $scope.rootGroup !== null
|
||||
&& $scope.permissions !== null;
|
||||
|
||||
};
|
||||
|
||||
$scope.canManageConnections = true;
|
||||
$scope.canCreateConnections = true;
|
||||
$scope.canCreateConnectionGroups = true;
|
||||
|
||||
// Retrieve current permissions
|
||||
permissionService.getPermissions(currentUsername)
|
||||
.success(function permissionsRetrieved(permissions) {
|
||||
dataSourceService.apply(
|
||||
permissionService.getPermissions,
|
||||
[$scope.dataSource],
|
||||
currentUsername
|
||||
)
|
||||
.then(function permissionsRetrieved(permissions) {
|
||||
|
||||
$scope.permissions = permissions;
|
||||
|
||||
/*
|
||||
// Ignore permission to update root group
|
||||
PermissionSet.removeConnectionGroupPermission(permissions, PermissionSet.ObjectPermissionType.UPDATE, ConnectionGroup.ROOT_IDENTIFIER);
|
||||
|
||||
@@ -154,14 +171,18 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
|
||||
// Return to home if there's nothing to do here
|
||||
if (!$scope.canManageConnections)
|
||||
$location.path('/');
|
||||
|
||||
*/
|
||||
});
|
||||
|
||||
// Retrieve all connections for which we have UPDATE or DELETE permission
|
||||
connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER,
|
||||
[PermissionSet.ObjectPermissionType.UPDATE, PermissionSet.ObjectPermissionType.DELETE])
|
||||
.success(function connectionGroupReceived(rootGroup) {
|
||||
$scope.rootGroup = rootGroup;
|
||||
dataSourceService.apply(
|
||||
connectionGroupService.getConnectionGroupTree,
|
||||
[$scope.dataSource],
|
||||
ConnectionGroup.ROOT_IDENTIFIER,
|
||||
[PermissionSet.ObjectPermissionType.UPDATE, PermissionSet.ObjectPermissionType.DELETE]
|
||||
)
|
||||
.then(function connectionGroupsReceived(rootGroups) {
|
||||
$scope.rootGroups = rootGroups;
|
||||
});
|
||||
|
||||
}]
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<a ng-href="#/manage/connections/{{item.identifier}}">
|
||||
<a ng-href="#/manage/{{item.dataSource}}/connections/{{item.identifier}}">
|
||||
<!--
|
||||
Copyright (C) 2014 Glyptodon LLC
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<a ng-href="#/manage/connectionGroups/{{item.identifier}}">
|
||||
<a ng-href="#/manage/{{item.dataSource}}/connectionGroups/{{item.identifier}}">
|
||||
<!--
|
||||
Copyright (C) 2014 Glyptodon LLC
|
||||
|
||||
|
@@ -29,11 +29,11 @@
|
||||
|
||||
<a class="add-connection button"
|
||||
ng-show="canCreateConnections"
|
||||
href="#/manage/connections/">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION' | translate}}</a>
|
||||
href="#/manage/{{dataSource}}/connections/">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION' | translate}}</a>
|
||||
|
||||
<a class="add-connection-group button"
|
||||
ng-show="canCreateConnectionGroups"
|
||||
href="#/manage/connectionGroups/">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION_GROUP' | translate}}</a>
|
||||
href="#/manage/{{dataSource}}/connectionGroups/">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION_GROUP' | translate}}</a>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<div class="connection-list">
|
||||
<guac-group-list
|
||||
page-size="25"
|
||||
connection-group="rootGroup"
|
||||
connection-groups="rootGroups"
|
||||
connection-template="'app/settings/templates/connection.html'"
|
||||
connection-group-template="'app/settings/templates/connectionGroup.html'"/>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user