Filter groups by parental rating

This commit is contained in:
gion 2020-04-05 09:28:55 +02:00
parent e74832d139
commit 73c19bd281

View file

@ -127,18 +127,20 @@ namespace Emby.Server.Implementations.Syncplay
private bool HasAccessToItem(User user, Guid itemId)
{
var item = _libraryManager.GetItemById(itemId);
var hasParentalRatingAccess = user.Policy.MaxParentalRating.HasValue ? item.InheritedParentalRatingValue <= user.Policy.MaxParentalRating : true;
if (!user.Policy.EnableAllFolders)
{
var item = _libraryManager.GetItemById(itemId);
var collections = _libraryManager.GetCollectionFolders(item).Select(
folder => folder.Id.ToString("N", CultureInfo.InvariantCulture)
);
var intersect = collections.Intersect(user.Policy.EnabledFolders);
return intersect.Count() > 0;
return intersect.Count() > 0 && hasParentalRatingAccess;
}
else
{
return true;
return hasParentalRatingAccess;
}
}