Minimal Mvc Admin Plugin

Hi there!

I saw Dejan’s post on Episerver MVC admin plugins and though that I could just post a thinner version.
This one builds on attribute routing and we shouldn’t have to register a route in an initialization module just for the plugin, which makes it more of a standalone unit.
The init module is included in the source, but typically it resides in the global initalization and is usable by all controllers and plugins.

Source (or Gist):

[GuiPlugIn(
  Area = PlugInArea.AdminMenu,
  Url = "/" + MyTestControllerPath,
  DisplayName = "My Plugin")]
[Authorize(Roles = "CmsAdmins")]
[Route(MyTestControllerPath)]
public class MyTestController : Controller
{
  internal const string MyTestControllerPath = "custom-plugins/my-plugin";

  public ActionResult Index()
  {
    return Content("Found");
  }
}

// This initialization is typically made globally and not per plugin
public class InitModule : IInitializableModule
{
  public void Initialize(InitializationEngine context)
  {
    // Add support for attribute routing
    RouteTable.Routes.MapMvcAttributeRoutes();
  }

  public void Uninitialize(InitializationEngine context) {}
}

Cheers!