added /users/public endpoint

This commit is contained in:
Luke Pulverenti 2013-07-08 13:13:18 -04:00
parent 56eea6a626
commit 1a0a50c8ab
5 changed files with 41 additions and 10 deletions

View File

@ -27,6 +27,12 @@ namespace MediaBrowser.Api
public bool? IsDisabled { get; set; }
}
[Route("/Users/Public", "GET")]
[Api(Description = "Gets a list of publicly visible users for display on a login screen.")]
public class GetPublicUsers : IReturn<List<UserDto>>
{
}
/// <summary>
/// Class GetUser
/// </summary>
@ -187,6 +193,14 @@ namespace MediaBrowser.Api
_libraryManager = libraryManager;
}
public object Get(GetPublicUsers request)
{
return Get(new GetUsers
{
IsHidden = false
});
}
/// <summary>
/// Gets the specified request.
/// </summary>

View File

@ -571,14 +571,8 @@ namespace MediaBrowser.Common.Implementations
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task{CheckForUpdateResult}.</returns>
public virtual async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
var availablePackages = await PackageManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };
}
public abstract Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken,
IProgress<double> progress);
/// <summary>
/// Updates the application.

View File

@ -1,6 +1,8 @@
using MediaBrowser.Api;
using System.Threading;
using MediaBrowser.Api;
using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Constants;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Implementations;
using MediaBrowser.Common.Implementations.ScheduledTasks;
@ -27,6 +29,7 @@ using MediaBrowser.IsoMounter;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Updates;
using MediaBrowser.Providers;
using MediaBrowser.Server.Implementations;
using MediaBrowser.Server.Implementations.BdInfo;
@ -620,5 +623,14 @@ namespace MediaBrowser.ServerApplication
process.WaitForExit();
}
}
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
var availablePackages = await PackageManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };
}
}
}

View File

@ -1429,6 +1429,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
});
};
self.getPublicUsers = function () {
var url = self.getUrl("users/public");
return self.ajax({
type: "GET",
url: url,
dataType: "json"
});
};
/**
* Gets all users from the server
*/

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.138" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.139" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
</packages>