aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Data/SqliteItemRepository.cs
diff options
context:
space:
mode:
authorelfalem <elfalem@gmail.com>2024-09-23 18:52:18 -0400
committerelfalem <elfalem@gmail.com>2024-09-23 18:52:18 -0400
commitdafd1864104afe8d9bb8f20cf8bf40931a0417f1 (patch)
tree682f043de3cc3a4c622fed61179083f95e3c9d3e /Emby.Server.Implementations/Data/SqliteItemRepository.cs
parentcb8f01065a03a5ba546c1ff33c7452d81c32da62 (diff)
Ensure user's own playlists are accessible regardless of allowed tags
Diffstat (limited to 'Emby.Server.Implementations/Data/SqliteItemRepository.cs')
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 60f5ee47a..5598c81dc 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -4203,6 +4203,15 @@ namespace Emby.Server.Implementations.Data
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)");
@@ -4214,6 +4223,11 @@ namespace Emby.Server.Implementations.Data
{
statement.TryBind(paramName + index, GetCleanValue(query.IncludeInheritedTags[index]));
}
+
+ if (query.User != null)
+ {
+ statement.TryBind("@PlaylistOwnerUserId", $"""%"OwnerUserId":"{query.User.Id.ToString("N")}"%""");
+ }
}
}