v1.3.1 - Add Initialize override that calls Register() to hook into page rendering
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.UI.Device;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Plugins;
|
||||
@@ -11,6 +12,11 @@ namespace Disco.Plugins.ADCompare.Features
|
||||
[PluginFeature(Id = "ADCompareDeviceUI", Name = "Device Page - AD Compare")]
|
||||
public class DeviceUIExtension : UIExtensionFeature<DeviceShowModel>
|
||||
{
|
||||
public override void Initialize(DiscoDataContext Database)
|
||||
{
|
||||
Register();
|
||||
}
|
||||
|
||||
public override UIExtensionResult ExecuteAction(ControllerContext context, DeviceShowModel model)
|
||||
{
|
||||
var device = model.Device;
|
||||
@@ -41,10 +47,8 @@ namespace Disco.Plugins.ADCompare.Features
|
||||
var hasManagedBy = !string.IsNullOrEmpty(managedByDN);
|
||||
var hasAssignment = !string.IsNullOrEmpty(discoAssignedUser);
|
||||
|
||||
// Extract display name from managedBy DN
|
||||
string managedByDisplayName = hasManagedBy ? ExtractCNFromDN(managedByDN) : null;
|
||||
|
||||
// Look up the Disco assigned user's DN in AD for comparison
|
||||
string assignedUserDN = null;
|
||||
if (hasAssignment)
|
||||
{
|
||||
@@ -57,7 +61,6 @@ namespace Disco.Plugins.ADCompare.Features
|
||||
catch { }
|
||||
}
|
||||
|
||||
// Compare DN-to-DN
|
||||
bool isMatch = false;
|
||||
if (!hasAssignment && !hasManagedBy)
|
||||
isMatch = true;
|
||||
@@ -107,7 +110,6 @@ namespace Disco.Plugins.ADCompare.Features
|
||||
}
|
||||
html.Append("</td></tr>");
|
||||
|
||||
// Last Logon
|
||||
var lastLogonTicks = adAccount.GetPropertyValue<long>("lastLogonTimestamp");
|
||||
html.Append("<tr><td><strong>Last Login</strong></td><td>");
|
||||
if (lastLogonTicks > 0)
|
||||
|
||||
Reference in New Issue
Block a user