mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUAC-1132: Modify API to support listing of active connections and host information.
This commit is contained in:
@@ -24,6 +24,7 @@ package org.glyptodon.guacamole.auth.jdbc.connection;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import org.glyptodon.guacamole.net.GuacamoleSocket;
|
||||||
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,6 +62,12 @@ public class ModeledConnectionRecord implements ConnectionRecord {
|
|||||||
return model.getEndDate();
|
return model.getEndDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRemoteHost() {
|
||||||
|
// STUB
|
||||||
|
return "STUB";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return model.getUsername();
|
return model.getUsername();
|
||||||
@@ -71,4 +78,9 @@ public class ModeledConnectionRecord implements ConnectionRecord {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuacamoleSocket getActiveSocket() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.Date;
|
|||||||
import org.glyptodon.guacamole.auth.jdbc.connection.ModeledConnection;
|
import org.glyptodon.guacamole.auth.jdbc.connection.ModeledConnection;
|
||||||
import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
|
import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
|
||||||
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
|
import org.glyptodon.guacamole.auth.jdbc.user.AuthenticatedUser;
|
||||||
|
import org.glyptodon.guacamole.net.GuacamoleSocket;
|
||||||
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
||||||
|
|
||||||
|
|
||||||
@@ -162,6 +163,12 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRemoteHost() {
|
||||||
|
// STUB
|
||||||
|
return "STUB";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return user.getUser().getIdentifier();
|
return user.getUser().getIdentifier();
|
||||||
@@ -175,4 +182,10 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GuacamoleSocket getActiveSocket() {
|
||||||
|
// STUB
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,10 +28,13 @@ import org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupDirector
|
|||||||
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionDirectory;
|
import org.glyptodon.guacamole.auth.jdbc.connection.ConnectionDirectory;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import org.glyptodon.guacamole.GuacamoleException;
|
import org.glyptodon.guacamole.GuacamoleException;
|
||||||
import org.glyptodon.guacamole.auth.jdbc.base.RestrictedObject;
|
import org.glyptodon.guacamole.auth.jdbc.base.RestrictedObject;
|
||||||
import org.glyptodon.guacamole.net.auth.Connection;
|
import org.glyptodon.guacamole.net.auth.Connection;
|
||||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||||
|
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
||||||
import org.glyptodon.guacamole.net.auth.Directory;
|
import org.glyptodon.guacamole.net.auth.Directory;
|
||||||
import org.glyptodon.guacamole.net.auth.User;
|
import org.glyptodon.guacamole.net.auth.User;
|
||||||
|
|
||||||
@@ -114,4 +117,10 @@ public class UserContext extends RestrictedObject
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ConnectionRecord> getActiveConnections() throws GuacamoleException {
|
||||||
|
// STUB
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
package org.glyptodon.guacamole.net.auth;
|
package org.glyptodon.guacamole.net.auth;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import org.glyptodon.guacamole.net.GuacamoleSocket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A logging record describing when a user started and ended usage of a
|
* A logging record describing when a user started and ended usage of a
|
||||||
@@ -47,6 +48,17 @@ public interface ConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
public Date getEndDate();
|
public Date getEndDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname or IP address of the remote host that used the
|
||||||
|
* connection associated with this record, if known. If the hostname or IP
|
||||||
|
* address is not known, null is returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The hostname or IP address of the remote host, or null if this
|
||||||
|
* information is not available.
|
||||||
|
*/
|
||||||
|
public String getRemoteHost();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the user who used or is using the connection at the
|
* Returns the name of the user who used or is using the connection at the
|
||||||
* times given by this connection record.
|
* times given by this connection record.
|
||||||
@@ -65,4 +77,15 @@ public interface ConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
public boolean isActive();
|
public boolean isActive();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the connected GuacamoleSocket of the connection associated with
|
||||||
|
* this record, if any. If the connection is not active, or access to
|
||||||
|
* the socket is denied, null is returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The connected GuacamoleSocket, if any, or null if the connection is
|
||||||
|
* not active or permission is denied.
|
||||||
|
*/
|
||||||
|
public GuacamoleSocket getActiveSocket();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
package org.glyptodon.guacamole.net.auth;
|
package org.glyptodon.guacamole.net.auth;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import org.glyptodon.guacamole.GuacamoleException;
|
import org.glyptodon.guacamole.GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,4 +96,20 @@ public interface UserContext {
|
|||||||
*/
|
*/
|
||||||
ConnectionGroup getRootConnectionGroup() throws GuacamoleException;
|
ConnectionGroup getRootConnectionGroup() throws GuacamoleException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a collection of connection records associated with all active
|
||||||
|
* connections to which the current user has access. For an administrative
|
||||||
|
* user, this may include connections associated with other users.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* A collection of all connection records associated with active
|
||||||
|
* connections to which the current user has access.
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If an error occurs while reading active connection records, or if
|
||||||
|
* permission is denied.
|
||||||
|
*/
|
||||||
|
Collection<ConnectionRecord> getActiveConnections()
|
||||||
|
throws GuacamoleException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import java.util.UUID;
|
|||||||
import org.glyptodon.guacamole.GuacamoleException;
|
import org.glyptodon.guacamole.GuacamoleException;
|
||||||
import org.glyptodon.guacamole.net.auth.Connection;
|
import org.glyptodon.guacamole.net.auth.Connection;
|
||||||
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
import org.glyptodon.guacamole.net.auth.ConnectionGroup;
|
||||||
|
import org.glyptodon.guacamole.net.auth.ConnectionRecord;
|
||||||
import org.glyptodon.guacamole.net.auth.Directory;
|
import org.glyptodon.guacamole.net.auth.Directory;
|
||||||
import org.glyptodon.guacamole.net.auth.User;
|
import org.glyptodon.guacamole.net.auth.User;
|
||||||
import org.glyptodon.guacamole.net.auth.UserContext;
|
import org.glyptodon.guacamole.net.auth.UserContext;
|
||||||
@@ -167,4 +168,10 @@ public class SimpleUserContext implements UserContext {
|
|||||||
return rootGroup;
|
return rootGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ConnectionRecord> getActiveConnections()
|
||||||
|
throws GuacamoleException {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,11 @@ public class APIConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
private final Date endDate;
|
private final Date endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The host from which the connection originated, if known.
|
||||||
|
*/
|
||||||
|
private final String remoteHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the user who used or is using the connection.
|
* The name of the user who used or is using the connection.
|
||||||
*/
|
*/
|
||||||
@@ -61,10 +66,11 @@ public class APIConnectionRecord {
|
|||||||
* The record to copy data from.
|
* The record to copy data from.
|
||||||
*/
|
*/
|
||||||
public APIConnectionRecord(ConnectionRecord record) {
|
public APIConnectionRecord(ConnectionRecord record) {
|
||||||
this.startDate = record.getStartDate();
|
this.startDate = record.getStartDate();
|
||||||
this.endDate = record.getEndDate();
|
this.endDate = record.getEndDate();
|
||||||
this.username = record.getUsername();
|
this.remoteHost = record.getRemoteHost();
|
||||||
this.active = record.isActive();
|
this.username = record.getUsername();
|
||||||
|
this.active = record.isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +94,16 @@ public class APIConnectionRecord {
|
|||||||
return endDate;
|
return endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the remote host from which this connection originated.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The remote host from which this connection originated.
|
||||||
|
*/
|
||||||
|
public String getRemoteHost() {
|
||||||
|
return remoteHost;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the user who used or is using the connection at the
|
* Returns the name of the user who used or is using the connection at the
|
||||||
* times given by this connection record.
|
* times given by this connection record.
|
||||||
|
@@ -60,6 +60,13 @@ angular.module('rest').factory('ConnectionHistoryEntry', [function defineConnect
|
|||||||
*/
|
*/
|
||||||
this.endDate = template.endDate;
|
this.endDate = template.endDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The remote host that initiated this connection, if known.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
this.remoteHost = template.remoteHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The username of the user associated with this particular usage of
|
* The username of the user associated with this particular usage of
|
||||||
* the connection.
|
* the connection.
|
||||||
|
Reference in New Issue
Block a user