Skip to content

Commit

Permalink
Merge pull request jellyfin#12700 from elfalem/allowed-tags-private-p…
Browse files Browse the repository at this point in the history
…laylist
  • Loading branch information
crobibero authored Sep 26, 2024
2 parents 75bbd30 + 8499be2 commit bc9594a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4203,6 +4203,15 @@ private List<string> GetWhereClauses(InternalItemsQuery query, SqliteCommand? st
OR (select CleanValue from ItemValues where ItemId=ParentId and Type=6 and CleanValue in ({includedTags})) is not null)
""");
}

// A playlist should be accessible to its owner regardless of allowed tags.
else if (includeTypes.Length == 1 && includeTypes.FirstOrDefault() is BaseItemKind.Playlist)
{
whereClauses.Add($"""
((select CleanValue from ItemValues where ItemId=Guid and Type=6 and CleanValue in ({includedTags})) is not null
OR data like @PlaylistOwnerUserId)
""");
}
else
{
whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)");
Expand All @@ -4214,6 +4223,11 @@ private List<string> GetWhereClauses(InternalItemsQuery query, SqliteCommand? st
{
statement.TryBind(paramName + index, GetCleanValue(query.IncludeInheritedTags[index]));
}

if (query.User is not null)
{
statement.TryBind("@PlaylistOwnerUserId", $"""%"OwnerUserId":"{query.User.Id.ToString("N")}"%""");
}
}
}

Expand Down

0 comments on commit bc9594a

Please sign in to comment.