mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-394: Automatically update the end time of user history records upon logout.
This commit is contained in:
@@ -27,6 +27,11 @@ import java.util.Date;
|
||||
*/
|
||||
public class ActivityRecordModel {
|
||||
|
||||
/**
|
||||
* The ID of this object in the database, if any.
|
||||
*/
|
||||
private Integer recordID;
|
||||
|
||||
/**
|
||||
* The database ID of the user associated with this activity record.
|
||||
*/
|
||||
@@ -53,6 +58,27 @@ public class ActivityRecordModel {
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* Returns the ID of this record in the database, if it exists.
|
||||
*
|
||||
* @return
|
||||
* The ID of this record in the database, or null if this record was
|
||||
* not retrieved from the database.
|
||||
*/
|
||||
public Integer getRecordID() {
|
||||
return recordID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the database ID of this record to the given value.
|
||||
*
|
||||
* @param recordID
|
||||
* The ID to assign to this object.
|
||||
*/
|
||||
public void setRecordID(Integer recordID) {
|
||||
this.recordID = recordID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the database ID of the user associated with this activity
|
||||
* record.
|
||||
|
@@ -231,7 +231,11 @@ public class ModeledUserContext extends RestrictedObject
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
// Nothing to invalidate
|
||||
|
||||
// Record logout time
|
||||
userRecord.setEndDate(new Date());
|
||||
userRecordMapper.update(userRecord);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -56,6 +56,17 @@ public interface UserRecordMapper {
|
||||
*/
|
||||
int insert(@Param("record") ActivityRecordModel record);
|
||||
|
||||
/**
|
||||
* Updates the given user login record.
|
||||
*
|
||||
* @param record
|
||||
* The user login record to update.
|
||||
*
|
||||
* @return
|
||||
* The number of rows updated.
|
||||
*/
|
||||
int update(@Param("record") ActivityRecordModel record);
|
||||
|
||||
/**
|
||||
* Searches for up to <code>limit</code> user login records that contain
|
||||
* the given terms, sorted by the given predicates, regardless of whether
|
||||
|
Reference in New Issue
Block a user