mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-462: Add API-level support for associating data with history records.
This commit is contained in:
@@ -401,14 +401,7 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the UUID of the underlying tunnel. If there is no underlying
|
||||
* tunnel, this will be the UUID assigned to the underlying tunnel when the
|
||||
* tunnel is set.
|
||||
*
|
||||
* @return
|
||||
* The current or future UUID of the underlying tunnel.
|
||||
*/
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
@@ -19,13 +19,16 @@
|
||||
|
||||
package org.apache.guacamole.net.auth;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A logging record describing when a user started and ended a particular
|
||||
* activity.
|
||||
*/
|
||||
public interface ActivityRecord {
|
||||
public interface ActivityRecord extends ReadableAttributes {
|
||||
|
||||
/**
|
||||
* Returns the date and time the activity began.
|
||||
@@ -75,4 +78,23 @@ public interface ActivityRecord {
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/**
|
||||
* Returns a UUID that uniquely identifies this record. If provided, this
|
||||
* UUID MUST be deterministic and unique across all {@link ActivityRecord}
|
||||
* objects within the same {@link ActivityRecordSet}, and SHOULD be unique
|
||||
* across all {@link ActivityRecord} objects.
|
||||
*
|
||||
* @return
|
||||
* A UUID that uniquely identifies this record, or null if no such
|
||||
* unique identifier exists.
|
||||
*/
|
||||
public default UUID getUUID() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public default Map<String, String> getAttributes() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
|
||||
package org.apache.guacamole.net.auth;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A logging record describing when a user started and ended usage of a
|
||||
* particular connection.
|
||||
@@ -70,4 +72,15 @@ public interface ConnectionRecord extends ActivityRecord {
|
||||
*/
|
||||
public String getSharingProfileName();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>If implemented, this UUID SHOULD be identical to the UUID of the
|
||||
* {@link GuacamoleTunnel} originally returned when the connection was
|
||||
* established to allow extensions and/or the web application to
|
||||
* automatically associate connection information with corresponding
|
||||
* history records, such as log messages and session recordings.
|
||||
*/
|
||||
@Override
|
||||
public UUID getUUID();
|
||||
|
||||
}
|
||||
|
@@ -20,6 +20,8 @@
|
||||
package org.apache.guacamole.rest.history;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.guacamole.net.auth.ActivityRecord;
|
||||
|
||||
/**
|
||||
@@ -55,6 +57,24 @@ public class APIActivityRecord {
|
||||
*/
|
||||
private final boolean active;
|
||||
|
||||
/**
|
||||
* The unique identifier assigned to this record, or null if this record
|
||||
* has no such identifier.
|
||||
*/
|
||||
private final String identifier;
|
||||
|
||||
/**
|
||||
* A UUID that uniquely identifies this record, or null if no such unique
|
||||
* identifier exists.
|
||||
*/
|
||||
private final UUID uuid;
|
||||
|
||||
/**
|
||||
* A map of all attribute identifiers to their corresponding values, for
|
||||
* all attributes associated with this record.
|
||||
*/
|
||||
private final Map<String, String> attributes;
|
||||
|
||||
/**
|
||||
* Creates a new APIActivityRecord, copying the data from the given activity
|
||||
* record.
|
||||
@@ -68,6 +88,8 @@ public class APIActivityRecord {
|
||||
this.remoteHost = record.getRemoteHost();
|
||||
this.username = record.getUsername();
|
||||
this.active = record.isActive();
|
||||
this.uuid = record.getUUID();
|
||||
this.attributes = record.getAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,4 +150,27 @@ public class APIActivityRecord {
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a UUID that uniquely identifies this record. If not implemented
|
||||
* by the extension exposing this history record, this may be null.
|
||||
*
|
||||
* @return
|
||||
* A UUID that uniquely identifies this record, or null if no such
|
||||
* unique identifier exists.
|
||||
*/
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all attributes associated with this record.
|
||||
*
|
||||
* @return
|
||||
* A map of all attribute identifiers to their corresponding values,
|
||||
* for all attributes associated with this record.
|
||||
*/
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user