mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -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
|
@ -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