فهرست منبع

Forces respecting IsVisible on people

LogicalPhallacy 2 سال پیش
والد
کامیت
de196a7687

+ 6 - 2
Emby.Server.Implementations/Dto/DtoService.cs

@@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.Dto
 
             if (options.ContainsField(ItemFields.People))
             {
-                AttachPeople(dto, item);
+                AttachPeople(dto, item, user);
             }
 
             if (options.ContainsField(ItemFields.PrimaryImageAspectRatio))
@@ -503,7 +503,8 @@ namespace Emby.Server.Implementations.Dto
         /// </summary>
         /// <param name="dto">The dto.</param>
         /// <param name="item">The item.</param>
-        private void AttachPeople(BaseItemDto dto, BaseItem item)
+        /// <param name="user">The requesting user.</param>
+        private void AttachPeople(BaseItemDto dto, BaseItem item, User user = null)
         {
             // Ordering by person type to ensure actors and artists are at the front.
             // This is taking advantage of the fact that they both begin with A
@@ -560,6 +561,9 @@ namespace Emby.Server.Implementations.Dto
                         return null;
                     }
                 }).Where(i => i != null)
+                .Where(i => user == null ?
+                    true :
+                    i.IsVisible(user))
                 .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
                 .Select(x => x.First())
                 .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);

+ 6 - 2
Emby.Server.Implementations/Library/LibraryManager.cs

@@ -2766,7 +2766,8 @@ namespace Emby.Server.Implementations.Library
 
         public List<Person> GetPeopleItems(InternalPeopleQuery query)
         {
-            return _itemRepository.GetPeopleNames(query).Select(i =>
+            return _itemRepository.GetPeopleNames(query)
+            .Select(i =>
             {
                 try
                 {
@@ -2777,7 +2778,10 @@ namespace Emby.Server.Implementations.Library
                     _logger.LogError(ex, "Error getting person");
                     return null;
                 }
-            }).Where(i => i != null).ToList();
+            })
+            .Where(i => i.IsVisible(query.User))
+            .Where(i => i != null)
+            .ToList();
         }
 
         public List<string> GetPeopleNames(InternalPeopleQuery query)

+ 4 - 1
Jellyfin.Api/Controllers/PersonsController.cs

@@ -98,7 +98,10 @@ namespace Jellyfin.Api.Controllers
                 Limit = limit ?? 0
             });
 
-            return new QueryResult<BaseItemDto>(peopleItems.Select(person => _dtoService.GetItemByNameDto(person, dtoOptions, null, user)).ToArray());
+            return new QueryResult<BaseItemDto>(
+                peopleItems
+                .Select(person => _dtoService.GetItemByNameDto(person, dtoOptions, null, user))
+                .ToArray());
         }
 
         /// <summary>