mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
support remove connect user
This commit is contained in:
parent
4915da4cdd
commit
8b89d0b020
4 changed files with 53 additions and 1 deletions
|
@ -79,6 +79,14 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("/Connect/Supporters", "DELETE")]
|
||||||
|
[Authenticated(Roles = "Admin")]
|
||||||
|
public class RemoveConnectSupporter : IReturnVoid
|
||||||
|
{
|
||||||
|
[ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class ConnectService : BaseApiService
|
public class ConnectService : BaseApiService
|
||||||
{
|
{
|
||||||
private readonly IConnectManager _connectManager;
|
private readonly IConnectManager _connectManager;
|
||||||
|
@ -97,6 +105,13 @@ namespace MediaBrowser.Api
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Delete(RemoveConnectSupporter request)
|
||||||
|
{
|
||||||
|
var task = _connectManager.RemoveConnectSupporter(request.Id);
|
||||||
|
|
||||||
|
Task.WaitAll(task);
|
||||||
|
}
|
||||||
|
|
||||||
public object Post(CreateConnectLink request)
|
public object Post(CreateConnectLink request)
|
||||||
{
|
{
|
||||||
return _connectManager.LinkUser(request.Id, request.ConnectUsername);
|
return _connectManager.LinkUser(request.Id, request.ConnectUsername);
|
||||||
|
|
|
@ -75,5 +75,12 @@ namespace MediaBrowser.Controller.Connect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task<ConnectSupporterSummary>.</returns>
|
/// <returns>Task<ConnectSupporterSummary>.</returns>
|
||||||
Task<ConnectSupporterSummary> GetConnectSupporterSummary();
|
Task<ConnectSupporterSummary> GetConnectSupporterSummary();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes the connect supporter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task RemoveConnectSupporter(string id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1085,6 +1085,34 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task RemoveConnectSupporter(string id)
|
||||||
|
{
|
||||||
|
if (!_securityManager.IsMBSupporter)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = GetConnectUrl("keyAssociation");
|
||||||
|
|
||||||
|
url += "?serverId=" + ConnectServerId;
|
||||||
|
url += "&supporterKey=" + _securityManager.SupporterKey;
|
||||||
|
url += "&userId=" + id;
|
||||||
|
|
||||||
|
var options = new HttpRequestOptions
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
CancellationToken = CancellationToken.None
|
||||||
|
};
|
||||||
|
|
||||||
|
SetServerAccessToken(options);
|
||||||
|
SetApplicationHeader(options);
|
||||||
|
|
||||||
|
// No need to examine the response
|
||||||
|
using (var stream = (await _httpClient.SendAsync(options, "DELETE").ConfigureAwait(false)).Content)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Authenticate(string username, string passwordMd5)
|
public async Task Authenticate(string username, string passwordMd5)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(username))
|
if (string.IsNullOrWhiteSpace(username))
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
"ErrorLaunchingChromecast": "There was an error launching chromecast. Please ensure your device is connected to your wireless network.",
|
"ErrorLaunchingChromecast": "There was an error launching chromecast. Please ensure your device is connected to your wireless network.",
|
||||||
"MessageErrorLoadingSupporterInfo": "There was an error loading supporter information. Please try again later.",
|
"MessageErrorLoadingSupporterInfo": "There was an error loading supporter information. Please try again later.",
|
||||||
"MessageLinkYourSupporterKey": "Link your supporter key with up to {0} Media Browser Connect members to enjoy free access to the following apps:",
|
"MessageLinkYourSupporterKey": "Link your supporter key with up to {0} Media Browser Connect members to enjoy free access to the following apps:",
|
||||||
|
"HeaderConfirmRemoveUser": "Remove User",
|
||||||
|
"MessageConfirmRemoveConnectSupporter": "Are you sure you wish to remove the additional supporter benefits from this user?",
|
||||||
"ValueTimeLimitSingleHour": "Time limit: 1 hour",
|
"ValueTimeLimitSingleHour": "Time limit: 1 hour",
|
||||||
"ValueTimeLimitMultiHour": "Time limit: {0} hours",
|
"ValueTimeLimitMultiHour": "Time limit: {0} hours",
|
||||||
"PluginCategoryGeneral": "General",
|
"PluginCategoryGeneral": "General",
|
||||||
|
|
Loading…
Reference in a new issue