GUACAMOLE-394: Add getLastActive() function, returning the time that a user/connection was last logged-in / used.

This commit is contained in:
Michael Jumper
2017-09-11 18:49:11 -07:00
parent b61f14e4db
commit 3cd7f453c0
10 changed files with 75 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
package org.apache.guacamole.net.auth;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -102,6 +103,18 @@ public interface Connection extends Identifiable, Connectable {
*/
void setAttributes(Map<String, String> attributes);
/**
* Returns the date and time that this connection was last used. If the
* connection was never used, the time that the connection was last used is
* unknown, or this information is not visible to the current user, this
* may be null.
*
* @return
* The date and time this connection was last used, or null if this
* information is unavailable or inapplicable.
*/
Date getLastActive();
/**
* Returns a list of ConnectionRecords representing the usage history
* of this Connection, including any active users. ConnectionRecords

View File

@@ -19,6 +19,7 @@
package org.apache.guacamole.net.auth;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.guacamole.GuacamoleException;
@@ -101,6 +102,17 @@ public interface User extends Identifiable {
*/
void setAttributes(Map<String, String> attributes);
/**
* Returns the date and time that this user was last active. If the user
* was never active, the time that the user was last active is unknown, or
* this information is not visible to the current user, this may be null.
*
* @return
* The date and time this user was last active, or null if this
* information is unavailable or inapplicable.
*/
Date getLastActive();
/**
* Returns a list of ActivityRecords representing the login history
* of this user, including any active sessions. ActivityRecords

View File

@@ -20,6 +20,7 @@
package org.apache.guacamole.net.auth.simple;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.guacamole.GuacamoleException;
@@ -136,6 +137,11 @@ public class SimpleConnection extends AbstractConnection {
}
@Override
public Date getLastActive() {
return null;
}
@Override
public List<ConnectionRecord> getHistory() throws GuacamoleException {
return Collections.<ConnectionRecord>emptyList();

View File

@@ -21,6 +21,7 @@ package org.apache.guacamole.net.auth.simple;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -165,6 +166,11 @@ public class SimpleUser extends AbstractUser {
// Do nothing - there are no attributes
}
@Override
public Date getLastActive() {
return null;
}
@Override
public List<ActivityRecord> getHistory() throws GuacamoleException {
return Collections.<ActivityRecord>emptyList();