mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUAC-932: Replace use of legacy connection group filtering.
This commit is contained in:
@@ -27,10 +27,11 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
|
||||
function manageController($scope, $injector) {
|
||||
|
||||
// Required types
|
||||
var PermissionSet = $injector.get('PermissionSet');
|
||||
var PermissionSet = $injector.get('PermissionSet');
|
||||
var ConnectionGroup = $injector.get('ConnectionGroup');
|
||||
|
||||
// Required services
|
||||
var legacyConnectionGroupService = $injector.get('legacyConnectionGroupService');
|
||||
var connectionGroupService = $injector.get('connectionGroupService');
|
||||
var connectionEditModal = $injector.get('connectionEditModal');
|
||||
var connectionGroupEditModal = $injector.get('connectionGroupEditModal');
|
||||
var userEditModal = $injector.get('userEditModal');
|
||||
@@ -41,34 +42,18 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
|
||||
$scope.loadingUsers = true;
|
||||
$scope.loadingConnections = true;
|
||||
|
||||
// All the connections and connection groups in root
|
||||
$scope.connectionsAndGroups = [];
|
||||
|
||||
// All users that the current user has permission to edit
|
||||
$scope.users = [];
|
||||
|
||||
$scope.basicPermissionsLoaded.then(function basicPermissionsHaveBeenLoaded() {
|
||||
legacyConnectionGroupService.getAllGroupsAndConnections([], undefined, true, true).then(function filterConnectionsAndGroups(rootGroupList) {
|
||||
$scope.rootGroup = rootGroupList[0];
|
||||
$scope.connectionsAndGroups = $scope.rootGroup.children;
|
||||
|
||||
// Filter the items to only include ones that we have UPDATE for
|
||||
if(!$scope.currentUserIsAdmin) {
|
||||
legacyConnectionGroupService.filterConnectionsAndGroupByPermission(
|
||||
$scope.connectionsAndGroups,
|
||||
$scope.currentUserPermissions,
|
||||
{
|
||||
'CONNECTION': 'UPDATE',
|
||||
'CONNECTION_GROUP': 'UPDATE'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Retrieve all users for whom we have UPDATE permission
|
||||
connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER, PermissionSet.ObjectPermissionType.UPDATE)
|
||||
.success(function connectionGroupReceived(rootGroup) {
|
||||
$scope.rootGroup = rootGroup;
|
||||
$scope.loadingConnections = false;
|
||||
});
|
||||
|
||||
// Retrieve all users for whom we have UPDATE permission
|
||||
userService.getUsers(PermissionSet.ObjectPermissionType.UPDATE).success(function usersReceived(users) {
|
||||
userService.getUsers(PermissionSet.ObjectPermissionType.UPDATE)
|
||||
.success(function usersReceived(users) {
|
||||
$scope.users = users;
|
||||
$scope.loadingUsers = false;
|
||||
});
|
||||
|
@@ -23,5 +23,5 @@
|
||||
/**
|
||||
* The module for the administration functionality.
|
||||
*/
|
||||
angular.module('manage', ['btford.modal', 'rest', 'util']);
|
||||
angular.module('manage', ['btford.modal', 'groupList', 'rest', 'util']);
|
||||
|
||||
|
@@ -20,28 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<script type="text/ng-template" id="nestedGroup.html">
|
||||
<div class="connection" ng-click="editConnection(item)" ng-show="item.isConnection">
|
||||
<div class="caption">
|
||||
<div class="protocol">
|
||||
<div class="icon type" ng-class="item.protocol"></div>
|
||||
</div>
|
||||
<span class="name">{{item.name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group" ng-show="!item.isConnection">
|
||||
<div class="caption">
|
||||
<div class="icon group type" ng-click="toggleExpanded(item)" ng-class="{expanded: item.expanded, empty: !item.children.length, balancer: item.balancer && !item.children.length}"></div>
|
||||
<span ng-click="editConnectionGroup(item)" class="name">
|
||||
<span>{{item.name}}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="children" ng-show="item.expanded">
|
||||
<div class="list-item" ng-repeat="item in item.children | orderBy : 'name'" ng-include="'nestedGroup.html'">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<div class="logout-panel">
|
||||
<a class="back button" href="#/">{{'manage.back' | translate}}</a>
|
||||
<a class="logout button" ng-click="logout()">{{'home.logout' | translate}}</a>
|
||||
@@ -85,7 +63,7 @@ THE SOFTWARE.
|
||||
|
||||
<!-- List of connections and groups this user has access to -->
|
||||
<div class="connection-list" ng-class="{loading: loadingConnections}">
|
||||
<div class="list-item" ng-repeat="item in connectionsAndGroups | orderBy : 'name'" ng-include="'nestedGroup.html'"></div>
|
||||
<guac-group-list connection-group="rootGroup"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user