mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Merge 0.9.13-incubating changes back to master.
This commit is contained in:
@@ -313,8 +313,8 @@ public class ModeledConnection extends ModeledChildDirectoryObject<ConnectionMod
|
|||||||
logger.debug("Unable to parse numeric attribute.", e);
|
logger.debug("Unable to parse numeric attribute.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set guacd hostname (no translation necessary)
|
// Translate guacd hostname
|
||||||
getModel().setProxyHostname(attributes.get(GUACD_HOSTNAME_NAME));
|
getModel().setProxyHostname(TextField.parse(attributes.get(GUACD_HOSTNAME_NAME)));
|
||||||
|
|
||||||
// Translate guacd port
|
// Translate guacd port
|
||||||
try { getModel().setProxyPort(NumericField.parse(attributes.get(GUACD_PORT_NAME))); }
|
try { getModel().setProxyPort(NumericField.parse(attributes.get(GUACD_PORT_NAME))); }
|
||||||
|
@@ -526,16 +526,16 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
|||||||
private void setUnrestrictedAttributes(Map<String, String> attributes) {
|
private void setUnrestrictedAttributes(Map<String, String> attributes) {
|
||||||
|
|
||||||
// Translate full name attribute
|
// Translate full name attribute
|
||||||
getModel().setFullName(attributes.get(User.Attribute.FULL_NAME));
|
getModel().setFullName(TextField.parse(attributes.get(User.Attribute.FULL_NAME)));
|
||||||
|
|
||||||
// Translate email address attribute
|
// Translate email address attribute
|
||||||
getModel().setEmailAddress(attributes.get(User.Attribute.EMAIL_ADDRESS));
|
getModel().setEmailAddress(TextField.parse(attributes.get(User.Attribute.EMAIL_ADDRESS)));
|
||||||
|
|
||||||
// Translate organization attribute
|
// Translate organization attribute
|
||||||
getModel().setOrganization(attributes.get(User.Attribute.ORGANIZATION));
|
getModel().setOrganization(TextField.parse(attributes.get(User.Attribute.ORGANIZATION)));
|
||||||
|
|
||||||
// Translate role attribute
|
// Translate role attribute
|
||||||
getModel().setOrganizationalRole(attributes.get(User.Attribute.ORGANIZATIONAL_ROLE));
|
getModel().setOrganizationalRole(TextField.parse(attributes.get(User.Attribute.ORGANIZATIONAL_ROLE)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,4 +35,25 @@ public class TextField extends Field {
|
|||||||
super(name, Field.Type.TEXT);
|
super(name, Field.Type.TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the given string, interpreting empty strings as equivalent to
|
||||||
|
* null. For all other cases, the given string is returned verbatim.
|
||||||
|
*
|
||||||
|
* @param str
|
||||||
|
* The string to parse, which may be null.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The given string, or null if the given string was null or empty.
|
||||||
|
*/
|
||||||
|
public static String parse(String str) {
|
||||||
|
|
||||||
|
// Return null if no value provided
|
||||||
|
if (str == null || str.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Otherwise, return string unmodified
|
||||||
|
return str;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user