소스 검색

fix ipad login issue

Luke Pulverenti 11 년 전
부모
커밋
98012480f7

+ 11 - 1
MediaBrowser.Api/BaseApiService.cs

@@ -125,7 +125,7 @@ namespace MediaBrowser.Api
             return ResultFactory.GetStaticFileResult(Request, path);
         }
 
-        private readonly char[] _dashReplaceChars = new[] { '?', '/' };
+        private readonly char[] _dashReplaceChars = { '?', '/' };
         private const char SlugChar = '-';
 
         protected MusicArtist GetArtist(string name, ILibraryManager libraryManager)
@@ -168,6 +168,11 @@ namespace MediaBrowser.Api
                 {
                     var user = userManager.GetUserById(userId.Value);
 
+                    if (user == null)
+                    {
+                        throw new ArgumentException("User not found");
+                    }
+
                     return folder.GetRecursiveChildren(user);
                 }
 
@@ -177,6 +182,11 @@ namespace MediaBrowser.Api
             {
                 var user = userManager.GetUserById(userId.Value);
 
+                if (user == null)
+                {
+                    throw new ArgumentException("User not found");
+                }
+
                 return userManager.GetUserById(userId.Value).RootFolder.GetRecursiveChildren(user);
             }
 

+ 17 - 0
MediaBrowser.Api/UserService.cs

@@ -357,6 +357,23 @@ namespace MediaBrowser.Api
         {
             var auth = AuthorizationContext.GetAuthorizationInfo(Request);
 
+            if (string.IsNullOrWhiteSpace(auth.Client))
+            {
+                auth.Client = "Unknown app";
+            }
+            if (string.IsNullOrWhiteSpace(auth.Device))
+            {
+                auth.Device = "Unknown device";
+            }
+            if (string.IsNullOrWhiteSpace(auth.Version))
+            {
+                auth.Version = "Unknown version";
+            }
+            if (string.IsNullOrWhiteSpace(auth.DeviceId))
+            {
+                auth.DeviceId = "Unknown device id";
+            }
+
             var result = _sessionMananger.AuthenticateNewSession(request.Username, request.Password, auth.Client, auth.Version,
                         auth.DeviceId, auth.Device, Request.RemoteIp, Request.IsLocal).Result;
 

+ 3 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -21,12 +21,13 @@ namespace MediaBrowser.Controller.Entities
     /// <summary>
     /// Class Folder
     /// </summary>
-    public class Folder : BaseItem, IHasThemeMedia
+    public class Folder : BaseItem, IHasThemeMedia, IHasTags
     {
         public static IUserManager UserManager { get; set; }
 
         public List<Guid> ThemeSongIds { get; set; }
         public List<Guid> ThemeVideoIds { get; set; }
+        public List<string> Tags { get; set; }
 
         public Folder()
         {
@@ -34,6 +35,7 @@ namespace MediaBrowser.Controller.Entities
 
             ThemeSongIds = new List<Guid>();
             ThemeVideoIds = new List<Guid>();
+            Tags = new List<string>();
         }
 
         /// <summary>

+ 8 - 1
MediaBrowser.Controller/Entities/Studio.cs

@@ -7,8 +7,15 @@ namespace MediaBrowser.Controller.Entities
     /// <summary>
     /// Class Studio
     /// </summary>
-    public class Studio : BaseItem, IItemByName
+    public class Studio : BaseItem, IItemByName, IHasTags
     {
+        public List<string> Tags { get; set; }
+
+        public Studio()
+        {
+            Tags = new List<string>();
+        }
+        
         /// <summary>
         /// Gets the user data key.
         /// </summary>

+ 6 - 0
MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs

@@ -66,6 +66,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
                 ? null
                 : UserManager.GetUserById(new Guid(auth.UserId));
 
+            if (user == null & !string.IsNullOrWhiteSpace(auth.UserId))
+            {
+                // TODO: Re-enable
+                //throw new ArgumentException("User with Id " + auth.UserId + " not found");
+            }
+
             if (user != null && user.Configuration.IsDisabled)
             {
                 throw new UnauthorizedAccessException("User account has been disabled.");