aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/BaseApiService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-09 13:38:02 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-09 13:38:02 -0400
commite1f8c18b516f5bd31f64b8faaa53266a3daddd7a (patch)
treeb7f3212a71d19dfd99f44d50ba1fa85aa8e81b6b /MediaBrowser.Api/BaseApiService.cs
parentf57cec4cff8feff70e62056549ea19bbd6a8316c (diff)
added ability to track web sockets per session
Diffstat (limited to 'MediaBrowser.Api/BaseApiService.cs')
-rw-r--r--MediaBrowser.Api/BaseApiService.cs17
1 files changed, 15 insertions, 2 deletions
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs
index 0c95f6112..17c36254e 100644
--- a/MediaBrowser.Api/BaseApiService.cs
+++ b/MediaBrowser.Api/BaseApiService.cs
@@ -1,5 +1,7 @@
using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Logging;
using ServiceStack.Common.Web;
using ServiceStack.ServiceHost;
@@ -100,6 +102,8 @@ namespace MediaBrowser.Api
/// <value>The user manager.</value>
public IUserManager UserManager { get; set; }
+ public ISessionManager SessionManager { get; set; }
+
/// <summary>
/// Gets or sets the logger.
/// </summary>
@@ -122,11 +126,20 @@ namespace MediaBrowser.Api
{
var userId = auth["UserId"];
+ User user = null;
+
if (!string.IsNullOrEmpty(userId))
{
- var user = UserManager.GetUserById(new Guid(userId));
+ user = UserManager.GetUserById(new Guid(userId));
+ }
- UserManager.LogUserActivity(user, auth["Client"], auth["DeviceId"], auth["Device"] ?? string.Empty);
+ var deviceId = auth["DeviceId"];
+ var device = auth["Device"];
+ var client = auth["Client"];
+
+ if (!string.IsNullOrEmpty(client) && !string.IsNullOrEmpty(deviceId) && !string.IsNullOrEmpty(device))
+ {
+ SessionManager.LogConnectionActivity(client, deviceId, device, user);
}
}
}