mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-1123: Implement new methods for retrieving user and connection history.
This commit is contained in:
		| @@ -26,6 +26,7 @@ import java.util.Map; | ||||
| import org.apache.guacamole.GuacamoleException; | ||||
| import org.apache.guacamole.net.auth.permission.ObjectPermissionSet; | ||||
| import org.apache.guacamole.net.auth.permission.SystemPermissionSet; | ||||
| import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet; | ||||
|  | ||||
| /** | ||||
|  * Base implementation of User which provides default implementations of | ||||
| @@ -96,6 +97,12 @@ public abstract class AbstractUser extends AbstractIdentifiable | ||||
|     public List<ActivityRecord> getHistory() throws GuacamoleException { | ||||
|         return Collections.emptyList(); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|     public ActivityRecordSet<ActivityRecord> getUserHistory() | ||||
|             throws GuacamoleException { | ||||
|         return new SimpleActivityRecordSet<>(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * {@inheritDoc} | ||||
|   | ||||
| @@ -109,6 +109,24 @@ public interface Connection extends Identifiable, Connectable, Attributes { | ||||
|      */ | ||||
|     public List<? extends ConnectionRecord> getHistory() throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns an ActivityRecordSet containing ConnectionRecords that | ||||
|      * represent the usage history of this Connection, including any active | ||||
|      * users. ConnectionRecords in this list will be sorted in descending order | ||||
|      * of end time (active connections are first), and then in descending order | ||||
|      * of start time (newer connections are first). | ||||
|      *  | ||||
|      * @return | ||||
|      *     An ActivityRecordSet containing ConnectionRecords representing the | ||||
|      *     usage history of this Connection. | ||||
|      *  | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs retrieving history for this Connection, or if | ||||
|      *     permission to retrieve the history is denied. | ||||
|      */ | ||||
|     public ActivityRecordSet<ConnectionRecord> getConnectionHistory() | ||||
|             throws GuacamoleException; | ||||
|      | ||||
|     /** | ||||
|      * Returns identifiers of all readable sharing profiles that can be used to | ||||
|      * join this connection when it is active. The level of access granted to a | ||||
|   | ||||
| @@ -139,6 +139,12 @@ public class DelegatingConnection implements Connection { | ||||
|             throws GuacamoleException { | ||||
|         return connection.getHistory(); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|     public ActivityRecordSet<ConnectionRecord> getConnectionHistory() | ||||
|             throws GuacamoleException { | ||||
|         return connection.getConnectionHistory(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Set<String> getSharingProfileIdentifiers() | ||||
|   | ||||
| @@ -98,6 +98,12 @@ public class DelegatingUser implements User { | ||||
|             throws GuacamoleException { | ||||
|         return user.getHistory(); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|     public ActivityRecordSet<ActivityRecord> getUserHistory() | ||||
|             throws GuacamoleException { | ||||
|         return user.getUserHistory(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public SystemPermissionSet getSystemPermissions() | ||||
|   | ||||
| @@ -104,6 +104,24 @@ public interface User extends Identifiable, Attributes, Permissions { | ||||
|      *     permission is denied. | ||||
|      */ | ||||
|     List<? extends ActivityRecord> getHistory() throws GuacamoleException; | ||||
|      | ||||
|     /** | ||||
|      * Returns an ActivityRecordSet containing ActivityRecords representing | ||||
|      * the login history for this user, including any active sessions. | ||||
|      * ActivityRecords in this list will be sorted in descending order of end | ||||
|      * time (active sessions are first), and then in descending order of start | ||||
|      * time (newer sessions are first). | ||||
|      *  | ||||
|      * @return | ||||
|      *     An ActivityRecordSet containing ActivityRecords representing the | ||||
|      *     login history for this user. | ||||
|      *  | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs retrieving this user's login history, or if | ||||
|      *     permission to retrieve login history is denied. | ||||
|      */ | ||||
|     public ActivityRecordSet<ActivityRecord> getUserHistory() | ||||
|             throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns a set of all readable user groups of which this user is a member. | ||||
|   | ||||
| @@ -33,6 +33,7 @@ import org.apache.guacamole.net.InetGuacamoleSocket; | ||||
| import org.apache.guacamole.net.SSLGuacamoleSocket; | ||||
| import org.apache.guacamole.net.SimpleGuacamoleTunnel; | ||||
| import org.apache.guacamole.net.auth.AbstractConnection; | ||||
| import org.apache.guacamole.net.auth.ActivityRecordSet; | ||||
| import org.apache.guacamole.net.auth.ConnectionRecord; | ||||
| import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration; | ||||
| import org.apache.guacamole.protocol.ConfiguredGuacamoleSocket; | ||||
| @@ -288,5 +289,11 @@ public class SimpleConnection extends AbstractConnection { | ||||
|     public List<ConnectionRecord> getHistory() throws GuacamoleException { | ||||
|         return Collections.<ConnectionRecord>emptyList(); | ||||
|     } | ||||
|      | ||||
|     @Override | ||||
|     public ActivityRecordSet<ConnectionRecord> getConnectionHistory() | ||||
|             throws GuacamoleException { | ||||
|         return new SimpleActivityRecordSet<>(); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user