sql.go 3.2 KB

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