finish help layout and show only on permission level

This commit is contained in:
RaidMax
2019-12-29 11:32:36 -06:00
parent 344c3613b8
commit 902cd9953e
2 changed files with 10 additions and 7 deletions

View File

@ -52,16 +52,20 @@ namespace WebfrontCore.Controllers
public IActionResult Help()
{
ViewBag.IsFluid = true;
ViewBag.Title = Localization["WEBFRONT_NAV_HELP"];
// we don't need to the name of the shared library assembly
var excludedAssembly = typeof(BaseController).Assembly;
var commands = Manager.GetCommands()
.Where(_cmd => _cmd.Permission <= Client.Level)
.OrderByDescending(_cmd => _cmd.Permission)
.GroupBy(_cmd =>
{
// we need the plugin type the command is defined in
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;
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
})
.Select(_grp => (_grp.Key, _grp.AsEnumerable()));