1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

Finish implementation of configuable command permissions

This commit is contained in:
RaidMax
2020-01-31 20:15:07 -06:00
parent 475ef92917
commit 786eda7937
38 changed files with 373 additions and 213 deletions

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore;
using SharedLibraryCore.Dtos;
using SharedLibraryCore.Interfaces;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -10,9 +11,11 @@ namespace WebfrontCore.Controllers
{
public class HomeController : BaseController
{
public HomeController(IManager manager) : base(manager)
{
private readonly IPluginImporter _pluginImporter;
public HomeController(IManager manager, IPluginImporter importer) : base(manager)
{
_pluginImporter = importer;
}
public async Task<IActionResult> Index()
@ -65,7 +68,7 @@ namespace WebfrontCore.Controllers
var pluginType = _cmd.GetType().Assembly.GetTypes().FirstOrDefault(_type => _type.Assembly != excludedAssembly && typeof(IPlugin).IsAssignableFrom(_type));
return pluginType == null ?
Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HELP_COMMAND_NATIVE"] :
SharedLibraryCore.Plugins.PluginImporter.ActivePlugins.First(_plugin => _plugin.GetType() == pluginType).Name; // for now we're just returning the name of the plugin, maybe later we'll include more info
_pluginImporter.ActivePlugins.First(_plugin => _plugin.GetType() == pluginType).Name; // for now we're just returning the name of the plugin, maybe later we'll include more info
})
.Select(_grp => (_grp.Key, _grp.AsEnumerable()));