You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2017/07/14 19:39:14 UTC

[1/4] incubator-guacamole-client git commit: GUACAMOLE-338: Allow guacGroupList and guacGroupListFilter to accept GroupListItems in addition to ConnectionGroups.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 33e76c4d7 -> 7c162fde9


GUACAMOLE-338: Allow guacGroupList and guacGroupListFilter to accept GroupListItems in addition to ConnectionGroups.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/5648c36c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5648c36c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5648c36c

Branch: refs/heads/master
Commit: 5648c36c267b6becb287542766eba77a4d9a9311
Parents: 303be24
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Jul 3 16:07:24 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Jul 3 16:07:24 2017 -0700

----------------------------------------------------------------------
 .../app/groupList/directives/guacGroupList.js     | 18 +++++++++++++-----
 .../groupList/directives/guacGroupListFilter.js   |  7 ++++++-
 2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5648c36c/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
index 87adb49..97a4f22 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
@@ -32,7 +32,7 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
              * The connection groups to display as a map of data source
              * identifier to corresponding root group.
              *
-             * @type Object.<String, ConnectionGroup>
+             * @type Object.<String, ConnectionGroup|GroupListItem>
              */
             connectionGroups : '=',
 
@@ -167,15 +167,23 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
                     // Add each provided connection group
                     angular.forEach(connectionGroups, function addConnectionGroup(connectionGroup, dataSource) {
 
+                        var rootItem;
+
                         // Prepare data source for active connection counting
                         dataSources.push(dataSource);
                         connectionCount[dataSource] = {};
 
+                        // If the provided connection group is already a
+                        // GroupListItem, no need to create a new item
+                        if (connectionGroup instanceof GroupListItem)
+                            rootItem = connectionGroup;
+
                         // Create root item for current connection group
-                        var rootItem = GroupListItem.fromConnectionGroup(dataSource, connectionGroup,
-                            $scope.isVisible(GroupListItem.Type.CONNECTION),
-                            $scope.isVisible(GroupListItem.Type.SHARING_PROFILE),
-                            countActiveConnections);
+                        else
+                            rootItem = GroupListItem.fromConnectionGroup(dataSource, connectionGroup,
+                                $scope.isVisible(GroupListItem.Type.CONNECTION),
+                                $scope.isVisible(GroupListItem.Type.SHARING_PROFILE),
+                                countActiveConnections);
 
                         // If root group is to be shown, add it as a root item
                         if ($scope.showRootGroup)

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5648c36c/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js b/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
index 818b2ff..0352393 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
@@ -49,7 +49,7 @@ angular.module('groupList').directive('guacGroupListFilter', [function guacGroup
              * identifier to corresponding root group. A subset of this map
              * will be exposed as filteredConnectionGroups.
              *
-             * @type Object.<String, ConnectionGroup>
+             * @type Object.<String, ConnectionGroup|GroupListItem>
              */
             connectionGroups : '&',
 
@@ -81,6 +81,7 @@ angular.module('groupList').directive('guacGroupListFilter', [function guacGroup
             // Required types
             var ConnectionGroup = $injector.get('ConnectionGroup');
             var FilterPattern   = $injector.get('FilterPattern');
+            var GroupListItem   = $injector.get('GroupListItem');
 
             /**
              * The pattern object to use when filtering connections.
@@ -176,6 +177,10 @@ angular.module('groupList').directive('guacGroupListFilter', [function guacGroup
                 if (connectionGroups) {
                     angular.forEach(connectionGroups, function updateFilteredConnectionGroup(connectionGroup, dataSource) {
 
+                        // Unwrap GroupListItem
+                        if (connectionGroup instanceof GroupListItem)
+                            connectionGroup = connectionGroup.wrappedItem;
+
                         // Flatten hierarchy of connection group
                         var filteredGroup = flattenConnectionGroup(connectionGroup);
 


[4/4] incubator-guacamole-client git commit: GUACAMOLE-338: Merge expand connections/groups by default if any of their descendants are selected.

Posted by vn...@apache.org.
GUACAMOLE-338: Merge expand connections/groups by default if any of their descendants are selected.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/7c162fde
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/7c162fde
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/7c162fde

Branch: refs/heads/master
Commit: 7c162fde954d618e10fea4ae28dcd87212dc8a24
Parents: 33e76c4 970e50d
Author: Nick Couchman <vn...@apache.org>
Authored: Fri Jul 14 15:07:11 2017 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Fri Jul 14 15:07:11 2017 -0400

----------------------------------------------------------------------
 .../app/groupList/directives/guacGroupList.js   | 18 +++--
 .../groupList/directives/guacGroupListFilter.js |  7 +-
 .../webapp/app/groupList/types/GroupListItem.js |  2 +-
 .../manage/controllers/manageUserController.js  | 77 +++++++++++++++++++-
 4 files changed, 95 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[3/4] incubator-guacamole-client git commit: GUACAMOLE-338: Automatically expand connections or connection groups which are ancestors of objects for which the user being modified already has READ permission.

Posted by vn...@apache.org.
GUACAMOLE-338: Automatically expand connections or connection groups which are ancestors of objects for which the user being modified already has READ permission.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/970e50d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/970e50d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/970e50d0

Branch: refs/heads/master
Commit: 970e50d0c6c9a0c4933c959f144681342cf4ac64
Parents: 5c4188e
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Jul 3 16:57:41 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Jul 3 16:57:41 2017 -0700

----------------------------------------------------------------------
 .../manage/controllers/manageUserController.js  | 77 +++++++++++++++++++-
 1 file changed, 75 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/970e50d0/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
index 7f50e43..dd69391 100644
--- a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
+++ b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
@@ -25,6 +25,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
             
     // Required types
     var ConnectionGroup   = $injector.get('ConnectionGroup');
+    var GroupListItem     = $injector.get('GroupListItem');
     var PageDefinition    = $injector.get('PageDefinition');
     var PermissionFlagSet = $injector.get('PermissionFlagSet');
     var PermissionSet     = $injector.get('PermissionSet');
@@ -133,7 +134,7 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
      * thost data sources. As only one data source is applicable to any one
      * user being edited/created, this will only contain a single key.
      *
-     * @type Object.<String, ConnectionGroup>
+     * @type Object.<String, GroupListItem>
      */
     $scope.rootGroups = null;
 
@@ -607,6 +608,59 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
 
     }
 
+    /**
+     * Expands all items within the tree descending from the given
+     * GroupListItem which have at least one descendant for which explicit READ
+     * permission is granted. The expanded state of all other items is left
+     * untouched.
+     *
+     * @param {GroupListItem} item
+     *     The GroupListItem which should be conditionally expanded depending
+     *     on whether READ permission is granted for any of its descendants.
+     *
+     * @param {PemissionFlagSet} flags
+     *     The set of permissions which should be used to determine whether the
+     *     given item and its descendants are expanded.
+     */
+    var expandReadable = function expandReadable(item, flags) {
+
+        // If the current item is expandable and has defined children,
+        // determine whether it should be expanded
+        if (item.expandable && item.children) {
+            angular.forEach(item.children, function expandReadableChild(child) {
+
+                // Determine whether the user has READ permission for the
+                // current child object
+                var readable = false;
+                switch (child.type) {
+
+                    case GroupListItem.Type.CONNECTION:
+                        readable = flags.connectionPermissions.READ[child.identifier];
+                        break;
+
+                    case GroupListItem.Type.CONNECTION_GROUP:
+                        readable = flags.connectionGroupPermissions.READ[child.identifier];
+                        break;
+
+                    case GroupListItem.Type.SHARING_PROFILE:
+                        readable = flags.sharingProfilePermissions.READ[child.identifier];
+                        break;
+
+                }
+
+                // The parent should be expanded by default if the child is
+                // expanded by default OR the user has READ permission on the
+                // child
+                item.expanded |= expandReadable(child, flags) || readable;
+
+            });
+        }
+
+        return item.expanded;
+
+    };
+
+
     // Retrieve all connections for which we have ADMINISTER permission
     dataSourceService.apply(
         connectionGroupService.getConnectionGroupTree,
@@ -615,7 +669,13 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
         [PermissionSet.ObjectPermissionType.ADMINISTER]
     )
     .then(function connectionGroupReceived(rootGroups) {
-        $scope.rootGroups = rootGroups;
+
+        // Convert all received ConnectionGroup objects into GroupListItems
+        $scope.rootGroups = {};
+        angular.forEach(rootGroups, function addGroupListItem(rootGroup, dataSource) {
+            $scope.rootGroups[dataSource] = GroupListItem.fromConnectionGroup(dataSource, rootGroup);
+        });
+
     });
     
     // Query the user's permissions for the current user
@@ -628,6 +688,19 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
         $scope.permissions = permissions;
     });
 
+    // Update default expanded state whenever connection groups and associated
+    // permissions change
+    $scope.$watchGroup(['rootGroups', 'permissionFlags'], function updateDefaultExpandedStates() {
+        angular.forEach($scope.rootGroups, function updateExpandedStates(rootGroup) {
+
+            // Automatically expand all objects with any descendants for which
+            // the user has READ permission
+            if ($scope.permissionFlags)
+                expandReadable(rootGroup, $scope.permissionFlags);
+
+        });
+    });
+
     /**
      * Available system permission types, as translation string / internal
      * value pairs.


[2/4] incubator-guacamole-client git commit: GUACAMOLE-338: The "expandable" property of connection GroupListItems should accurately reflect the default includeSharingProfiles value.

Posted by vn...@apache.org.
GUACAMOLE-338: The "expandable" property of connection GroupListItems should accurately reflect the default includeSharingProfiles value.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/5c4188e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5c4188e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5c4188e7

Branch: refs/heads/master
Commit: 5c4188e7ed3418bab82bb47ae7c57b5c50cd9d24
Parents: 5648c36
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Jul 3 16:21:21 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Jul 3 16:21:21 2017 -0700

----------------------------------------------------------------------
 guacamole/src/main/webapp/app/groupList/types/GroupListItem.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5c4188e7/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
index 3591dd0..e662972 100644
--- a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
+++ b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
@@ -187,7 +187,7 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
             dataSource : dataSource,
 
             // Type information
-            expandable : includeSharingProfiles,
+            expandable : includeSharingProfiles !== false,
             type       : GroupListItem.Type.CONNECTION,
 
             // Already-converted children