diff --git a/guacamole/src/main/webapp/app/index/styles/ui.css b/guacamole/src/main/webapp/app/index/styles/ui.css index f324e3d29..67e34e48f 100644 --- a/guacamole/src/main/webapp/app/index/styles/ui.css +++ b/guacamole/src/main/webapp/app/index/styles/ui.css @@ -165,7 +165,8 @@ div.section { } .connection .icon, -.connection-group .icon { +.connection-group .icon, +.sharing-profile .icon { display: inline-block; width: 24px; height: 24px; @@ -199,6 +200,10 @@ div.section { background-image: url('images/protocol-icons/guac-monitor.png'); } +.sharing-profile .icon { + background-image: url('images/share.png'); +} + /* * Groups */ diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js index 2a308f15d..36d00c624 100644 --- a/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js +++ b/guacamole/src/main/webapp/app/manage/controllers/manageUserController.js @@ -633,6 +633,10 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto { label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS", value: PermissionSet.SystemPermissionType.CREATE_CONNECTION_GROUP + }, + { + label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_SHARING_PROFILES", + value: PermissionSet.SystemPermissionType.CREATE_SHARING_PROFILE } ]; @@ -861,6 +865,45 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto }; + /** + * Updates the permissionsAdded and permissionsRemoved permission sets to + * reflect the addition of the given sharing profile permission. + * + * @param {String} identifier + * The identifier of the sharing profile to add READ permission for. + */ + var addSharingProfilePermission = function addSharingProfilePermission(identifier) { + + // If permission was previously removed, simply un-remove it + if (PermissionSet.hasSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier)) + PermissionSet.removeSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier); + + // Otherwise, explicitly add the permission + else + PermissionSet.addSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier); + + }; + + /** + * Updates the permissionsAdded and permissionsRemoved permission sets to + * reflect the removal of the given sharing profile permission. + * + * @param {String} identifier + * The identifier of the sharing profile to remove READ permission for. + */ + var removeSharingProfilePermission = function removeSharingProfilePermission(identifier) { + + // If permission was previously added, simply un-add it + if (PermissionSet.hasSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier)) + PermissionSet.removeSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier); + + // Otherwise, explicitly remove the permission + else + PermissionSet.addSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier); + + }; + + // Expose permission query and modification functions to group list template $scope.groupListContext = { @@ -918,6 +961,28 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto else removeConnectionGroupPermission(identifier); + }, + + /** + * Notifies the controller that a change has been made to the given + * sharing profile permission for the user being edited. This only + * applies to READ permissions. + * + * @param {String} identifier + * The identifier of the sharing profile affected by the changed + * permission. + */ + sharingProfilePermissionChanged : function sharingProfilePermissionChanged(identifier) { + + // Determine current permission setting + var value = $scope.permissionFlags.sharingProfilePermissions.READ[identifier]; + + // Add/remove permission depending on flag state + if (value) + addSharingProfilePermission(identifier); + else + removeSharingProfilePermission(identifier); + } }; diff --git a/guacamole/src/main/webapp/app/manage/templates/manageUser.html b/guacamole/src/main/webapp/app/manage/templates/manageUser.html index 14edccda1..82bc1e978 100644 --- a/guacamole/src/main/webapp/app/manage/templates/manageUser.html +++ b/guacamole/src/main/webapp/app/manage/templates/manageUser.html @@ -79,6 +79,7 @@ context="groupListContext" connection-groups="filteredRootGroups" connection-template="'app/manage/templates/connectionPermission.html'" + sharing-profile-template="'app/manage/templates/sharingProfilePermission.html'" connection-group-template="'app/manage/templates/connectionGroupPermission.html'" page-size="20"/> diff --git a/guacamole/src/main/webapp/app/manage/templates/sharingProfilePermission.html b/guacamole/src/main/webapp/app/manage/templates/sharingProfilePermission.html new file mode 100644 index 000000000..bc2b1302c --- /dev/null +++ b/guacamole/src/main/webapp/app/manage/templates/sharingProfilePermission.html @@ -0,0 +1,13 @@ +
+ + +
+ + + + + + {{item.name}} + +
diff --git a/guacamole/src/main/webapp/translations/en.json b/guacamole/src/main/webapp/translations/en.json index 3c9ce9ccd..e9914368c 100644 --- a/guacamole/src/main/webapp/translations/en.json +++ b/guacamole/src/main/webapp/translations/en.json @@ -256,6 +256,7 @@ "FIELD_HEADER_CREATE_NEW_USERS" : "Create new users:", "FIELD_HEADER_CREATE_NEW_CONNECTIONS" : "Create new connections:", "FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS" : "Create new connection groups:", + "FIELD_HEADER_CREATE_NEW_SHARING_PROFILES" : "Create new sharing profiles:", "FIELD_HEADER_PASSWORD" : "@:APP.FIELD_HEADER_PASSWORD", "FIELD_HEADER_PASSWORD_AGAIN" : "@:APP.FIELD_HEADER_PASSWORD_AGAIN", "FIELD_HEADER_USERNAME" : "Username:",