public void Execute() { Service.Instance.AllowedPermissions.AddRange(new[] { "Inventory Viewer", "Inventory Entry" }); var menu = new InvMenu{Name = "Inventory", RequiredPermission = new[] {"Inventory Viewer"}}; var inventory = new MenuEntry {Name = "List Inventory"}; inventory.Execute += () => Service.Instance.ActivePage = new Inventory(); menu.Entries.Add(inventory); Service.Instance.MainMenu.SubMenus.Add(menu); }
public void Execute() { Service.Instance.AllowedPermissions.AddRange(new[] {"Systems Viewer", "Systems Entry"}); var menu = new InvMenu {Name = "Systems Entry", RequiredPermission = new[] {"Systems Viewer"}}; var addSystem = new MenuEntry {Name = "Add System", RequiredPermission = new[] {"Systems Entry"}}; addSystem.Execute += () => Service.Instance.ActivePage = new SystemsInventory(); var listSystems = new MenuEntry { Name = "List Systems", RequiredPermission = new[] { "Systems Viewer" } }; listSystems.Execute += () => Service.Instance.ActivePage = new ListInventory(); menu.Entries.Add(addSystem); menu.Entries.Add(listSystems); Service.Instance.MainMenu.SubMenus.Add(menu); }
private Service() { AllowedPermissions = new List<string> {"Administrator", "User"}; Importers = new Dictionary<string, IImport>(); Exporters = new Dictionary<string, IExport>(); MainMenu = new InvMenu {Name = "Main Menu"}; MainMenu.SubMenus.Add(new InvMenu { Name = "Administration", RequiredPermission = new[] { "Administrator" } }); var loginSettings = new MenuEntry {Name = "User Management"}; loginSettings.Execute += () => ActivePage = new BuiltIns.UserManagement(); var highlighterColorsSettings = new MenuEntry { Name = "Highlighter Colors" }; highlighterColorsSettings.Execute += () => ActivePage = new BuiltIns.HighlighterColors(); var templateSettings = new MenuEntry { Name = "Template Editor" }; templateSettings.Execute += () => ActivePage = new BuiltIns.TemplateEditor(); MainMenu.SubMenus[0].Entries.Add(loginSettings); MainMenu.SubMenus[0].Entries.Add(highlighterColorsSettings); MainMenu.SubMenus[0].Entries.Add(templateSettings); }
private bool EvaluatePermissions(MenuEntry v) { return v.RequiredPermission == null || Service.Instance.HasPermission(v.RequiredPermission); }