diff options
| author | gion <oancaionutandrei@gmail.com> | 2020-05-15 18:59:35 +0200 |
|---|---|---|
| committer | gion <oancaionutandrei@gmail.com> | 2020-05-15 18:59:35 +0200 |
| commit | 029bb80910688cb4a0278dec949926efd5602258 (patch) | |
| tree | d835ed8a4f6ee890c7da39f3aced53b995b77f33 /Emby.Server.Implementations/Library/UserManager.cs | |
| parent | e8f45248aab753797ee9b2e3d8d58c2a243fc598 (diff) | |
| parent | 18953d95e6692290bf56547d4c9614790687654c (diff) | |
Merge remote-tracking branch 'upstream/master' into syncplay
Diffstat (limited to 'Emby.Server.Implementations/Library/UserManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/UserManager.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index d63bc6bda..b8feb5535 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -608,6 +608,31 @@ namespace Emby.Server.Implementations.Library return dto; } + public PublicUserDto GetPublicUserDto(User user, string remoteEndPoint = null) + { + if (user == null) + { + throw new ArgumentNullException(nameof(user)); + } + + IAuthenticationProvider authenticationProvider = GetAuthenticationProvider(user); + bool hasConfiguredPassword = authenticationProvider.HasPassword(user); + bool hasConfiguredEasyPassword = !string.IsNullOrEmpty(authenticationProvider.GetEasyPasswordHash(user)); + + bool hasPassword = user.Configuration.EnableLocalPassword && + !string.IsNullOrEmpty(remoteEndPoint) && + _networkManager.IsInLocalNetwork(remoteEndPoint) ? hasConfiguredEasyPassword : hasConfiguredPassword; + + PublicUserDto dto = new PublicUserDto + { + Name = user.Name, + HasPassword = hasPassword, + HasConfiguredPassword = hasConfiguredPassword, + }; + + return dto; + } + public UserDto GetOfflineUserDto(User user) { var dto = GetUserDto(user); |
