Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ FROM AdminAccounts AS aa
aa.IsSupervisor,
aa.IsTrainer,
aa.CategoryID,
aa.LastAccessed,
CASE
WHEN aa.CategoryID IS NULL THEN 'All'
ELSE cc.CategoryName
Expand Down
3 changes: 3 additions & 0 deletions DigitalLearningSolutions.Data/Models/User/AdminAccount.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace DigitalLearningSolutions.Data.Models.User
{
using System;

public class AdminAccount
{
public int Id { get; set; }
Expand All @@ -26,6 +28,7 @@ public class AdminAccount
public bool IsWorkforceContributor { get; set; }
public bool IsLocalWorkforceManager { get; set; }
public bool IsNominatedSupervisor { get; set; }
public DateTime? LastAccessed { get; set; }

public bool IsCmsAdministrator => ImportOnly && IsContentManager;
public bool IsCmsManager => IsContentManager && !ImportOnly;
Expand Down
2 changes: 2 additions & 0 deletions DigitalLearningSolutions.Data/Models/User/AdminEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DigitalLearningSolutions.Data.Helpers;
using DigitalLearningSolutions.Data.Models.Centres;
using DigitalLearningSolutions.Data.Models.SearchSortFilterPaginate;
using System;

public class AdminEntity : BaseSearchableItem
{
Expand Down Expand Up @@ -72,6 +73,7 @@ public override string SearchableName
public bool IsSuperAdmin => AdminAccount.IsSuperAdmin;
public bool IsReportsViewer => AdminAccount.IsReportsViewer;
public bool IsActive => AdminAccount.Active;
public DateTime? LastAccessed => AdminAccount.LastAccessed;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using DigitalLearningSolutions.Data.Models.User;
using DigitalLearningSolutions.Web.Helpers;
using DigitalLearningSolutions.Web.ViewModels.Common.SearchablePage;
using System;
using DateHelper = Helpers.DateHelper;

public class SearchableAdminViewModel : BaseFilterableViewModel
{
Expand All @@ -23,6 +25,10 @@ ReturnPageQuery returnPageQuery
EmailAddress = admin.EmailForCentreNotifications;
IsLocked = admin.UserAccount.FailedLoginCount >= AuthHelper.FailedLoginThreshold;
IsActive = admin.AdminAccount.Active;
if (admin.LastAccessed.HasValue)
{
LastAccessed = admin.LastAccessed.Value.ToString(DateHelper.StandardDateFormat);
}
CanShowDeactivateAdminButton =
UserPermissionsHelper.LoggedInAdminCanDeactivateUser(admin.AdminAccount, loggedInAdminAccount);

Expand All @@ -46,6 +52,8 @@ ReturnPageQuery returnPageQuery

public bool IsActive { get; set; }

public string? LastAccessed { get; set; }

public ReturnPageQuery ReturnPageQuery { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
@Model.CategoryName
</dd>
</div>
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">
Last accessed
</dt>
<dd class="nhsuk-summary-list__value">
@(Model.LastAccessed != null ? Model.LastAccessed : "-")
</dd>
</div>
</dl>

@if (Model.IsLocked)
Expand Down
Loading