package init import ( "nginx-ui/server/models" "nginx-ui/server/modules/settings" ) // 初始化菜单数据 func ensureRoutes() { routes := []models.SettingRoute{ { Id: "NGINX_LAYOUT", Path: "nginx/*", Index: false, Pid: "", Uid: 100, Roles: "ADMIN", Type: "NAV", Target: "TAB", Title: "Nginx管理", Brief: "Nginx在线管理工具", NavLink: "/nginx", Deleted: false, SortNum: 0, }, { Id: "LDAP", Path: "ldap", Index: true, Pid: "", Uid: 10, Roles: "ADMIN", Type: "NAV", Target: "TAB", Title: "LDAP管理", Brief: "LDAP用户管理", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "LDAPServerUsers", Path: "ldap/server/:id", Index: false, Pid: "", Uid: 0, Roles: "ADMIN", Type: "MENU", Target: "TAB", Title: "LDAP", Brief: "", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "LDAP_USERS", Path: "user", Index: true, Pid: "LDAPServerUsers", Uid: 0, Roles: "ADMIN", Type: "MENU", Target: "TAB", Title: "用户列表", Brief: "", NavLink: "", Deleted: false, SortNum: 10, }, { Id: "LDAP_ORGANIZE_LIST", Path: "organize", Index: false, Pid: "LDAPServerUsers", Uid: 0, Roles: "ADMIN", Type: "MENU", Target: "TAB", Title: "组织管理", Brief: "", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "ROUTE_LIST", Path: "routes", Index: false, Pid: "", Uid: 0, Roles: "ADMIN", Type: "NAV", Target: "TAB", Title: "菜单配置", Brief: "配置系统菜单", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "USER_MANAGER", Path: "user", Index: false, Pid: "", Uid: 0, Roles: "", Type: "NAV", Target: "TAB", Title: "用户管理", Brief: "系统用户管理", NavLink: "", Deleted: false, SortNum: 5, }, { Id: "USER_LIST", Path: "list", Index: true, Pid: "USER_MANAGER", Uid: 0, Roles: "", Type: "MENU", Target: "TAB", Title: "用户列表", Brief: "用户列表", NavLink: "", Deleted: false, SortNum: 4, }, { Id: "USER_ROLE", Path: "role", Index: false, Pid: "USER_MANAGER", Uid: 0, Roles: "", Type: "MENU", Target: "TAB", Title: "角色管理", Brief: "角色管理", NavLink: "", Deleted: false, SortNum: 3, }, { Id: "SETTING_ID", Path: "settings", Index: false, Pid: "", Uid: 0, Roles: "ADMIN", Type: "NAV", Target: "TAB", Title: "系统设置", Brief: "系统设置", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "USER_LINKS", Path: "links", Index: false, Pid: "", Uid: 0, Roles: "", Type: "NAV", Target: "TAB", Title: "快捷菜单", Brief: "快捷菜单", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "QUICK_LINKS", Path: "#", Index: false, Pid: "", Uid: 0, Roles: "", Type: "FOLDER", Target: "TAB", Title: "快捷链接", Brief: "快捷链接", NavLink: "", Deleted: false, SortNum: 0, }, { Id: "MODIFY_PASSWORD", Path: "/modifyPassword", Index: false, Pid: "QUICK_LINKS", Uid: 0, Roles: "", Type: "LINK", Target: "TAB", Title: "修改密码", Brief: "修改您的密码", NavLink: "", Deleted: false, SortNum: 0, }, } for _, route := range routes { settings.Route.InsertWhenNotExist(route) } }