sql.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. package init
  2. import (
  3. "nginx-ui/server/models"
  4. "nginx-ui/server/modules/settings"
  5. )
  6. // 初始化菜单数据
  7. func ensureRoutes() {
  8. routes := []models.SettingRoute{
  9. {
  10. Id: "NGINX_LAYOUT",
  11. Path: "nginx/*",
  12. Index: false,
  13. Pid: "",
  14. Uid: 100,
  15. Roles: "ADMIN",
  16. Type: "NAV",
  17. Target: "TAB",
  18. Title: "Nginx管理",
  19. Brief: "Nginx在线管理工具",
  20. NavLink: "/nginx",
  21. Deleted: false,
  22. SortNum: 0,
  23. },
  24. {
  25. Id: "LDAP",
  26. Path: "ldap",
  27. Index: true,
  28. Pid: "",
  29. Uid: 10,
  30. Roles: "ADMIN",
  31. Type: "NAV",
  32. Target: "TAB",
  33. Title: "LDAP管理",
  34. Brief: "LDAP用户管理",
  35. NavLink: "",
  36. Deleted: false,
  37. SortNum: 0,
  38. },
  39. {
  40. Id: "LDAPServerUsers",
  41. Path: "ldap/server/:id",
  42. Index: false,
  43. Pid: "",
  44. Uid: 0,
  45. Roles: "ADMIN",
  46. Type: "MENU",
  47. Target: "TAB",
  48. Title: "LDAP",
  49. Brief: "",
  50. NavLink: "",
  51. Deleted: false,
  52. SortNum: 0,
  53. },
  54. {
  55. Id: "LDAP_USERS",
  56. Path: "user",
  57. Index: true,
  58. Pid: "LDAPServerUsers",
  59. Uid: 0,
  60. Roles: "ADMIN",
  61. Type: "MENU",
  62. Target: "TAB",
  63. Title: "用户列表",
  64. Brief: "",
  65. NavLink: "",
  66. Deleted: false,
  67. SortNum: 10,
  68. },
  69. {
  70. Id: "LDAP_ORGANIZE_LIST",
  71. Path: "organize",
  72. Index: false,
  73. Pid: "LDAPServerUsers",
  74. Uid: 0,
  75. Roles: "ADMIN",
  76. Type: "MENU",
  77. Target: "TAB",
  78. Title: "组织管理",
  79. Brief: "",
  80. NavLink: "",
  81. Deleted: false,
  82. SortNum: 0,
  83. },
  84. {
  85. Id: "ROUTE_LIST",
  86. Path: "routes",
  87. Index: false,
  88. Pid: "",
  89. Uid: 0,
  90. Roles: "ADMIN",
  91. Type: "NAV",
  92. Target: "TAB",
  93. Title: "菜单配置",
  94. Brief: "配置系统菜单",
  95. NavLink: "",
  96. Deleted: false,
  97. SortNum: 0,
  98. },
  99. {
  100. Id: "USER_MANAGER",
  101. Path: "user",
  102. Index: false,
  103. Pid: "",
  104. Uid: 0,
  105. Roles: "",
  106. Type: "NAV",
  107. Target: "TAB",
  108. Title: "用户管理",
  109. Brief: "系统用户管理",
  110. NavLink: "",
  111. Deleted: false,
  112. SortNum: 5,
  113. },
  114. {
  115. Id: "USER_LIST",
  116. Path: "list",
  117. Index: true,
  118. Pid: "USER_MANAGER",
  119. Uid: 0,
  120. Roles: "",
  121. Type: "MENU",
  122. Target: "TAB",
  123. Title: "用户列表",
  124. Brief: "用户列表",
  125. NavLink: "",
  126. Deleted: false,
  127. SortNum: 4,
  128. },
  129. {
  130. Id: "USER_ROLE",
  131. Path: "role",
  132. Index: false,
  133. Pid: "USER_MANAGER",
  134. Uid: 0,
  135. Roles: "",
  136. Type: "MENU",
  137. Target: "TAB",
  138. Title: "角色管理",
  139. Brief: "角色管理",
  140. NavLink: "",
  141. Deleted: false,
  142. SortNum: 3,
  143. },
  144. {
  145. Id: "SETTING_ID",
  146. Path: "settings",
  147. Index: false,
  148. Pid: "",
  149. Uid: 0,
  150. Roles: "ADMIN",
  151. Type: "NAV",
  152. Target: "TAB",
  153. Title: "系统设置",
  154. Brief: "系统设置",
  155. NavLink: "",
  156. Deleted: false,
  157. SortNum: 0,
  158. },
  159. {
  160. Id: "USER_LINKS",
  161. Path: "links",
  162. Index: false,
  163. Pid: "",
  164. Uid: 0,
  165. Roles: "",
  166. Type: "NAV",
  167. Target: "TAB",
  168. Title: "快捷菜单",
  169. Brief: "快捷菜单",
  170. NavLink: "",
  171. Deleted: false,
  172. SortNum: 0,
  173. },
  174. {
  175. Id: "QUICK_LINKS",
  176. Path: "#",
  177. Index: false,
  178. Pid: "",
  179. Uid: 0,
  180. Roles: "",
  181. Type: "FOLDER",
  182. Target: "TAB",
  183. Title: "快捷链接",
  184. Brief: "快捷链接",
  185. NavLink: "",
  186. Deleted: false,
  187. SortNum: 0,
  188. },
  189. {
  190. Id: "MODIFY_PASSWORD",
  191. Path: "/modifyPassword",
  192. Index: false,
  193. Pid: "QUICK_LINKS",
  194. Uid: 0,
  195. Roles: "",
  196. Type: "LINK",
  197. Target: "TAB",
  198. Title: "修改密码",
  199. Brief: "修改您的密码",
  200. NavLink: "",
  201. Deleted: false,
  202. SortNum: 0,
  203. },
  204. }
  205. for _, route := range routes {
  206. settings.Route.InsertWhenNotExist(route)
  207. }
  208. }