diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/ModeledUser.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/ModeledUser.java index d35b9c07b..aba2d4f02 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/ModeledUser.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/ModeledUser.java @@ -37,6 +37,7 @@ import org.glyptodon.guacamole.auth.jdbc.activeconnection.ActiveConnectionPermis import org.glyptodon.guacamole.auth.jdbc.permission.ConnectionGroupPermissionService; import org.glyptodon.guacamole.auth.jdbc.permission.ConnectionPermissionService; import org.glyptodon.guacamole.auth.jdbc.permission.UserPermissionService; +import org.glyptodon.guacamole.form.BooleanField; import org.glyptodon.guacamole.form.Field; import org.glyptodon.guacamole.form.Form; import org.glyptodon.guacamole.net.auth.User; @@ -68,9 +69,9 @@ public class ModeledUser extends ModeledDirectoryObject implements Us * All attributes related to restricting user accounts, within a logical * form. */ - public static final Form ACCOUNT_RESTRICTIONS = new Form("restrictions", "Account Restrictions", Arrays.asList( - new Field(DISABLED_ATTRIBUTE_NAME, "Disabled", "true"), - new Field(EXPIRED_ATTRIBUTE_NAME, "Password expired", "true") + public static final Form ACCOUNT_RESTRICTIONS = new Form("restrictions", "Account Restrictions", Arrays.asList( + new BooleanField(DISABLED_ATTRIBUTE_NAME, "Disabled", "true"), + new BooleanField(EXPIRED_ATTRIBUTE_NAME, "Password expired", "true") )); /** diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/UserService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/UserService.java index 7495cfa1e..3e1752eff 100644 --- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/UserService.java +++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/glyptodon/guacamole/auth/jdbc/user/UserService.java @@ -39,6 +39,7 @@ import org.glyptodon.guacamole.auth.jdbc.permission.ObjectPermissionModel; import org.glyptodon.guacamole.auth.jdbc.permission.UserPermissionMapper; import org.glyptodon.guacamole.auth.jdbc.security.PasswordEncryptionService; import org.glyptodon.guacamole.form.Field; +import org.glyptodon.guacamole.form.PasswordField; import org.glyptodon.guacamole.net.auth.User; import org.glyptodon.guacamole.net.auth.credentials.CredentialsInfo; import org.glyptodon.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; @@ -81,7 +82,7 @@ public class UserService extends ModeledDirectoryObjectService options) { + super(name, title, Field.Type.ENUM, options); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Field.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Field.java index 91e4c6ffd..7da40ec75 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Field.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/Field.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Glyptodon LLC + * Copyright (C) 2015 Glyptodon LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,7 +27,11 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; /** * Represents an arbitrary field, such as an HTTP parameter, the parameter of a - * remote desktop protocol, or an input field within a form. + * remote desktop protocol, or an input field within a form. Fields are generic + * and typed dynamically through a type string, with the semantics of the field + * defined by the type string. The behavior of each field type is defined + * either through the web application itself (see FormService.js) or through + * extensions. * * @author Michael Jumper */ @@ -94,13 +98,7 @@ public class Field { private String type; /** - * The value of this field, when checked. This is only applicable to - * BOOLEAN fields. - */ - private String value; - - /** - * A collection of all associated field options. + * A collection of all legal values of this field. */ private Collection options; @@ -111,7 +109,7 @@ public class Field { } /** - * Creates a new Parameter with the given name, title, and type. + * Creates a new Field with the given name, title, and type. * * @param name * The unique name to associate with this field. @@ -123,13 +121,14 @@ public class Field { * The type of this field. */ public Field(String name, String title, String type) { - this.name = name; - this.title = title; - this.type = type; + this.name = name; + this.title = title; + this.type = type; } /** - * Creates a new ENUM Parameter with the given name, title, and options. + * Creates a new Field with the given name, title, type, and possible + * values. * * @param name * The unique name to associate with this field. @@ -137,13 +136,17 @@ public class Field { * @param title * The human-readable title to associate with this field. * + * @param type + * The type of this field. + * * @param options * A collection of all possible valid options for this field. */ - public Field(String name, String title, Collection options) { + public Field(String name, String title, String type, + Collection options) { this.name = name; this.title = title; - this.type = Type.ENUM; + this.type = type; this.options = options; } @@ -188,28 +191,6 @@ public class Field { this.title = title; } - /** - * Returns the value that should be assigned to this field if enabled. This - * is only applicable to BOOLEAN fields. - * - * @return - * The value that should be assigned to this field if enabled. - */ - public String getValue() { - return value; - } - - /** - * Sets the value that should be assigned to this field if enabled. This is - * only applicable to BOOLEAN fields. - * - * @param value - * The value that should be assigned to this field if enabled. - */ - public void setValue(String value) { - this.value = value; - } - /** * Returns the type of this field. * @@ -232,8 +213,7 @@ public class Field { /** * Returns a mutable collection of field options. Changes to this - * collection directly affect the available options. This is only - * applicable to ENUM fields. + * collection directly affect the available options. * * @return * A mutable collection of field options, or null if the field has no @@ -244,8 +224,7 @@ public class Field { } /** - * Sets the options available as possible values of this field. This is - * only applicable to ENUM fields. + * Sets the options available as possible values of this field. * * @param options * The options to associate with this field. diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/MultilineField.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/MultilineField.java new file mode 100644 index 000000000..f216a45f6 --- /dev/null +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/MultilineField.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.glyptodon.guacamole.form; + +/** + * Represents a field which can contain multiple lines of text. + * + * @author Michael Jumper + */ +public class MultilineField extends Field { + + /** + * Creates a new MultilineField with the given name and title. + * + * @param name + * The unique name to associate with this field. + * + * @param title + * The human-readable title to associate with this field. + */ + public MultilineField(String name, String title) { + super(name, title, Field.Type.MULTILINE); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/NumericField.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/NumericField.java new file mode 100644 index 000000000..3b4b992c1 --- /dev/null +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/NumericField.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.glyptodon.guacamole.form; + +/** + * Represents a field which may contain only integer values. + * + * @author Michael Jumper + */ +public class NumericField extends Field { + + /** + * Creates a new NumericField with the given name and title. + * + * @param name + * The unique name to associate with this field. + * + * @param title + * The human-readable title to associate with this field. + */ + public NumericField(String name, String title) { + super(name, title, Field.Type.NUMERIC); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/PasswordField.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/PasswordField.java new file mode 100644 index 000000000..e8197563a --- /dev/null +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/PasswordField.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.glyptodon.guacamole.form; + +/** + * Represents a field which contains sensitive text information related to + * authenticating a user. + * + * @author Michael Jumper + */ +public class PasswordField extends Field { + + /** + * Creates a new PasswordField with the given name and title. + * + * @param name + * The unique name to associate with this field. + * + * @param title + * The human-readable title to associate with this field. + */ + public PasswordField(String name, String title) { + super(name, title, Field.Type.PASSWORD); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/TextField.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/TextField.java new file mode 100644 index 000000000..60a6e9467 --- /dev/null +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/TextField.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.glyptodon.guacamole.form; + +/** + * Represents a basic text field. The field may generally contain any data, but + * may not contain multiple lines. + * + * @author Michael Jumper + */ +public class TextField extends Field { + + /** + * Creates a new TextField with the given name and title. + * + * @param name + * The unique name to associate with this field. + * + * @param title + * The human-readable title to associate with this field. + */ + public TextField(String name, String title) { + super(name, title, Field.Type.TEXT); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/UsernameField.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/UsernameField.java new file mode 100644 index 000000000..60879ee28 --- /dev/null +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/form/UsernameField.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 Glyptodon LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.glyptodon.guacamole.form; + +/** + * Represents a text field which will contain the uniquely-identifying name of + * a user. + * + * @author Michael Jumper + */ +public class UsernameField extends Field { + + /** + * Creates a new UsernameField with the given name and title. + * + * @param name + * The unique name to associate with this field. + * + * @param title + * The human-readable title to associate with this field. + */ + public UsernameField(String name, String title) { + super(name, title, Field.Type.USERNAME); + } + +} diff --git a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/credentials/CredentialsInfo.java b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/credentials/CredentialsInfo.java index b3c7c1175..e693dbc79 100644 --- a/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/credentials/CredentialsInfo.java +++ b/guacamole-ext/src/main/java/org/glyptodon/guacamole/net/auth/credentials/CredentialsInfo.java @@ -26,6 +26,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import org.glyptodon.guacamole.form.Field; +import org.glyptodon.guacamole.form.PasswordField; +import org.glyptodon.guacamole.form.UsernameField; /** * Information which describes a set of valid credentials. @@ -71,13 +73,13 @@ public class CredentialsInfo { * A field describing the username HTTP parameter expected by Guacamole * during login, if usernames are being used. */ - public static final Field USERNAME = new Field("username", "username", Field.Type.USERNAME); + public static final Field USERNAME = new UsernameField("username", "username"); /** * A field describing the password HTTP parameter expected by Guacamole * during login, if passwords are being used. */ - public static final Field PASSWORD = new Field("password", "password", Field.Type.PASSWORD); + public static final Field PASSWORD = new PasswordField("password", "password"); /** * CredentialsInfo object which describes standard username/password diff --git a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/rdp.json b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/rdp.json index 0480c7528..98f64ab94 100644 --- a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/rdp.json +++ b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/rdp.json @@ -67,16 +67,22 @@ ] }, { - "name" : "disable-auth", - "title" : "Disable authentication", - "type" : "BOOLEAN", - "value" : "true" + "name" : "disable-auth", + "title" : "Disable authentication", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { - "name" : "ignore-cert", - "title" : "Ignore server certificate", - "type" : "BOOLEAN", - "value" : "true" + "name" : "ignore-cert", + "title" : "Ignore server certificate", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] } ] }, @@ -131,10 +137,13 @@ ] }, { - "name" : "console", - "title" : "Administrator console", - "type" : "BOOLEAN", - "value" : "true" + "name" : "console", + "title" : "Administrator console", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] } ] }, @@ -193,28 +202,40 @@ "name" : "device-redirection", "fields" : [ { - "name" : "console-audio", - "title" : "Support audio in console", - "type" : "BOOLEAN", - "value" : "true" + "name" : "console-audio", + "title" : "Support audio in console", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { - "name" : "disable-audio", - "title" : "Disable audio", - "type" : "BOOLEAN", - "value" : "true" + "name" : "disable-audio", + "title" : "Disable audio", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { - "name" : "enable-printing", - "title" : "Enable printing", - "type" : "BOOLEAN", - "value" : "true" + "name" : "enable-printing", + "title" : "Enable printing", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { - "name" : "enable-drive", - "title" : "Enable drive", - "type" : "BOOLEAN", - "value" : "true" + "name" : "enable-drive", + "title" : "Enable drive", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { "name" : "drive-path", diff --git a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/ssh.json b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/ssh.json index fa692975b..4efbfaf44 100644 --- a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/ssh.json +++ b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/ssh.json @@ -131,10 +131,13 @@ "name" : "sftp", "fields" : [ { - "name" : "enable-sftp", - "title" : "Enable SFTP", - "type" : "BOOLEAN", - "value" : "true" + "name" : "enable-sftp", + "title" : "Enable SFTP", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] } ] } diff --git a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/vnc.json b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/vnc.json index c7d51d034..d91cdb2e9 100644 --- a/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/vnc.json +++ b/guacamole-ext/src/main/resources/org/glyptodon/guacamole/protocols/vnc.json @@ -37,16 +37,22 @@ "name" : "display", "fields" : [ { - "name" : "read-only", - "title" : "Read-only", - "type" : "BOOLEAN", - "value" : "true" + "name" : "read-only", + "title" : "Read-only", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { - "name" : "swap-red-blue", - "title" : "Swap red/blue components", - "type" : "BOOLEAN", - "value" : "true" + "name" : "swap-red-blue", + "title" : "Swap red/blue components", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { "name" : "cursor", @@ -119,10 +125,13 @@ "name" : "audio", "fields" : [ { - "name" : "enable-audio", - "title" : "Enable audio", - "type" : "BOOLEAN", - "value" : "true" + "name" : "enable-audio", + "title" : "Enable audio", + "type" : "BOOLEAN", + "options" : [{ + "value" : "true", + "title" : "true" + }] }, { "name" : "audio-servername", diff --git a/guacamole/src/main/webapp/app/form/controllers/checkboxFieldController.js b/guacamole/src/main/webapp/app/form/controllers/checkboxFieldController.js index eb15d37a5..830ef0d23 100644 --- a/guacamole/src/main/webapp/app/form/controllers/checkboxFieldController.js +++ b/guacamole/src/main/webapp/app/form/controllers/checkboxFieldController.js @@ -29,12 +29,12 @@ angular.module('form').controller('checkboxFieldController', ['$scope', // Update typed value when model is changed $scope.$watch('model', function modelChanged(model) { - $scope.typedValue = (model === $scope.field.value); + $scope.typedValue = (model === $scope.field.options[0].value); }); // Update string value in model when typed value is changed $scope.$watch('typedValue', function typedValueChanged(typedValue) { - $scope.model = (typedValue ? $scope.field.value : ''); + $scope.model = (typedValue ? $scope.field.options[0].value : ''); }); }]); diff --git a/guacamole/src/main/webapp/app/rest/types/Field.js b/guacamole/src/main/webapp/app/rest/types/Field.js index 66b3aea71..d1e2b0a85 100644 --- a/guacamole/src/main/webapp/app/rest/types/Field.js +++ b/guacamole/src/main/webapp/app/rest/types/Field.js @@ -64,16 +64,7 @@ angular.module('rest').factory('Field', [function defineField() { this.type = template.type || Field.Type.TEXT; /** - * The value to set the parameter to, in the case of a BOOLEAN - * parameter, to enable that parameter's effect. - * - * @type String - */ - this.value = template.value; - - /** - * All possible legal values for this parameter. This property is only - * applicable to ENUM type parameters. + * All possible legal values for this parameter. * * @type FieldOption[] */ @@ -123,7 +114,9 @@ angular.module('rest').factory('Field', [function defineField() { /** * The type string associated with parameters that may contain only a * single possible value, where that value enables the parameter's - * effect. + * effect. It is assumed that each BOOLEAN field will provide exactly + * one possible value (option), which will be the value if that field + * is true. * * @type String */