mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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,
|
Username = localUsers.UserName,
|
||||||
UserAlias = props.UserAlias,
|
UserAlias = props.UserAlias,
|
||||||
EmailAddress = props.EmailAddress,
|
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,
|
Username = plexUsers.Username,
|
||||||
UserAlias = plexUsers.UserAlias,
|
UserAlias = plexUsers.UserAlias,
|
||||||
EmailAddress = plexUsers.EmailAddress,
|
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,
|
Username = embyUsers.Username,
|
||||||
UserAlias = embyUsers.UserAlias,
|
UserAlias = embyUsers.UserAlias,
|
||||||
EmailAddress = embyUsers.EmailAddress,
|
EmailAddress = embyUsers.EmailAddress,
|
||||||
Permissions = (Permissions)embyUsers.Permissions
|
Permissions = (Permissions)embyUsers.Permissions,
|
||||||
|
UserId = embyUsers.EmbyUserId,
|
||||||
|
Features = (Features)embyUsers.Features
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace Ombi.Core.Users
|
||||||
public Features Features { get; set; }
|
public Features Features { get; set; }
|
||||||
public string EmailAddress { get; set; }
|
public string EmailAddress { get; set; }
|
||||||
public UserType Type { get; set; }
|
public UserType Type { get; set; }
|
||||||
|
public string UserId { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string UsernameOrAlias => string.IsNullOrEmpty(UserAlias) ? Username : UserAlias;
|
public string UsernameOrAlias => string.IsNullOrEmpty(UserAlias) ? Username : UserAlias;
|
||||||
|
|
|
@ -49,7 +49,7 @@ using PlexMediaType = Ombi.Store.Models.Plex.PlexMediaType;
|
||||||
|
|
||||||
namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
||||||
{
|
{
|
||||||
public class
|
public class
|
||||||
PlexRecentlyAddedNewsletter : HtmlTemplateGenerator, IPlexNewsletter
|
PlexRecentlyAddedNewsletter : HtmlTemplateGenerator, IPlexNewsletter
|
||||||
{
|
{
|
||||||
public PlexRecentlyAddedNewsletter(IPlexApi api, ISettingsService<PlexSettings> plexSettings,
|
public PlexRecentlyAddedNewsletter(IPlexApi api, ISettingsService<PlexSettings> plexSettings,
|
||||||
|
@ -168,7 +168,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
||||||
recentlyAddedModel.Add(new PlexRecentlyAddedModel
|
recentlyAddedModel.Add(new PlexRecentlyAddedModel
|
||||||
{
|
{
|
||||||
Metadata = i,
|
Metadata = i,
|
||||||
EpisodeMetadata = new List<PlexEpisodeMetadata>() {episodeInfo},
|
EpisodeMetadata = new List<PlexEpisodeMetadata>() { episodeInfo },
|
||||||
Content = relatedSeries
|
Content = relatedSeries
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -186,33 +186,12 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
//var ep = filteredEp.Where(x => x.ShowTitle == t.Title);
|
|
||||||
|
|
||||||
if (filteredEp.Any())
|
info.Add(new PlexRecentlyAddedModel
|
||||||
{
|
{
|
||||||
var episodeList = new List<PlexEpisodeMetadata>();
|
Metadata = i,
|
||||||
foreach (var ep in filteredEp)
|
Content = t
|
||||||
{
|
});
|
||||||
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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GenerateTvHtml(info, sb);
|
GenerateTvHtml(info, sb);
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td ng-hide="hideColumns">
|
<td ng-hide="hideColumns">
|
||||||
<span ng-if="u.type === 1">Local User</span>
|
<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>
|
<span ng-if="u.type === 2">Emby User</span>
|
||||||
</td>
|
</td>
|
||||||
<td ng-hide="hideColumns" ng-bind="u.lastLoggedIn === minDate ? 'Never' : formatDate(u.lastLoggedIn)"></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,
|
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,
|
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)
|
: base("userlogin", pr, security)
|
||||||
{
|
{
|
||||||
AuthService = auth;
|
AuthService = auth;
|
||||||
|
@ -75,6 +76,7 @@ namespace Ombi.UI.Modules
|
||||||
EmbySettings = emby;
|
EmbySettings = emby;
|
||||||
EmbyApi = embyApi;
|
EmbyApi = embyApi;
|
||||||
EmbyUserRepository = embyU;
|
EmbyUserRepository = embyU;
|
||||||
|
UserHelper = userHelper;
|
||||||
|
|
||||||
Post["/", true] = async (x, ct) => await LoginUser();
|
Post["/", true] = async (x, ct) => await LoginUser();
|
||||||
Get["/logout"] = x => Logout();
|
Get["/logout"] = x => Logout();
|
||||||
|
@ -135,6 +137,7 @@ namespace Ombi.UI.Modules
|
||||||
private IExternalUserRepository<EmbyUsers> EmbyUserRepository { get; }
|
private IExternalUserRepository<EmbyUsers> EmbyUserRepository { get; }
|
||||||
private ICustomUserMapper CustomUserMapper { get; }
|
private ICustomUserMapper CustomUserMapper { get; }
|
||||||
private ISettingsService<UserManagementSettings> UserManagementSettings { get; }
|
private ISettingsService<UserManagementSettings> UserManagementSettings { get; }
|
||||||
|
private IUserHelper UserHelper { get; }
|
||||||
|
|
||||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
@ -683,6 +686,14 @@ namespace Ombi.UI.Modules
|
||||||
{
|
{
|
||||||
type = UserType.EmbyUser;;
|
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 });
|
UserLogins.Insert(new UserLogins { UserId = userId, Type = type, LastLoggedIn = DateTime.UtcNow });
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue