mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
#268: Add dummy connection/user objects.
This commit is contained in:
@@ -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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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<Permission> permissions = new HashSet<Permission>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Permission> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user