mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Initial impliementation of #739
This commit is contained in:
parent
88c0651b1e
commit
973688393f
18 changed files with 624 additions and 21 deletions
|
@ -94,34 +94,23 @@ namespace Ombi.Core
|
|||
/// Gets the username this could be the alias! We should always use this method when getting the username
|
||||
/// </summary>
|
||||
/// <param name="username">The username.</param>
|
||||
/// <returns><c>null</c> if we cannot find a user</returns>
|
||||
/// <param name="session"></param>
|
||||
/// <returns>
|
||||
/// <c>null</c> if we cannot find a user
|
||||
/// </returns>
|
||||
public string GetUsername(string username, ISession session)
|
||||
{
|
||||
var plexUser = PlexUsers.GetUserByUsername(username);
|
||||
if (plexUser != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(plexUser.UserAlias))
|
||||
{
|
||||
return plexUser.UserAlias;
|
||||
}
|
||||
else
|
||||
{
|
||||
return plexUser.Username;
|
||||
}
|
||||
return !string.IsNullOrEmpty(plexUser.UserAlias) ? plexUser.UserAlias : plexUser.Username;
|
||||
}
|
||||
|
||||
var dbUser = UserRepository.GetUserByUsername(username);
|
||||
if (dbUser != null)
|
||||
{
|
||||
var userProps = ByteConverterHelper.ReturnObject<UserProperties>(dbUser.UserProperties);
|
||||
if (!string.IsNullOrEmpty(userProps.UserAlias))
|
||||
{
|
||||
return userProps.UserAlias;
|
||||
}
|
||||
else
|
||||
{
|
||||
return dbUser.UserName;
|
||||
}
|
||||
return !string.IsNullOrEmpty(userProps.UserAlias) ? userProps.UserAlias : dbUser.UserName;
|
||||
}
|
||||
|
||||
// could be a local user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue