NAME
Kernel::System::UserActivity – Management object for user activity records.
DESCRIPTION
This class takes care about handling user activity records, that are used to track user actions on the business objects in the frontend. It is possible to add, list and delete those records.
PUBLIC INTERFACE
MethodParamValidationSchema()
Add the param validation schema for the push event modules.
Register()
Creates a new user activity record in the database.
my $Success = $UserActivityObject->Register(
BusinessObjectType => 'Ticket', # required
BusinessObjectID => 123, # required
UserType => 'agent', # required
UserID => 123, # required
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e', # required
);
Returns 1, if the insertion was successful or undef in case of errors.
List()
Lists all currently registered user activity records, based on filter criteria.
my $UserActivity = $UserActivityObject->List(
BusinessObjectType => 'Ticket', # optional, filter for business object type.
BusinessObjectID => 123, # optional, filter for business object id.
BusinessObjectIDs => [ 123 ], # optional, filter for business object ids.
UserType => 'agent', # optional, filter for user type ('agent' or 'customer').
UserID => 123, # optional, filter for user id.
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e', # optional, filter for front end client ID.
ExpireTimeLowerThan => '2019-04-04', # optional, filter for expire time lower than.
);
If no filter parameter was passed, the method will return an empty list.
Returns:
[
{
ID => 123,
BusinessObjectType => 'Ticket',
BusinessObjectID => 123,
UserType => 'agent',
UserID => 123,
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e',
ExpireTime => '2019-04-08 12:00:00',
},
...
];
Deregister()
Removes an existing user activity record from the database.
my $Success = $UserActivityObject->Deregister(
BusinessObjectType => 'Ticket', # optional
BusinessObjectID => 123, # optional
UserType => 'agent', # optional
UserID => 123, # optional
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e', # optional
);
If no filter parameter was passed, the method won't remove any entries.
Returns 1, if the deletion was successful or undef in case of errors.
CleanupExpired()
Cleans up all expired user activity records.
my $Success = $UserActivityObject->CleanupExpired();
Returns 1 if expired user activity records were cleaned up successfully.
PRIVATE INTERFACE
_Add()
Adds a new user activity record.
my $Success = $UserActivityObject->_Add(
BusinessObjectType => 'Ticket', # mandatory
BusinessObjectID => 123, # mandatory
UserType => 'agent', # mandatory
UserID => 123, # mandatory
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e', # mandatory
);
Returns 1 in case of success, undef in case of errors.
_Update()
Update a user activity record, based on filter criteria.
my $Success = $UserActivityObject->_Update(
BusinessObjectType => 'Ticket', # mandatory
BusinessObjectID => 123, # mandatory
UserType => 'agent', # mandatory
UserID => 123, # mandatory
FrontendClientID => '846ba13b-367a-11e9-ab58-eec271d3f95e', # mandatory
);
Returns 1 in case of success, undef in case of errors.
_GetExpiryTime()
Generated the expiry time for the user activity records.
my $ExpiryTimeString = $UserActivityObject->_GetExpiryTime();
Returns
$ExpiryTimeString = '2019-04-13 12:05:00';
_BuildFilterConditions()
Generated filter conditions for user activity records matching.
my $FilterConditions = $UserActivityObject->_BuildFilterConditions(
BusinessObjectType => 'Ticket', # optional
BusinessObjectID => '123', # optional
UserType => 'customer', # optional
UserID => 123, # optional
FrontendClientID => 'fc8251ce-5aac-11e9-9417-a1a8cb694e84', # optional
);
Returns
{
SQL => 'bo_type = ? AND bo_id = ? AND user_type = ? AND user_id = ? AND frontend_client_id = ?'
Bind => [
\'Ticket',
\123,
\'customer',
\'123',
\'fc8251ce-5aac-11e9-9417-a1a8cb694e84'
],
}