GUACAMOLE-1479: Implement the disabled methods in guacamole-ext User and UserGroup classes.

This commit is contained in:
Virtually Nick
2023-03-12 20:49:22 -04:00
parent 17f16428f8
commit beacffbfc7
6 changed files with 100 additions and 0 deletions

View File

@@ -77,6 +77,16 @@ public class DelegatingUser implements User {
public void setPassword(String password) {
user.setPassword(password);
}
@Override
public boolean isDisabled() {
return user.isDisabled();
}
@Override
public void setDisabled(boolean disabled) {
user.setDisabled(disabled);
}
@Override
public Map<String, String> getAttributes() {

View File

@@ -65,6 +65,16 @@ public class DelegatingUserGroup implements UserGroup {
public void setIdentifier(String identifier) {
userGroup.setIdentifier(identifier);
}
@Override
public boolean isDisabled() {
return userGroup.isDisabled();
}
@Override
public void setDisabled(boolean disabled) {
userGroup.setDisabled(disabled);
}
@Override
public Map<String, String> getAttributes() {

View File

@@ -79,6 +79,23 @@ public interface User extends Identifiable, Attributes, Permissions {
* @param password The password to set.
*/
public void setPassword(String password);
/**
* Returns true if this user account is disabled, otherwise false.
*
* @return
* True if this user account is disabled, otherwise false.
*/
public boolean isDisabled();
/**
* Set the disabled status of this account to the boolean parameter as
* provided, true if the account should be disabled, otherwise false.
*
* @param disabled
* True if the account should be disabled, otherwise false.
*/
public void setDisabled(boolean disabled);
/**
* Returns the date and time that this user was last active. If the user

View File

@@ -28,6 +28,25 @@ import org.apache.guacamole.GuacamoleException;
*/
public interface UserGroup extends Identifiable, Attributes, Permissions {
/**
* Returns true if the user group is disabled, making membership in the group
* ineffective, meaning that any permissions or other group membership
* assigned to this group will not apply to member groups and users.
*
* @return
* True if the group is disabled, otherwise false.
*/
public boolean isDisabled();
/**
* Set the disabled status of the user group, passing a boolean true value
* if the user group should be disabled, otherwise false.
*
* @param disabled
* True if the user group should be disabled, otherwise false.
*/
public void setDisabled(boolean disabled);
/**
* Returns a set of all readable user groups of which this user group is a
* member. If permission is granted for the current user to modify the

View File

@@ -64,6 +64,28 @@ public class SimpleUser extends AbstractUser {
public SimpleUser(String username) {
super.setIdentifier(username);
}
/**
* {@inheritDoc}
*
* <p>This User implementation is always enabled, so this method will
* always return false.
*/
@Override
public boolean isDisabled() {
return false;
}
/**
* {@inheritDoc}
*
* <p>This User implementation is always enabled, so this method will
* silently ignore the value passed in under the disabled parameter.
*/
@Override
public void setDisabled(boolean disabled) {
// Silently ignore disabled value
}
/**
* Adds a new READ permission to the given set of permissions for each of

View File

@@ -43,5 +43,27 @@ public class SimpleUserGroup extends AbstractUserGroup {
public SimpleUserGroup(String identifier) {
super.setIdentifier(identifier);
}
/**
* {@inheritDoc}
*
* <p>This implementation of UserGroup is always enabled, so this will
* always return false.
*/
@Override
public boolean isDisabled() {
return false;
}
/**
* {@inheritDoc}
*
* <p>This implementation of UserGroup is always enabled, so this method
* will silently ignore the value passed in the disabled parameter.
*/
@Override
public void setDisabled(boolean disabled) {
// Silently ignore as the UserGroup implementation is always enabled.
}
}