mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Fixed #1252 (Show the correct user type on the management page for Plex Users)
Fixed #1261 (User login time not being populated)
This commit is contained in:
parent
f7926f13b5
commit
4e817b5aaa
5 changed files with 30 additions and 32 deletions
|
@ -63,7 +63,9 @@ namespace Ombi.Core.Users
|
|||
Username = localUsers.UserName,
|
||||
UserAlias = props.UserAlias,
|
||||
EmailAddress = props.EmailAddress,
|
||||
Permissions = (Permissions) localUsers.Permissions
|
||||
Permissions = (Permissions) localUsers.Permissions,
|
||||
UserId = localUsers.UserGuid,
|
||||
Features = (Features)localUsers.Features
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -76,7 +78,10 @@ namespace Ombi.Core.Users
|
|||
Username = plexUsers.Username,
|
||||
UserAlias = plexUsers.UserAlias,
|
||||
EmailAddress = plexUsers.EmailAddress,
|
||||
Permissions = (Permissions)plexUsers.Permissions
|
||||
Permissions = (Permissions)plexUsers.Permissions,
|
||||
UserId = plexUsers.PlexUserId,
|
||||
|
||||
Features = (Features)plexUsers.Features
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -89,7 +94,9 @@ namespace Ombi.Core.Users
|
|||
Username = embyUsers.Username,
|
||||
UserAlias = embyUsers.UserAlias,
|
||||
EmailAddress = embyUsers.EmailAddress,
|
||||
Permissions = (Permissions)embyUsers.Permissions
|
||||
Permissions = (Permissions)embyUsers.Permissions,
|
||||
UserId = embyUsers.EmbyUserId,
|
||||
Features = (Features)embyUsers.Features
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace Ombi.Core.Users
|
|||
public Features Features { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
public UserType Type { get; set; }
|
||||
public string UserId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string UsernameOrAlias => string.IsNullOrEmpty(UserAlias) ? Username : UserAlias;
|
||||
|
|
|
@ -49,7 +49,7 @@ using PlexMediaType = Ombi.Store.Models.Plex.PlexMediaType;
|
|||
|
||||
namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
||||
{
|
||||
public class
|
||||
public class
|
||||
PlexRecentlyAddedNewsletter : HtmlTemplateGenerator, IPlexNewsletter
|
||||
{
|
||||
public PlexRecentlyAddedNewsletter(IPlexApi api, ISettingsService<PlexSettings> plexSettings,
|
||||
|
@ -168,7 +168,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
|||
recentlyAddedModel.Add(new PlexRecentlyAddedModel
|
||||
{
|
||||
Metadata = i,
|
||||
EpisodeMetadata = new List<PlexEpisodeMetadata>() {episodeInfo},
|
||||
EpisodeMetadata = new List<PlexEpisodeMetadata>() { episodeInfo },
|
||||
Content = relatedSeries
|
||||
});
|
||||
}
|
||||
|
@ -186,33 +186,12 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
|||
continue;
|
||||
|
||||
}
|
||||
//var ep = filteredEp.Where(x => x.ShowTitle == t.Title);
|
||||
|
||||
if (filteredEp.Any())
|
||||
info.Add(new PlexRecentlyAddedModel
|
||||
{
|
||||
var episodeList = new List<PlexEpisodeMetadata>();
|
||||
foreach (var ep in filteredEp)
|
||||
{
|
||||
var epInfo = Api.GetEpisodeMetaData(plexSettings.PlexAuthToken, plexSettings.FullUri,
|
||||
ep.RatingKey);
|
||||
episodeList.Add(epInfo);
|
||||
}
|
||||
|
||||
info.Add(new PlexRecentlyAddedModel
|
||||
{
|
||||
Metadata = i,
|
||||
Content = t,
|
||||
EpisodeMetadata = episodeList
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
info.Add(new PlexRecentlyAddedModel
|
||||
{
|
||||
Metadata = i,
|
||||
Content = t
|
||||
});
|
||||
}
|
||||
Metadata = i,
|
||||
Content = t
|
||||
});
|
||||
}
|
||||
}
|
||||
GenerateTvHtml(info, sb);
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
</td>
|
||||
<td ng-hide="hideColumns">
|
||||
<span ng-if="u.type === 1">Local User</span>
|
||||
<span ng-if="u.type === 3">Plex User</span>
|
||||
<span ng-if="u.type === 0">Plex User</span>
|
||||
<span ng-if="u.type === 2">Emby User</span>
|
||||
</td>
|
||||
<td ng-hide="hideColumns" ng-bind="u.lastLoggedIn === minDate ? 'Never' : formatDate(u.lastLoggedIn)"></td>
|
||||
|
|
|
@ -59,7 +59,8 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
public UserLoginModule(ISettingsService<AuthenticationSettings> auth, IPlexApi api, ISettingsService<PlexSettings> plexSettings, ISettingsService<PlexRequestSettings> pr,
|
||||
ISettingsService<LandingPageSettings> lp, IAnalytics a, IResourceLinker linker, IRepository<UserLogins> userLogins, IExternalUserRepository<PlexUsers> plexUsers, ICustomUserMapper custom,
|
||||
ISecurityExtensions security, ISettingsService<UserManagementSettings> userManagementSettings, IEmbyApi embyApi, ISettingsService<EmbySettings> emby, IExternalUserRepository<EmbyUsers> embyU)
|
||||
ISecurityExtensions security, ISettingsService<UserManagementSettings> userManagementSettings, IEmbyApi embyApi, ISettingsService<EmbySettings> emby, IExternalUserRepository<EmbyUsers> embyU,
|
||||
IUserHelper userHelper)
|
||||
: base("userlogin", pr, security)
|
||||
{
|
||||
AuthService = auth;
|
||||
|
@ -75,6 +76,7 @@ namespace Ombi.UI.Modules
|
|||
EmbySettings = emby;
|
||||
EmbyApi = embyApi;
|
||||
EmbyUserRepository = embyU;
|
||||
UserHelper = userHelper;
|
||||
|
||||
Post["/", true] = async (x, ct) => await LoginUser();
|
||||
Get["/logout"] = x => Logout();
|
||||
|
@ -135,6 +137,7 @@ namespace Ombi.UI.Modules
|
|||
private IExternalUserRepository<EmbyUsers> EmbyUserRepository { get; }
|
||||
private ICustomUserMapper CustomUserMapper { get; }
|
||||
private ISettingsService<UserManagementSettings> UserManagementSettings { get; }
|
||||
private IUserHelper UserHelper { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
@ -683,6 +686,14 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
type = UserType.EmbyUser;;
|
||||
}
|
||||
if (string.IsNullOrEmpty(userId))
|
||||
{
|
||||
// It's possible we have no auth enabled meaning the userId is empty
|
||||
// Let's find that user!
|
||||
|
||||
var user = UserHelper.GetUser(username);
|
||||
userId = user.UserId;
|
||||
}
|
||||
UserLogins.Insert(new UserLogins { UserId = userId, Type = type, LastLoggedIn = DateTime.UtcNow });
|
||||
|
||||
return m;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue