diff options
| author | elfalem <elfalem@users.noreply.github.com> | 2025-02-09 12:19:51 -0500 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2025-02-09 12:19:51 -0500 |
| commit | ba46608ffe94a7a52eb7c514d2b71da8474ad585 (patch) | |
| tree | cc61760a7cfbaebf8e2e991e49c3157375d8c71a /MediaBrowser.Controller/Entities/BaseItem.cs | |
| parent | 6922fd0a3848c730de9117f6e4dfd3c0b7e4c8ce (diff) | |
Backport pull request #12721 from jellyfin/release-10.10.z
Skip allowed tags check for parents of an item
Original-merge: d1fbdcee3459c9b8b9f47362761ad8da2021bd93
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index e7aa0fad5..55553da49 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1303,7 +1303,7 @@ namespace MediaBrowser.Controller.Entities return false; } - if (GetParents().Any(i => !i.IsVisible(user))) + if (GetParents().Any(i => !i.IsVisible(user, true))) { return false; } @@ -1525,13 +1525,14 @@ namespace MediaBrowser.Controller.Entities /// Determines if a given user has access to this item. /// </summary> /// <param name="user">The user.</param> + /// <param name="skipAllowedTagsCheck">Don't check for allowed tags.</param> /// <returns><c>true</c> if [is parental allowed] [the specified user]; otherwise, <c>false</c>.</returns> /// <exception cref="ArgumentNullException">If user is null.</exception> - public bool IsParentalAllowed(User user) + public bool IsParentalAllowed(User user, bool skipAllowedTagsCheck) { ArgumentNullException.ThrowIfNull(user); - if (!IsVisibleViaTags(user)) + if (!IsVisibleViaTags(user, skipAllowedTagsCheck)) { return false; } @@ -1603,7 +1604,7 @@ namespace MediaBrowser.Controller.Entities return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); } - private bool IsVisibleViaTags(User user) + private bool IsVisibleViaTags(User user, bool skipAllowedTagsCheck) { var allTags = GetInheritedTags(); if (user.GetPreference(PreferenceKind.BlockedTags).Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase))) @@ -1618,7 +1619,7 @@ namespace MediaBrowser.Controller.Entities } var allowedTagsPreference = user.GetPreference(PreferenceKind.AllowedTags); - if (allowedTagsPreference.Length != 0 && !allowedTagsPreference.Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase))) + if (!skipAllowedTagsCheck && allowedTagsPreference.Length != 0 && !allowedTagsPreference.Any(i => allTags.Contains(i, StringComparison.OrdinalIgnoreCase))) { return false; } @@ -1658,13 +1659,14 @@ namespace MediaBrowser.Controller.Entities /// Default is just parental allowed. Can be overridden for more functionality. /// </summary> /// <param name="user">The user.</param> + /// <param name="skipAllowedTagsCheck">Don't check for allowed tags.</param> /// <returns><c>true</c> if the specified user is visible; otherwise, <c>false</c>.</returns> /// <exception cref="ArgumentNullException"><paramref name="user" /> is <c>null</c>.</exception> - public virtual bool IsVisible(User user) + public virtual bool IsVisible(User user, bool skipAllowedTagsCheck = false) { ArgumentNullException.ThrowIfNull(user); - return IsParentalAllowed(user); + return IsParentalAllowed(user, skipAllowedTagsCheck); } public virtual bool IsVisibleStandalone(User user) |
