Merge pull request #11220 from Shadowghost/add-playlist-acl-api

Add playlist ACL endpoints
This commit is contained in:
Joshua M. Boniface
2024-04-10 12:52:01 -04:00
committed by GitHub
18 changed files with 663 additions and 146 deletions

View File

@@ -1,4 +1,6 @@
namespace MediaBrowser.Model.Entities;
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Interface for access to shares.
@@ -8,5 +10,5 @@ public interface IHasShares
/// <summary>
/// Gets or sets the shares.
/// </summary>
Share[] Shares { get; set; }
IReadOnlyList<PlaylistUserPermissions> Shares { get; set; }
}

View File

@@ -0,0 +1,30 @@
using System;
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class to hold data on user permissions for playlists.
/// </summary>
public class PlaylistUserPermissions
{
/// <summary>
/// Initializes a new instance of the <see cref="PlaylistUserPermissions"/> class.
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="canEdit">Edit permission.</param>
public PlaylistUserPermissions(Guid userId, bool canEdit = false)
{
UserId = userId;
CanEdit = canEdit;
}
/// <summary>
/// Gets or sets the user id.
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user has edit permissions.
/// </summary>
public bool CanEdit { get; set; }
}

View File

@@ -1,17 +0,0 @@
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class to hold data on sharing permissions.
/// </summary>
public class Share
{
/// <summary>
/// Gets or sets the user id.
/// </summary>
public string? UserId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user has edit permissions.
/// </summary>
public bool CanEdit { get; set; }
}

View File

@@ -18,7 +18,7 @@ public class PlaylistCreationRequest
/// <summary>
/// Gets or sets the list of items.
/// </summary>
public IReadOnlyList<Guid> ItemIdList { get; set; } = Array.Empty<Guid>();
public IReadOnlyList<Guid> ItemIdList { get; set; } = [];
/// <summary>
/// Gets or sets the media type.
@@ -31,7 +31,12 @@ public class PlaylistCreationRequest
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the shares.
/// Gets or sets the user permissions.
/// </summary>
public Share[]? Shares { get; set; }
public IReadOnlyList<PlaylistUserPermissions> Users { get; set; } = [];
/// <summary>
/// Gets or sets a value indicating whether the playlist is public.
/// </summary>
public bool? Public { get; set; } = true;
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Playlists;
/// <summary>
/// A playlist update request.
/// </summary>
public class PlaylistUpdateRequest
{
/// <summary>
/// Gets or sets the id of the playlist.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the id of the user updating the playlist.
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the name of the playlist.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets item ids to add to the playlist.
/// </summary>
public IReadOnlyList<Guid>? Ids { get; set; }
/// <summary>
/// Gets or sets the playlist users.
/// </summary>
public IReadOnlyList<PlaylistUserPermissions>? Users { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the playlist is public.
/// </summary>
public bool? Public { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System;
namespace MediaBrowser.Model.Playlists;
/// <summary>
/// A playlist user update request.
/// </summary>
public class PlaylistUserUpdateRequest
{
/// <summary>
/// Gets or sets the id of the playlist.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the id of the updated user.
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the user can edit the playlist.
/// </summary>
public bool? CanEdit { get; set; }
}