GUACAMOLE-292: Display all object attributes if we are creating the object.


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

Branch: refs/heads/master
Commit: 74293c23dd819539bbce5cfa4d262ddf9dd7ad89
Parents: 54a3ffe
Author: Michael Jumper <mjum...@apache.org>
Authored: Sun May 21 20:14:11 2017 -0700
Committer: Michael Jumper <mjum...@apache.org>
Committed: Fri May 26 20:45:44 2017 -0700

----------------------------------------------------------------------
 .../controllers/manageConnectionController.js   | 17 ++++++++++++++++
 .../manageConnectionGroupController.js          | 21 +++++++++++++++++++-
 .../manageSharingProfileController.js           | 19 ++++++++++++++++++
 .../manage/controllers/manageUserController.js  | 21 ++++++++++++++++++--
 .../app/manage/templates/manageConnection.html  |  2 +-
 .../manage/templates/manageConnectionGroup.html |  2 +-
 .../manage/templates/manageSharingProfile.html  |  2 +-
 .../webapp/app/manage/templates/manageUser.html |  2 +-
 8 files changed, 79 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
 
b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
index 868842e..8562207 100644
--- 
a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
+++ 
b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
@@ -300,6 +300,23 @@ 
angular.module('manage').controller('manageConnectionController', ['$scope', '$i
     }
 
     /**
+     * Returns whether the current user can change/set all connection
+     * attributes for the connection being edited, regardless of whether those
+     * attributes are already explicitly associated with that connection.
+     *
+     * @returns {Boolean}
+     *     true if the current user can change all attributes for the
+     *     connection being edited, regardless of whether those attributes are
+     *     already explicitly associated with that connection, false otherwise.
+     */
+    $scope.canChangeAllAttributes = function canChangeAllAttributes() {
+
+        // All attributes can be set if we are creating the connection
+        return !identifier;
+
+    };
+
+    /**
      * Returns the translation string namespace for the protocol having the
      * given name. The namespace will be of the form:
      *

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
 
b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
index e4c6115..bafe591 100644
--- 
a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
+++ 
b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
@@ -195,7 +195,26 @@ 
angular.module('manage').controller('manageConnectionGroupController', ['$scope'
             value : ConnectionGroup.Type.BALANCING
         }
     ];
-    
+
+    /**
+     * Returns whether the current user can change/set all connection group
+     * attributes for the connection group being edited, regardless of whether
+     * those attributes are already explicitly associated with that connection
+     * group.
+     *
+     * @returns {Boolean}
+     *     true if the current user can change all attributes for the
+     *     connection group being edited, regardless of whether those
+     *     attributes are already explicitly associated with that connection
+     *     group, false otherwise.
+     */
+    $scope.canChangeAllAttributes = function canChangeAllAttributes() {
+
+        // All attributes can be set if we are creating the connection group
+        return !identifier;
+
+    };
+
     /**
      * Cancels all pending edits, returning to the management page.
      */

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js
 
b/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js
index ca7d11e..c532975 100644
--- 
a/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js
+++ 
b/guacamole/src/main/webapp/app/manage/controllers/manageSharingProfileController.js
@@ -281,6 +281,25 @@ 
angular.module('manage').controller('manageSharingProfileController', ['$scope',
     });
 
     /**
+     * Returns whether the current user can change/set all sharing profile
+     * attributes for the sharing profile being edited, regardless of whether
+     * those attributes are already explicitly associated with that sharing
+     * profile.
+     *
+     * @returns {Boolean}
+     *     true if the current user can change all attributes for the sharing
+     *     profile being edited, regardless of whether those attributes are
+     *     already explicitly associated with that sharing profile, false
+     *     otherwise.
+     */
+    $scope.canChangeAllAttributes = function canChangeAllAttributes() {
+
+        // All attributes can be set if we are creating the sharing profile
+        return !identifier;
+
+    };
+
+    /**
      * Returns the translation string namespace for the protocol having the
      * given name. The namespace will be of the form:
      *

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/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 5337caf..7f50e43 100644
--- a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
+++ b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js
@@ -225,8 +225,8 @@ angular.module('manage').controller('manageUserController', 
['$scope', '$injecto
     };
 
     /**
-     * Returns whether the current user can change attributes associated with
-     * the user being edited within the given data source.
+     * Returns whether the current user can change attributes explicitly
+     * associated with the user being edited within the given data source.
      *
      * @param {String} [dataSource]
      *     The identifier of the data source to check. If omitted, this will
@@ -261,6 +261,23 @@ 
angular.module('manage').controller('manageUserController', ['$scope', '$injecto
     };
 
     /**
+     * Returns whether the current user can change/set all user attributes for
+     * the user being edited, regardless of whether those attributes are
+     * already explicitly associated with that user.
+     *
+     * @returns {Boolean}
+     *     true if the current user can change all attributes for the user
+     *     being edited, regardless of whether those attributes are already
+     *     explicitly associated with that user, false otherwise.
+     */
+    $scope.canChangeAllAttributes = function canChangeAllAttributes() {
+
+        // All attributes can be set if we are creating the user
+        return !$scope.userExists(selectedDataSource);
+
+    };
+
+    /**
      * Returns whether the current user can change permissions of any kind
      * which are associated with the user being edited within the given data
      * source.

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html 
b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
index 80796a4..85e4f91 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
@@ -41,7 +41,7 @@
     <!-- Connection attributes section -->
     <div class="attributes">
         <guac-form namespace="'CONNECTION_ATTRIBUTES'" content="attributes"
-                   model="connection.attributes" model-only="true"></guac-form>
+                   model="connection.attributes" 
model-only="!canChangeAllAttributes()"></guac-form>
     </div>
 
     <!-- Connection parameters -->

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/templates/manageConnectionGroup.html
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/templates/manageConnectionGroup.html 
b/guacamole/src/main/webapp/app/manage/templates/manageConnectionGroup.html
index 2d5ac58..d4c6613 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageConnectionGroup.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageConnectionGroup.html
@@ -41,7 +41,7 @@
     <!-- Connection group attributes section -->
     <div class="attributes">
         <guac-form namespace="'CONNECTION_GROUP_ATTRIBUTES'" 
content="attributes"
-                   model="connectionGroup.attributes" 
model-only="true"></guac-form>
+                   model="connectionGroup.attributes" 
model-only="!canChangeAllAttributes()"></guac-form>
     </div>
 
     <!-- Form action buttons -->

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/templates/manageSharingProfile.html
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/manage/templates/manageSharingProfile.html 
b/guacamole/src/main/webapp/app/manage/templates/manageSharingProfile.html
index a8e6438..d6c7043 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageSharingProfile.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageSharingProfile.html
@@ -22,7 +22,7 @@
     <!-- Sharing profile attributes section -->
     <div class="attributes">
         <guac-form namespace="'SHARING_PROFILE_ATTRIBUTES'" 
content="attributes"
-                   model="sharingProfile.attributes" 
model-only="true"></guac-form>
+                   model="sharingProfile.attributes" 
model-only="!canChangeAllAttributes()"></guac-form>
     </div>
 
     <!-- Sharing profile parameters -->

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/74293c23/guacamole/src/main/webapp/app/manage/templates/manageUser.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/manageUser.html 
b/guacamole/src/main/webapp/app/manage/templates/manageUser.html
index dc71d27..55b6d30 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageUser.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageUser.html
@@ -42,7 +42,7 @@
         <!-- User attributes section -->
         <div class="attributes" ng-show="canChangeAttributes()">
             <guac-form namespace="'USER_ATTRIBUTES'" content="attributes"
-                       model="user.attributes" model-only="true"></guac-form>
+                       model="user.attributes" 
model-only="!canChangeAllAttributes()"></guac-form>
         </div>
 
         <!-- System permissions section -->

Reply via email to