Esempio n. 1
0
        /// <summary>
        /// 初始化菜单实例。
        /// </summary>
        /// <param name="root">根目录菜单。</param>
        public override void Init(MenuItem root)
        {
            root.AddMenu("dashboard", menu => menu.Texted("控制面板", "fa fa-dashboard", int.MaxValue).Page("/Admin/Index"));

            root.AddMenu("sys", menu => menu
                         .AddMenu("settings", it => it.Texted("系统配置").Page("/Admin/Settings").Allow(Permissions.Administrator))
                         );
        }
Esempio n. 2
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu =>
     {
         menu.Texted("系统管理", "fa-cogs");
         menu.AddMenu("sensitive",
                      it => it.Texted("敏感词汇").Page("/Admin/SensitiveWords/Index", area: AreaName)
                      .Allow(CorePermissions.Sensitive));
         if (_serviceProvider.IsServiceRegistered <INamedStringManager>())
         {
             menu.AddMenu("strings",
                          it => it.Texted("字典管理").Page("/Admin/NamedStrings/Index", area: AreaName)
                          .Allow(CorePermissions.NamedStrings));
         }
         menu.AddMenu("settings",
                      it => it.Texted("系统配置").Page("/Admin/Settings", area: AreaName)
                      .Allow(CorePermissions.SiteSettings));
         menu.AddMenu("tasks",
                      it => it.Texted("后台任务管理").Page("/Admin/Tasks/Index", area: AreaName)
                      .Allow(CorePermissions.Task))
         .AddMenu("background-service",
                  it => it.Texted("后台服务列表").Page("/Admin/Tasks/BackgroundService", area: AreaName)
                  .Allow(CorePermissions.Task));
     });
 }
Esempio n. 3
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("tasks", menu => menu.Texted("TasksManager", IconType.Terminal, -1).Page("/backend/Index", area: AreaName).Allow(CorePermissions.Developer)
                  .AddMenu("index", item => item.Texted("Task_Title").Page("/backend/Index", area: AreaName).Allow(CorePermissions.Developer))
                  .AddMenu("bgservice", item => item.Texted("BackgroundService_Title").Page("/backend/BackgroundService", area: AreaName).Allow(CorePermissions.Developer))
                  );
 }
Esempio n. 4
0
        public ActionResult AddMenu(int menuItemId, int menuId)
        {
            MenuItem menuItem = MenuItem.Find(menuItemId);

            menuItem.AddMenu(Menu.Find(menuId));
            return(RedirectToAction("Show"));
        }
Esempio n. 5
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("events", menu => menu.Texted("事件日志管理", IconType.Alarm).Page("/backend/Index", area: AreaName)
                  .AddMenu("index", item => item.Texted("日志列表").Page("/backend/Index", area: AreaName))
                  .AddMenu("types", item => item.Texted("类型管理").Page("/backend/Categories/Index", area: AreaName))
                  );
 }
Esempio n. 6
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("open", item => item.Texted("开放平台", "bi-app-indicator").Page("/Backend/Index", area: OpenServiceSettings.ExtensionName).Allow(Permissions.View)
                  .AddMenu("apps", it => it.Texted("应用程序列表").Page("/Backend/Index", area: OpenServiceSettings.ExtensionName))
                  .AddMenu("services", it => it.Texted("开放服务列表").Page("/Backend/Services/Index", area: OpenServiceSettings.ExtensionName))
                  );
 }
        public void Delete_DeletesMenuMenuItemFromDatabase()
        {
            //Arrange
            string menuTheme = "BBQ";
            int    menusId   = 1;
            Menu   newMenu   = new Menu(menuTheme, menusId);

            newMenu.Save();

            string   menuItemDescription = "Potato Salad";
            MenuItem newMenuItem         = new MenuItem(menuItemDescription);

            newMenuItem.Save();

            //Act
            Menu     foundMenu     = Menu.Find(newMenu.GetId());
            MenuItem foundMenuItem = MenuItem.Find(newMenuItem.GetId());

            foundMenuItem.AddMenu(foundMenu);

            List <Menu> testList = new List <Menu> {
                foundMenu
            };

            foundMenuItem.DeleteMenu(foundMenu);
            List <Menu> result = foundMenuItem.GetMenus();

            //Assert
            CollectionAssert.AreNotEqual(testList, result);
        }
Esempio n. 8
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("emails", menu => menu.Texted("EmailsManager", IconType.Mailbox).Page("/backend/Index", area: AreaName).Allow(CorePermissions.Administrator)
                  .AddMenu("index", item => item.Texted("Email_Title").Page("/backend/Index", area: AreaName).Allow(CorePermissions.Administrator))
                  .AddMenu("settings", item => item.Texted("Settings_Title").Page("/backend/Settings/Index", area: AreaName).Allow(CorePermissions.Owner))
                  );
 }
Esempio n. 9
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("open", item => item.Texted("开放平台", "fa-cubes").Page("/Admin/Index", area: OpenServiceSettings.ExtensionName).Allow(OpenServicePermissions.View)
                  .AddMenu("apps", it => it.Texted("应用程序列表").Page("/Admin/Index", area: OpenServiceSettings.ExtensionName))
                  .AddMenu("services", it => it.Texted("开放服务列表").Page("/Admin/Services/Index", area: OpenServiceSettings.ExtensionName))
                  );
 }
Esempio n. 10
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("users", item => item.Texted("用户管理", "fa-users").Page("/Admin/Index", area: SecuritySettings.ExtensionName)
                  .AddMenu("index", it => it.Texted("用户列表").Page("/Admin/Index", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.Users))
                  .AddMenu("roles", it => it.Texted("角色列表").Page("/Admin/Roles/Index", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.Roles))
                  .AddMenu("permissions", it => it.Texted("权限列表").Page("/Admin/Permissions/Index", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.PermissionManager))
                  .AddMenu("logs", it => it.Texted("日志管理").Page("/Admin/Logs/Index", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.Logs))
                  .AddMenu("settings", it => it.Texted("用户配置").Page("/Admin/Settings", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.Settings))
                  .AddMenu("notifier", it => it.Texted("通知类型").Page("/Admin/Notifications/Index", area: SecuritySettings.ExtensionName).Allow(SecurityPermissions.Notifier))
                  );
     root.AddMenu("account", item => item.Texted("账号管理", "fa-user").Page("/Admin/User/Index", area: SecuritySettings.ExtensionName)
                  .AddMenu("index", it => it.Texted("编辑资料").Page("/Admin/User/Index", area: SecuritySettings.ExtensionName))
                  .AddMenu("changepassword", it => it.Texted("修改密码").Page("/Admin/User/ChangePassword", area: SecuritySettings.ExtensionName))
                  .AddMenu("avatar", it => it.Texted("更新头像").Page("/Admin/User/Avatar", area: SecuritySettings.ExtensionName))
                  .AddMenu("log", it => it.Texted("活动日志").Page("/Admin/User/Log", area: SecuritySettings.ExtensionName))
                  );
 }
Esempio n. 11
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("contents", menu => menu.Texted("内容", priority: 2).Href("Index", "Admin", TagSettings.ExtensionName)
                  .AddMenu("tags", item => item.Texted("所有标签", "tags").Href("Index", "Admin", TagSettings.ExtensionName)
                           .AddMenu("categories", it => it.Texted("标签分类").Href("Index", "AdminCategory", TagSettings.ExtensionName))
                           )
                  );
 }
Esempio n. 12
0
 public override void Init(MenuItem root)
 {
     root.AddMenu("pm", menu => menu.Texted("项目管理", "fa fa-gg").Page("/Admin/Index", area: ProjectSettings.ExtensionName).Allow(Permissions.Administrator)
                  .AddMenu("tasks", item => item.Texted("任务列表").Page("/Admin/Index", area: ProjectSettings.ExtensionName).Allow(Permissions.Administrator))
                  .AddMenu("projects", item => item.Texted("项目列表").Page("/Admin/Projects/Index", area: ProjectSettings.ExtensionName).Allow(Permissions.Administrator))
                  .AddMenu("users", item => item.Texted("用户列表").Page("/Admin/Users/Index", area: ProjectSettings.ExtensionName).Allow(Permissions.Administrator))
                  );
 }
Esempio n. 13
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("home",
                  menu => menu.Texted("系统").Href("index", "admin", null)
                  .AddMenu("settings", item => item.Texted("网站配置", "cog").Href("settings", "admin", null))
                  .AddMenu("emailsettings", item => item.Texted("电子邮件配置", "envelope-o").Href("emailsettings", "admin", null))
                  );
 }
Esempio n. 14
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu =>
                  menu.AddMenu("emails",
                               it => it.Texted("邮件管理").Page("/Admin/Email/Index", area: EmailSettings.ExtensionName).Allow(Permissions.Email))
                  .AddMenu("emails.settings",
                           it => it.Texted("邮件配置").Page("/Admin/Email/Settings", area: EmailSettings.ExtensionName).Allow(Permissions.Settings)));
 }
Esempio n. 15
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("emails", menu => menu.Texted("邮件管理", "fa-envelope-open-o").Page("/Admin/Index", area: EmailSettings.ExtensionName).Allow(EmailPermissions.Email)
                  .AddMenu("index",
                           it => it.Texted("邮件发送列表").Page("/Admin/Index", area: EmailSettings.ExtensionName))
                  .AddMenu("settings",
                           it => it.Texted("邮件配置").Page("/Admin/Settings/Index", area: EmailSettings.ExtensionName).Allow(EmailPermissions.Settings)));
 }
Esempio n. 16
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     if (_serviceProvider.IsServiceRegistered <IMediaDirectory>())
     {
         root.AddMenu("sys", menu => menu
                      .AddMenu("storages", it => it.Texted("文件管理").Page("/Admin/Index", area: AreaName).Allow(StoragePermissions.View))
                      );
     }
 }
Esempio n. 17
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("users", menu => menu.Texted("用户", priority: 1).Href("Index", "Admin", SecuritySettings.ExtensionName)
                  .AddMenu("index", item => item.Texted("所有用户", "user-secret").Href("Index", "Admin", SecuritySettings.ExtensionName)
                           .AddMenu("names", it => it.Texted("非法用户名").Href("Index", "AdminDisallowName", SecuritySettings.ExtensionName))
                           )
                  .AddMenu("roles", item => item.Texted("用户组", "users").Href("Index", "AdminRole", SecuritySettings.ExtensionName))
                  );
 }
Esempio n. 18
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("users", item => item.Texted("用户管理", "fa fa-users").Page("/Admin/Index", area: SecuritySettings.ExtensionName)
                  .AddMenu("index", it => it.Texted("用户列表").Page("/Admin/Index", area: SecuritySettings.ExtensionName).Allow(Permissions.Users))
                  .AddMenu("roles", it => it.Texted("角色列表").Page("/Admin/Roles/Index", area: SecuritySettings.ExtensionName).Allow(Permissions.Roles))
                  .AddMenu("permissions", it => it.Texted("权限列表").Page("/Admin/Permissions/Index", area: SecuritySettings.ExtensionName).Allow(Permissions.PermissionManager))
                  .AddMenu("logs", it => it.Texted("日志管理").Page("/Admin/Logs/Index", area: SecuritySettings.ExtensionName).Allow(Permissions.Logs))
                  .AddMenu("settings", it => it.Texted("用户配置").Page("/Admin/Settings", area: SecuritySettings.ExtensionName).Allow(Permissions.Settings))
                  );
 }
Esempio n. 19
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu => menu.Texted("系统管理", "fa fa-cogs")
                  .AddMenu("tasks", it => it.Texted("后台服务").Page("/Admin/Tasks/Index", area: AreaName).Allow(Permissions.Administrator))
                  .AddMenu("email", it => it.Texted("邮件管理").Page("/Admin/Email/Index", area: AreaName).Allow(Permissions.Email))
                  .AddMenu("emailsettings", it => it.Texted("邮件配置").Page("/Admin/Email/Settings", area: AreaName).Allow(Permissions.EmailSettings))
                  .AddMenu("notifier", it => it.Texted("通知管理").Page("/Admin/Notifications/Index", area: AreaName).Allow(Permissions.Administrator))
                  .AddMenu("dicsettings", it => it.Texted("字典管理").Page("/Admin/Settings/Index", area: AreaName).Allow(Permissions.Administrator))
                  );
 }
Esempio n. 20
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu(Index, item => item.Texted("个人配置").Page("/Account/Index", area: SecuritySettings.ExtensionName))
     .AddMenu(ChangePassword, item => item.Texted("修改密码").Page("/Account/ChangePassword", area: SecuritySettings.ExtensionName))
     .AddMenu(Avatar, item => item.Texted("更新头像").Page("/Account/Avatar", area: SecuritySettings.ExtensionName))
     //.AddMenu(TwoFactorAuthentication, item => item.Texted("二次登录验证", "fa fa-mobile").Page("/Account/TwoFactorAuthentication", area: SecuritySettings.ExtensionName))
     //.AddMenu(ExternalLogins, item => item.Texted("社会化登录", "fa fa-gg").Page("/Account/ExternalLogins", area: SecuritySettings.ExtensionName))
     //.AddMenu(PersonalData, item => item.Texted("下载数据", "fa fa-download").Page("/Account/PersonalData", area: SecuritySettings.ExtensionName))
     .AddMenu(Log, item => item.Texted("活动日志").Page("/Account/Log", area: SecuritySettings.ExtensionName));
 }
Esempio n. 21
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("nav", "导航")
     .AddMenu("home", item => item.Texted("后台管理", "bi-house").Page("/Index", area: AreaName))
     .AddMenu("users", item => item.Texted("用户管理", "bi-people").Page("/Users/Index", area: AreaName)
              .AddMenu("index", it => it.Texted("用户列表").Page("/Users/Index", area: AreaName))
              )
     .AddMenu("sys", item => item.Texted("系统配置", "bi-gear").Page("/Settings", area: AreaName)
              .AddMenu("settings", item => item.Texted("网站配置").Page("/Settings", area: AreaName))
              );
 }
Esempio n. 22
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("account", menu => menu.Texted("账户管理", "user").Page("/Account/Index", area: SecuritySettings.ExtensionName)
                  .AddMenu("index", item => item.Texted("修改资料").Page("/Account/Index", area: SecuritySettings.ExtensionName))
                  .AddMenu("changepassword", item => item.Texted("修改密码").Page("/Account/ChangePassword", area: SecuritySettings.ExtensionName))
                  .AddMenu("avatar", item => item.Texted("更新头像").Page("/Account/Avatar", area: SecuritySettings.ExtensionName))
                  //.AddMenu("twofactor", item => item.Texted("二次登录验证", "fa fa-mobile").Page("/Account/TwoFactorAuthentication", area: SecuritySettings.ExtensionName))
                  //.AddMenu("externallogins", item => item.Texted("社会化登录", "fa fa-gg").Page("/Account/ExternalLogins", area: SecuritySettings.ExtensionName))
                  //.AddMenu("personaldata", item => item.Texted("下载数据", "fa fa-download").Page("/Account/PersonalData", area: SecuritySettings.ExtensionName))
                  .AddMenu("log", item => item.Texted("活动日志").Page("/Account/Log", area: SecuritySettings.ExtensionName))
                  );
 }
Esempio n. 23
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("app", menu => menu.Texted("开放平台", "fa fa-sitemap")
                  .AddMenu("index",
                           it => it.Texted("应用管理").Page("/Admin/Applications/Index", area: OpenServiceSettings.ExtensionName)
                           .Allow(Permissions.Administrator))
                  .AddMenu("apis",
                           it => it.Texted("API列表").Page("/Admin/Apis/Index", area: OpenServiceSettings.ExtensionName)
                           .Allow(Permissions.Administrator))
                  .AddMenu("code",
                           it => it.Texted("状态编码").Page("/Admin/Apis/Code", area: OpenServiceSettings.ExtensionName)
                           .Allow(Permissions.Administrator))
                  );
 }
        public void GetMenus_RetrievesAllMenusWithMenuItem_MenuList()
        {
            //Arrange
            string menuTheme1 = "BBQ";
            int    menusId1   = 1;
            Menu   newMenu1   = new Menu(menuTheme1, menusId1);

            newMenu1.Save();

            string menuTheme2 = "Mexican";
            int    menusId2   = 2;
            Menu   newMenu2   = new Menu(menuTheme2, menusId2);

            newMenu2.Save();

            string   menuItemDescription = "Potato Salad";
            MenuItem newMenuItem         = new MenuItem(menuItemDescription);

            newMenuItem.Save();

            //Act
            Menu     foundMenu1    = Menu.Find(newMenu1.GetId());
            Menu     foundMenu2    = Menu.Find(newMenu2.GetId());
            MenuItem foundMenuItem = MenuItem.Find(newMenuItem.GetId());

            foundMenuItem.AddMenu(foundMenu1);
            foundMenuItem.AddMenu(foundMenu2);

            List <Menu> newList = new List <Menu> {
                newMenu1, newMenu2
            };
            List <Menu> resultList = foundMenuItem.GetMenus();

            //Assert
            CollectionAssert.AreEqual(newList, resultList);
        }
Esempio n. 25
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu => menu
                  .AddMenu("storages", it => it.Texted("文件管理").Page("/Admin/Index", area: AreaName).Allow(Permissions.Storages))
                  );
 }
Esempio n. 26
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu => menu
                  .AddMenu("SensitiveWords", item => item.Texted("敏感词汇").Page("/backend/Index", area: AreaName))
                  );
 }
Esempio n. 27
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("sys", menu => menu
                  .AddMenu("namedstrings", item => item.Texted("字典管理").Page("/backend/Index", area: AreaName))
                  );
 }
Esempio n. 28
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("storages", menu => menu.Texted("文件存储管理", IconType.Files).Page("/Backend/Index", area: AreaName)
                  .AddMenu("index", it => it.Texted("媒体文件管理").Page("/Backend/Index", area: AreaName))
                  );
 }
Esempio n. 29
0
 /// <summary>
 /// 初始化菜单实例。
 /// </summary>
 /// <param name="root">根目录菜单。</param>
 public override void Init(MenuItem root)
 {
     root.AddMenu("dashboard", item => item.Texted("控制面板", "fa-dashboard").Page("/Admin/Index"));
 }