51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using Disco.Data.Repository;
|
|
using Disco.Services.Plugins;
|
|
using System.Web.Mvc;
|
|
using System.Web.WebPages;
|
|
|
|
namespace Disco.Plugins.ADCompare.ConfigurationHandler
|
|
{
|
|
public class ADCompareConfigurationHandler : PluginConfigurationHandler
|
|
{
|
|
public override PluginConfigurationHandlerGetResponse Get(DiscoDataContext Database, Controller controller)
|
|
{
|
|
return Response<ConfigurationView>();
|
|
}
|
|
|
|
public override bool Post(DiscoDataContext Database, FormCollection form, Controller controller)
|
|
{
|
|
// No configuration to save
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public class ConfigurationView : WebViewPage
|
|
{
|
|
public override void Execute()
|
|
{
|
|
WriteLiteral(@"
|
|
<div style='padding: 15px;'>
|
|
<h3>AD Compare Plugin</h3>
|
|
<p>This plugin compares the <strong>Managed By</strong> field on Active Directory computer objects
|
|
against the <strong>Assigned User</strong> in Disco ICT, and reports mismatches.</p>
|
|
<hr />
|
|
<h4>How It Works</h4>
|
|
<ul>
|
|
<li>Loads all active devices from Disco that have a domain computer account</li>
|
|
<li>Looks up each computer in AD and reads the <code>managedBy</code> attribute</li>
|
|
<li>Resolves the <code>managedBy</code> Distinguished Name to a <code>DOMAIN\username</code></li>
|
|
<li>Compares against Disco's <code>AssignedUserId</code></li>
|
|
<li>Reports mismatches: different users, missing assignments, or empty managedBy</li>
|
|
</ul>
|
|
<hr />
|
|
<p>No configuration is required.</p>
|
|
<p>
|
|
<a href='/Plugin/Disco.Plugins.ADCompare' class='btn btn-primary btn-lg'>
|
|
<i class='fa fa-exchange'></i> Open Comparison Dashboard
|
|
</a>
|
|
</p>
|
|
</div>");
|
|
}
|
|
}
|
|
}
|