diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/connections/DummyConnection.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/connections/DummyConnection.java new file mode 100644 index 000000000..5075d8ecd --- /dev/null +++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/connections/DummyConnection.java @@ -0,0 +1,26 @@ + +package net.sourceforge.guacamole.net.basic.crud.connections; + +import net.sourceforge.guacamole.GuacamoleException; +import net.sourceforge.guacamole.net.GuacamoleSocket; +import net.sourceforge.guacamole.net.auth.AbstractConnection; +import net.sourceforge.guacamole.protocol.GuacamoleClientInformation; + +/** + * Basic Connection skeleton, providing a means of storing Connection data + * prior to CRUD operations. This Connection has no functionality for actually + * performing a connection operation, and does not promote any of the + * semantics that would otherwise be present because of the authentication + * provider. It is up to the authentication provider to create a new + * Connection based on the information contained herein. + * + * @author Michael Jumper + */ +public class DummyConnection extends AbstractConnection { + + @Override + public GuacamoleSocket connect(GuacamoleClientInformation info) throws GuacamoleException { + throw new UnsupportedOperationException("Connection unsuppported in DummyConnection."); + } + +} diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/users/DummyUser.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/users/DummyUser.java new file mode 100644 index 000000000..7ec67683e --- /dev/null +++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/crud/users/DummyUser.java @@ -0,0 +1,46 @@ + +package net.sourceforge.guacamole.net.basic.crud.users; + +import java.util.HashSet; +import java.util.Set; +import net.sourceforge.guacamole.GuacamoleException; +import net.sourceforge.guacamole.net.auth.AbstractUser; +import net.sourceforge.guacamole.net.auth.permission.Permission; + +/** + * Basic User skeleton, providing a means of storing User data prior to CRUD + * operations. This User does not promote any of the semantics that would + * otherwise be present because of the authentication provider. It is up to the + * authentication provider to create a new User based on the information + * contained herein. + * + * @author Michael Jumper + */ +public class DummyUser extends AbstractUser { + + /** + * Set of all available permissions. + */ + private Set permissions = new HashSet(); + + @Override + public Set getPermissions() throws GuacamoleException { + return permissions; + } + + @Override + public boolean hasPermission(Permission permission) throws GuacamoleException { + return permissions.contains(permission); + } + + @Override + public void addPermission(Permission permission) throws GuacamoleException { + permissions.add(permission); + } + + @Override + public void removePermission(Permission permission) throws GuacamoleException { + permissions.remove(permission); + } + +}