diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUser.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUser.java index 9da0fb561..9f2d93b23 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUser.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUser.java @@ -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 getAttributes() { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserGroup.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserGroup.java index 22aa39a76..d52530748 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserGroup.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/DelegatingUserGroup.java @@ -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 getAttributes() { diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java index 788e8d674..9cdec2a07 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java @@ -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 diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java index 4dd167d13..cbb26a9e8 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java @@ -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 diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java index 8e349e27c..9274ea23f 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUser.java @@ -64,6 +64,28 @@ public class SimpleUser extends AbstractUser { public SimpleUser(String username) { super.setIdentifier(username); } + + /** + * {@inheritDoc} + * + *

This User implementation is always enabled, so this method will + * always return false. + */ + @Override + public boolean isDisabled() { + return false; + } + + /** + * {@inheritDoc} + * + *

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 diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserGroup.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserGroup.java index be52d1642..f06eabfe1 100644 --- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserGroup.java +++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleUserGroup.java @@ -43,5 +43,27 @@ public class SimpleUserGroup extends AbstractUserGroup { public SimpleUserGroup(String identifier) { super.setIdentifier(identifier); } + + /** + * {@inheritDoc} + * + *

This implementation of UserGroup is always enabled, so this will + * always return false. + */ + @Override + public boolean isDisabled() { + return false; + } + + /** + * {@inheritDoc} + * + *

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. + } }