Files
WatchedTogether/Jellyfin.Plugin.WatchedTogether/Models/GroupDto.cs
T
dtourolleandClaude Opus 5 27cd2a3d37 Inherit parental restrictions on shared accounts, with a chosen rating cap
A shared account previously inherited its members' library access but
none of their content restrictions, so a child could log into "alice+kid"
with their own password and get around their own rating cap.

The shared account now gets the strictest member's parental rating,
unrated-item block, blocked tags and allowed tags, recomputed at
creation, on membership change and at startup. An admin can raise the
rating cap on a slider between the strictest and the loosest member;
unrated and tag rules stay strictest-wins.

What makes raising the cap safe is the unlock rule: after a member's
password matches, both users' live policies are compared and the login
is refused if the account is looser than the member on any field. So
raising the cap above the child's rating means the child's password no
longer opens the account, while the parent's still does. The same rule
bounds the slider - past the loosest member nobody could unlock the
account - so a chosen cap is clamped back into range whenever applied.

Allowed tags need care: Jellyfin reads an empty list as "no whitelist",
so an empty intersection of members' whitelists is written as a sentinel
tag no item carries. Access schedules and channels are not inherited yet.

The shared account is never an administrator. Groups created at the
login screen always inherit and are restricted before the first session
exists. The dashboard shows each member's cap, who a chosen cap shuts
out, and the restrictions in effect, and gains a per-group edit form for
the sync options.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-19 12:30:50 +02:00

69 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
namespace Jellyfin.Plugin.WatchedTogether.Models;
/// <summary>
/// A configured group, resolved for display.
/// </summary>
public class GroupDto
{
/// <summary>
/// Gets or sets the shared account identifier.
/// </summary>
public Guid SharedUserId { get; set; }
/// <summary>
/// Gets or sets the shared account's username.
/// </summary>
public string SharedUsername { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the group's members.
/// </summary>
public IReadOnlyList<MemberDto> Members { get; set; } = Array.Empty<MemberDto>();
/// <summary>
/// Gets or sets a value indicating whether unwatched state propagates too.
/// </summary>
public bool SyncUnwatched { get; set; }
/// <summary>
/// Gets or sets a value indicating whether play counts are raised on watch.
/// </summary>
public bool SyncPlayCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the group is suspended.
/// </summary>
public bool IsDisabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the rating cap is the strictest member's.
/// </summary>
public bool InheritParentalRating { get; set; } = true;
/// <summary>
/// Gets or sets the chosen rating cap when not inheriting, as Jellyfin's numeric score
/// (<c>null</c> for none).
/// </summary>
public int? ParentalRatingCap { get; set; }
/// <summary>
/// Gets or sets the strictest member's rating cap, or <c>null</c> if no member has one - in
/// which case there is nothing to choose.
/// </summary>
public int? StrictestMemberRating { get; set; }
/// <summary>
/// Gets or sets the loosest member's rating cap, or <c>null</c> if some member has none. The
/// chosen cap can go no looser than this: past it nobody could unlock the account.
/// </summary>
public int? LoosestMemberRating { get; set; }
/// <summary>
/// Gets or sets the restrictions the shared account currently has.
/// </summary>
public RestrictionsDto? Restrictions { get; set; }
}