Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.WebApp/3.3/Controllers/PluginController.cs @ 12428

Last change on this file since 12428 was 12428, checked in by ascheibe, 9 years ago

#2394 added web app and status page to trunk

File size: 849 bytes
Line 
1using System.Collections.Generic;
2using System.Linq;
3using System.Web.Http;
4using DTO = HeuristicLab.Services.WebApp.Controllers.DataTransfer;
5
6namespace HeuristicLab.Services.WebApp.Controllers {
7
8  [Authorize(Roles = "Hive Administrator")]
9  public class PluginController : ApiController {
10
11    private readonly PluginManager pluginManager = PluginManager.Instance;
12
13    public IEnumerable<DTO.Plugin> GetPlugins() {
14      var plugins = pluginManager.GetPlugins();
15      return plugins.Select(plugin => new DTO.Plugin {
16        Name = plugin.Name,
17        AssemblyName = plugin.AssemblyName,
18        LastReload = plugin.LastReload
19      });
20    }
21
22    public bool ReloadPlugin(string name) {
23      var plugin = PluginManager.Instance.GetPlugin(name);
24      plugin.ReloadControllers();
25      return true;
26    }
27  }
28}
Note: See TracBrowser for help on using the repository browser.