mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1479: Implement the disabled methods for User and UserGroup in REST API.
This commit is contained in:
@@ -43,6 +43,11 @@ public class APIUser {
|
|||||||
*/
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean value indicating whether or not this user account is disabled.
|
||||||
|
*/
|
||||||
|
private boolean disabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of all associated attributes by attribute identifier.
|
* Map of all associated attributes by attribute identifier.
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +66,9 @@ public class APIUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new APIUser from the provided User.
|
* Construct a new APIUser from the provided User.
|
||||||
* @param user The User to construct the APIUser from.
|
*
|
||||||
|
* @param user
|
||||||
|
* The User to construct the APIUser from.
|
||||||
*/
|
*/
|
||||||
public APIUser(User user) {
|
public APIUser(User user) {
|
||||||
|
|
||||||
@@ -69,6 +76,7 @@ public class APIUser {
|
|||||||
this.username = user.getIdentifier();
|
this.username = user.getIdentifier();
|
||||||
this.password = user.getPassword();
|
this.password = user.getPassword();
|
||||||
this.lastActive = user.getLastActive();
|
this.lastActive = user.getLastActive();
|
||||||
|
this.disabled = user.isDisabled();
|
||||||
|
|
||||||
// Associate any attributes
|
// Associate any attributes
|
||||||
this.attributes = user.getAttributes();
|
this.attributes = user.getAttributes();
|
||||||
@@ -77,7 +85,9 @@ public class APIUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the username for this user.
|
* Returns the username for this user.
|
||||||
* @return The username for this user.
|
*
|
||||||
|
* @return
|
||||||
|
* The username for this user.
|
||||||
*/
|
*/
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
@@ -85,7 +95,9 @@ public class APIUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the username for this user.
|
* Set the username for this user.
|
||||||
* @param username The username for this user.
|
*
|
||||||
|
* @param username
|
||||||
|
* The username for this user.
|
||||||
*/
|
*/
|
||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
@@ -93,7 +105,9 @@ public class APIUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the password for this user.
|
* Returns the password for this user.
|
||||||
* @return The password for this user.
|
*
|
||||||
|
* @return
|
||||||
|
* The password for this user.
|
||||||
*/
|
*/
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
@@ -101,12 +115,35 @@ public class APIUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the password for this user.
|
* Set the password for this user.
|
||||||
* @param password The password for this user.
|
*
|
||||||
|
* @param password
|
||||||
|
* The password for this user.
|
||||||
*/
|
*/
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this user account is disabled, otherwise false.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* True if this user account is disabled, otherwise false.
|
||||||
|
*/
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the disabled status of this user account, disabling the account
|
||||||
|
* if set to true.
|
||||||
|
*
|
||||||
|
* @param disabled
|
||||||
|
* True if this user account should be disabled.
|
||||||
|
*/
|
||||||
|
public void setDisabled(boolean disabled) {
|
||||||
|
this.disabled = disabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of all attributes associated with this user. Each entry
|
* Returns a map of all attributes associated with this user. Each entry
|
||||||
* key is the attribute identifier, while each value is the attribute
|
* key is the attribute identifier, while each value is the attribute
|
||||||
|
@@ -70,6 +70,16 @@ public class APIUserWrapper implements User {
|
|||||||
apiUser.setPassword(password);
|
apiUser.setPassword(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return apiUser.isDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDisabled(boolean disabled) {
|
||||||
|
apiUser.setDisabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return apiUser.getAttributes();
|
return apiUser.getAttributes();
|
||||||
|
@@ -50,6 +50,9 @@ public class UserObjectTranslator
|
|||||||
if (object.getPassword() != null)
|
if (object.getPassword() != null)
|
||||||
existingObject.setPassword(object.getPassword());
|
existingObject.setPassword(object.getPassword());
|
||||||
|
|
||||||
|
// Update disabled status
|
||||||
|
existingObject.setDisabled(object.isDisabled());
|
||||||
|
|
||||||
// Update user attributes
|
// Update user attributes
|
||||||
existingObject.setAttributes(object.getAttributes());
|
existingObject.setAttributes(object.getAttributes());
|
||||||
|
|
||||||
|
@@ -37,6 +37,11 @@ public class APIUserGroup {
|
|||||||
*/
|
*/
|
||||||
private String identifier;
|
private String identifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean value indicating if this UserGroup is disabled.
|
||||||
|
*/
|
||||||
|
private boolean disabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of all associated attributes by attribute identifier.
|
* Map of all associated attributes by attribute identifier.
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +60,7 @@ public class APIUserGroup {
|
|||||||
*/
|
*/
|
||||||
public APIUserGroup(UserGroup group) {
|
public APIUserGroup(UserGroup group) {
|
||||||
this.identifier = group.getIdentifier();
|
this.identifier = group.getIdentifier();
|
||||||
|
this.disabled = group.isDisabled();
|
||||||
this.attributes = group.getAttributes();
|
this.attributes = group.getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +86,27 @@ public class APIUserGroup {
|
|||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if this user group is disabled, otherwise false.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* True if this user group is disabled, otherwise false.
|
||||||
|
*/
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return disabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not this user group is disabled to the parameter
|
||||||
|
* provided.
|
||||||
|
*
|
||||||
|
* @param disabled
|
||||||
|
* True if the user group should be disabled, otherwise false.
|
||||||
|
*/
|
||||||
|
public void setDisabled(boolean disabled) {
|
||||||
|
this.disabled = disabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a map of all attributes associated with this user group. Each
|
* Returns a map of all attributes associated with this user group. Each
|
||||||
* entry key is the attribute identifier, while each value is the attribute
|
* entry key is the attribute identifier, while each value is the attribute
|
||||||
|
@@ -62,6 +62,16 @@ public class APIUserGroupWrapper implements UserGroup {
|
|||||||
apiUserGroup.setIdentifier(identifier);
|
apiUserGroup.setIdentifier(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisabled() {
|
||||||
|
return apiUserGroup.isDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDisabled(boolean disabled) {
|
||||||
|
apiUserGroup.setDisabled(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getAttributes() {
|
public Map<String, String> getAttributes() {
|
||||||
return apiUserGroup.getAttributes();
|
return apiUserGroup.getAttributes();
|
||||||
|
@@ -47,6 +47,9 @@ public class UserGroupObjectTranslator
|
|||||||
public void applyExternalChanges(UserGroup existingObject,
|
public void applyExternalChanges(UserGroup existingObject,
|
||||||
APIUserGroup object) throws GuacamoleException {
|
APIUserGroup object) throws GuacamoleException {
|
||||||
|
|
||||||
|
// Update disabled status
|
||||||
|
existingObject.setDisabled(object.isDisabled());
|
||||||
|
|
||||||
// Update user attributes
|
// Update user attributes
|
||||||
existingObject.setAttributes(object.getAttributes());
|
existingObject.setAttributes(object.getAttributes());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user