diff options
| author | Patrick Barron <barronpm@gmail.com> | 2020-05-12 22:25:45 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2020-05-13 00:00:57 -0400 |
| commit | b7621d762c58320b35096838ae8ab10d98ea9bb2 (patch) | |
| tree | 895708bda08c4831a8e30e7b0ea7ca7d67da88b8 /Jellyfin.Server.Implementations | |
| parent | c1360a1dc312938e77e52a509eb9186300bcb40d (diff) | |
| parent | bac4bf96a0e642f80f35bd6cdf3de17a9302b6c6 (diff) | |
2nd half of changes
Diffstat (limited to 'Jellyfin.Server.Implementations')
| -rw-r--r-- | Jellyfin.Server.Implementations/JellyfinDb.cs | 10 | ||||
| -rw-r--r-- | Jellyfin.Server.Implementations/User/UserManager.cs | 22 |
2 files changed, 27 insertions, 5 deletions
diff --git a/Jellyfin.Server.Implementations/JellyfinDb.cs b/Jellyfin.Server.Implementations/JellyfinDb.cs index 7e13146902..35003c1ae3 100644 --- a/Jellyfin.Server.Implementations/JellyfinDb.cs +++ b/Jellyfin.Server.Implementations/JellyfinDb.cs @@ -16,10 +16,6 @@ namespace Jellyfin.Server.Implementations public partial class JellyfinDb : DbContext { public virtual DbSet<ActivityLog> ActivityLogs { get; set; } - public virtual DbSet<Group> Groups { get; set; } - public virtual DbSet<Permission> Permissions { get; set; } - public virtual DbSet<Preference> Preferences { get; set; } - public virtual DbSet<ProviderMapping> ProviderMappings { get; set; } public virtual DbSet<Data.Entities.User> Users { get; set; } /*public virtual DbSet<Artwork> Artwork { get; set; } public virtual DbSet<Book> Books { get; set; } @@ -34,6 +30,7 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<Episode> Episodes { get; set; } public virtual DbSet<EpisodeMetadata> EpisodeMetadata { get; set; } public virtual DbSet<Genre> Genres { get; set; } + public virtual DbSet<Group> Groups { get; set; } public virtual DbSet<Library> Libraries { get; set; } public virtual DbSet<LibraryItem> LibraryItems { get; set; } public virtual DbSet<LibraryRoot> LibraryRoot { get; set; } @@ -46,10 +43,13 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<MovieMetadata> MovieMetadata { get; set; } public virtual DbSet<MusicAlbum> MusicAlbums { get; set; } public virtual DbSet<MusicAlbumMetadata> MusicAlbumMetadata { get; set; } + public virtual DbSet<Permission> Permissions { get; set; } public virtual DbSet<Person> People { get; set; } public virtual DbSet<PersonRole> PersonRoles { get; set; } public virtual DbSet<Photo> Photo { get; set; } public virtual DbSet<PhotoMetadata> PhotoMetadata { get; set; } + public virtual DbSet<Preference> Preferences { get; set; } + public virtual DbSet<ProviderMapping> ProviderMappings { get; set; } public virtual DbSet<Rating> Ratings { get; set; } /// <summary> @@ -63,7 +63,7 @@ namespace Jellyfin.Server.Implementations public virtual DbSet<Series> Series { get; set; } public virtual DbSet<SeriesMetadata> SeriesMetadata { get; set; } public virtual DbSet<Track> Tracks { get; set; } - public virtual DbSet<TrackMetadata> TrackMetadata { get; set; } */ + public virtual DbSet<TrackMetadata> TrackMetadata { get; set; }*/ /// <summary> /// Gets or sets the default connection string. diff --git a/Jellyfin.Server.Implementations/User/UserManager.cs b/Jellyfin.Server.Implementations/User/UserManager.cs index 1ed11cfcbb..73905ff70b 100644 --- a/Jellyfin.Server.Implementations/User/UserManager.cs +++ b/Jellyfin.Server.Implementations/User/UserManager.cs @@ -306,6 +306,28 @@ namespace Jellyfin.Server.Implementations.User }; } + public PublicUserDto GetPublicUserDto(Data.Entities.User user, string remoteEndPoint = null) + { + if (user == null) + { + throw new ArgumentNullException(nameof(user)); + } + + bool hasConfiguredPassword = GetAuthenticationProvider(user).HasPassword(user); + bool hasConfiguredEasyPassword = !string.IsNullOrEmpty(GetAuthenticationProvider(user).GetEasyPasswordHash(user)); + + bool hasPassword = user.EnableLocalPassword && + !string.IsNullOrEmpty(remoteEndPoint) && + _networkManager.IsInLocalNetwork(remoteEndPoint) ? hasConfiguredEasyPassword : hasConfiguredPassword; + + return new PublicUserDto + { + Name = user.Username, + HasPassword = hasPassword, + HasConfiguredPassword = hasConfiguredPassword + }; + } + public async Task<Data.Entities.User> AuthenticateUser( string username, string password, |
