guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [1/3] incubator-guacamole-client git commit: GUACAMOLE-5: Include sharing profiles within connection management display.
Date Thu, 11 Aug 2016 04:30:38 GMT
Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master f63180e5c -> 8e283ef23


GUACAMOLE-5: Include sharing profiles within connection management display.


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/726613cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/726613cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/726613cb

Branch: refs/heads/master
Commit: 726613cbc8ea51020f66accd8bfb38cccad7af7f
Parents: 4929f8d
Author: Michael Jumper <mjumper@apache.org>
Authored: Sun Aug 7 23:48:55 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Wed Aug 10 19:23:08 2016 -0700

----------------------------------------------------------------------
 .../directives/guacSettingsConnections.js       | 93 +++++++++++++++++++-
 .../app/settings/styles/connection-list.css     |  8 +-
 .../app/settings/templates/connectionGroup.html |  5 ++
 .../settings/templates/newSharingProfile.html   |  3 +
 .../settings/templates/settingsConnections.html |  2 +
 .../app/settings/templates/sharingProfile.html  |  9 ++
 guacamole/src/main/webapp/translations/en.json  |  1 +
 7 files changed, 118 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
index b174a8d..6616853 100644
--- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
+++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
@@ -170,6 +170,30 @@ angular.module('settings').directive('guacSettingsConnections', [function
guacSe
             };
 
             /**
+             * Returns whether the current user can create new sharing profiles
+             * within the current data source.
+             *
+             * @return {Boolean}
+             *     true if the current user can create new sharing profiles
+             *     within the current data source, false otherwise.
+             */
+            $scope.canCreateSharingProfiles = function canCreateSharingProfiles() {
+
+                // Abort if permissions have not yet loaded
+                if (!$scope.permissions)
+                    return false;
+
+                // Can create sharing profiles if adminstrator or have explicit permission
+                if (PermissionSet.hasSystemPermission($scope.permissions, PermissionSet.SystemPermissionType.ADMINISTER)
+                 || PermissionSet.hasSystemPermission($scope.permissions, PermissionSet.SystemPermissionType.CREATE_SHARING_PROFILE))
+                     return true;
+
+                // Current data source does not allow sharing profile creation
+                return false;
+
+            };
+
+            /**
              * Returns whether the current user can create new connections or
              * connection groups or make changes to existing connections or
              * connection groups within the current data source. The
@@ -188,7 +212,9 @@ angular.module('settings').directive('guacSettingsConnections', [function
guacSe
                     return false;
 
                 // Creating connections/groups counts as management
-                if ($scope.canCreateConnections() || $scope.canCreateConnectionGroups())
+                if ($scope.canCreateConnections()
+                        || $scope.canCreateConnectionGroups()
+                        || $scope.canCreateSharingProfiles())
                     return true;
 
                 // Can manage connections if granted explicit update or delete
@@ -207,6 +233,34 @@ angular.module('settings').directive('guacSettingsConnections', [function
guacSe
             };
 
             /**
+             * Returns whether the current user can update the connection having
+             * the given identifier within the current data source.
+             *
+             * @param {String} identifier
+             *     The identifier of the connection to check.
+             *
+             * @return {Boolean}
+             *     true if the current user can update the connection having the
+             *     given identifier within the current data source, false
+             *     otherwise.
+             */
+            $scope.canUpdateConnection = function canUpdateConnection(identifier) {
+
+                // Abort if permissions have not yet loaded
+                if (!$scope.permissions)
+                    return false;
+
+                // Can update the connection if adminstrator or have explicit permission
+                if (PermissionSet.hasSystemPermission($scope.permissions, PermissionSet.SystemPermissionType.ADMINISTER)
+                 || PermissionSet.hasConnectionPermission($scope.permissions, PermissionSet.ObjectPermissionType.UPDATE,
identifier))
+                     return true;
+
+                // Current data sources does not allow the connection to be updated
+                return false;
+
+            };
+
+            /**
              * Returns whether the current user can update the connection group
              * having the given identifier within the current data source.
              *
@@ -277,6 +331,38 @@ angular.module('settings').directive('guacSettingsConnections', [function
guacSe
             };
 
             /**
+             * Adds connection-specific contextual actions to the given array of
+             * GroupListItems. Each contextual action will be represented by a
+             * new GroupListItem.
+             *
+             * @param {GroupListItem[]} items
+             *     The array of GroupListItems to which new GroupListItems
+             *     representing connection-specific contextual actions should
+             *     be added.
+             *
+             * @param {GroupListItem} [parent]
+             *     The GroupListItem representing the connection which contains
+             *     the given array of GroupListItems, if known.
+             */
+            var addConnectionActions = function addConnectionActions(items, parent) {
+
+                // Do nothing if we lack permission to modify the parent at all
+                if (parent && !$scope.canUpdateConnection(parent.identifier))
+                    return;
+
+                // Add action for creating a child sharing profile, if the user
+                // has permission to do so
+                if ($scope.canCreateSharingProfiles())
+                    items.push(new GroupListItem({
+                        type        : 'new-sharing-profile',
+                        dataSource  : $scope.dataSource,
+                        weight      : 1,
+                        wrappedItem : parent
+                    }));
+
+            };
+
+            /**
              * Decorates the given GroupListItem, including all descendants,
              * adding contextual actions.
              *
@@ -291,6 +377,11 @@ angular.module('settings').directive('guacSettingsConnections', [function
guacSe
                 if (item.type === GroupListItem.Type.CONNECTION_GROUP)
                     addConnectionGroupActions(item.children, item);
 
+                // If the item is a connection, add actions specific to
+                // connections
+                else if (item.type === GroupListItem.Type.CONNECTION)
+                    addConnectionActions(item.children, item);
+
                 // Decorate all children
                 angular.forEach(item.children, decorateItem);
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/styles/connection-list.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/styles/connection-list.css b/guacamole/src/main/webapp/app/settings/styles/connection-list.css
index 7bf3553..efcb9dc 100644
--- a/guacamole/src/main/webapp/app/settings/styles/connection-list.css
+++ b/guacamole/src/main/webapp/app/settings/styles/connection-list.css
@@ -18,7 +18,8 @@
  */
 
 .settings.connections .connection-list .new-connection,
-.settings.connections .connection-list .new-connection-group {
+.settings.connections .connection-list .new-connection-group,
+.settings.connections .connection-list .new-sharing-profile {
     opacity: 0.5;
     font-style: italic;
 }
@@ -28,7 +29,10 @@
 .settings.connections .connection-list .new-connection a:visited,
 .settings.connections .connection-list .new-connection-group a,
 .settings.connections .connection-list .new-connection-group a:hover,
-.settings.connections .connection-list .new-connection-group a:visited {
+.settings.connections .connection-list .new-connection-group a:visited,
+.settings.connections .connection-list .new-sharing-profile a,
+.settings.connections .connection-list .new-sharing-profile a:hover,
+.settings.connections .connection-list .new-sharing-profile a:visited {
     text-decoration:none;
     color: black;
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/templates/connectionGroup.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/connectionGroup.html b/guacamole/src/main/webapp/app/settings/templates/connectionGroup.html
index 8b480f1..ccf4592 100644
--- a/guacamole/src/main/webapp/app/settings/templates/connectionGroup.html
+++ b/guacamole/src/main/webapp/app/settings/templates/connectionGroup.html
@@ -1,4 +1,9 @@
 <a ng-href="#/manage/{{item.dataSource}}/connectionGroups/{{item.identifier}}">
 
+    <!-- Connection group icon -->
+    <div class="icon type"></div>
+
+    <!-- Connection group name -->
     <span class="name">{{item.name}}</span>
+
 </a>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/templates/newSharingProfile.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/newSharingProfile.html b/guacamole/src/main/webapp/app/settings/templates/newSharingProfile.html
new file mode 100644
index 0000000..12303e8
--- /dev/null
+++ b/guacamole/src/main/webapp/app/settings/templates/newSharingProfile.html
@@ -0,0 +1,3 @@
+<a ng-href="#/manage/{{item.dataSource}}/sharingProfiles/?parent={{item.wrappedItem.identifier}}">
+    <span class="name">{{'SETTINGS_CONNECTIONS.ACTION_NEW_SHARING_PROFILE' | translate}}</span>
+</a>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
index dfdf686..0b1e22c 100644
--- a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
+++ b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
@@ -37,9 +37,11 @@
             templates="{
 
                 'connection'       : 'app/settings/templates/connection.html',
+                'sharing-profile'  : 'app/settings/templates/sharingProfile.html',
                 'connection-group' : 'app/settings/templates/connectionGroup.html',
 
                 'new-connection'       : 'app/settings/templates/newConnection.html',
+                'new-sharing-profile'  : 'app/settings/templates/newSharingProfile.html',
                 'new-connection-group' : 'app/settings/templates/newConnectionGroup.html'
 
             }"/>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/app/settings/templates/sharingProfile.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/sharingProfile.html b/guacamole/src/main/webapp/app/settings/templates/sharingProfile.html
new file mode 100644
index 0000000..bce7edc
--- /dev/null
+++ b/guacamole/src/main/webapp/app/settings/templates/sharingProfile.html
@@ -0,0 +1,9 @@
+<a ng-href="#/manage/{{item.dataSource}}/sharingProfiles/{{item.identifier}}">
+
+    <!-- Sharing profile icon -->
+    <div class="icon type"></div>
+
+    <!-- Sharing profile name -->
+    <span class="name">{{item.name}}</span>
+
+</a>

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/726613cb/guacamole/src/main/webapp/translations/en.json
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json
index 01f332e..f934a22 100644
--- a/guacamole/src/main/webapp/translations/en.json
+++ b/guacamole/src/main/webapp/translations/en.json
@@ -557,6 +557,7 @@
         "ACTION_ACKNOWLEDGE"          : "@:APP.ACTION_ACKNOWLEDGE",
         "ACTION_NEW_CONNECTION"       : "New Connection",
         "ACTION_NEW_CONNECTION_GROUP" : "New Group",
+        "ACTION_NEW_SHARING_PROFILE"  : "New Sharing Profile",
 
         "DIALOG_HEADER_ERROR" : "@:APP.DIALOG_HEADER_ERROR",
 


Mime
View raw message