PermissionConfiguration.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  3. using MTWorkHR.Core.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace MTWorkHR.Infrastructure.Configurations
  10. {
  11. public class PermissionConfiguration : IEntityTypeConfiguration<Permission>
  12. {
  13. public void Configure(EntityTypeBuilder<Permission> builder)
  14. {
  15. builder.HasData
  16. (
  17. #region Project
  18. new Permission()
  19. {
  20. Id = 1,
  21. Name = "Project",
  22. Desc = "Project",
  23. Show = true,
  24. CategoryName = "User"
  25. },
  26. new Permission()
  27. {
  28. Id = 2,
  29. Name = "Project.Create",
  30. Desc = "Project.Create",
  31. CategoryName = "User"
  32. },
  33. new Permission()
  34. {
  35. Id = 3,
  36. Name = "Project.Update",
  37. Desc = "Project.Update",
  38. CategoryName = "User"
  39. },
  40. new Permission()
  41. {
  42. Id = 4,
  43. Name = "Project.Delete",
  44. Desc = "Project.Delete",
  45. CategoryName = "User"
  46. },
  47. #endregion
  48. #region Meeting
  49. new Permission()
  50. {
  51. Id = 5,
  52. Name = "Meeting",
  53. Desc = "Meeting",
  54. Show = true,
  55. CategoryName = "User"
  56. },
  57. new Permission()
  58. {
  59. Id = 6,
  60. Name = "Meeting.Create",
  61. Desc = "Meeting.Create",
  62. CategoryName = "User"
  63. },
  64. new Permission()
  65. {
  66. Id = 7,
  67. Name = "Meeting.Update",
  68. Desc = "Meeting.Update",
  69. CategoryName = "User"
  70. },
  71. new Permission()
  72. {
  73. Id = 8,
  74. Name = "Meeting.Delete",
  75. Desc = "Meeting.Delete",
  76. CategoryName = "User"
  77. },
  78. #endregion
  79. #region Team
  80. new Permission()
  81. {
  82. Id = 9,
  83. Name = "Team",
  84. Desc = "Team",
  85. Show = true,
  86. CategoryName = "User"
  87. },
  88. new Permission()
  89. {
  90. Id = 10,
  91. Name = "Team.Create",
  92. Desc = "Team.Create",
  93. CategoryName = "User"
  94. },
  95. new Permission()
  96. {
  97. Id = 11,
  98. Name = "Team.Update",
  99. Desc = "Team.Update",
  100. CategoryName = "User"
  101. },
  102. new Permission()
  103. {
  104. Id = 12,
  105. Name = "Team.Delete",
  106. Desc = "Team.Delete",
  107. CategoryName = "User"
  108. },
  109. #endregion
  110. #region UserTask
  111. new Permission()
  112. {
  113. Id = 13,
  114. Name = "UserTask",
  115. Desc = "UserTask",
  116. Show = true,
  117. CategoryName = "Sales"
  118. },
  119. new Permission()
  120. {
  121. Id = 14,
  122. Name = "UserTask.Create",
  123. Desc = "UserTask.Create",
  124. CategoryName = "Sales"
  125. },
  126. new Permission()
  127. {
  128. Id = 15,
  129. Name = "UserTask.Update",
  130. Desc = "UserTask.Update",
  131. CategoryName = "Sales"
  132. },
  133. new Permission()
  134. {
  135. Id = 16,
  136. Name = "UserTask.Delete",
  137. Desc = "UserTask.Delete",
  138. CategoryName = "User"
  139. },
  140. #endregion
  141. #region Company
  142. new Permission()
  143. {
  144. Id = 17,
  145. Name = "Company",
  146. Desc = "Company",
  147. Show = true,
  148. CategoryName = "User"
  149. },
  150. new Permission()
  151. {
  152. Id = 18,
  153. Name = "Company.Create",
  154. Desc = "Company.Create",
  155. CategoryName = "User"
  156. },
  157. new Permission()
  158. {
  159. Id = 19,
  160. Name = "Company.Update",
  161. Desc = "Company.Update",
  162. CategoryName = "User"
  163. },
  164. new Permission()
  165. {
  166. Id = 20,
  167. Name = "Company.Delete",
  168. Desc = "Company.Delete",
  169. CategoryName = "User"
  170. },
  171. new Permission()
  172. {
  173. Id = 21,
  174. Name = "Company.Suspend",
  175. Desc = "Company.Suspend",
  176. CategoryName = "User"
  177. },
  178. #endregion
  179. #region User
  180. new Permission()
  181. {
  182. Id = 22,
  183. Name = "User",
  184. Desc = "User",
  185. Show = true,
  186. CategoryName = "Adminstration"
  187. },
  188. new Permission()
  189. {
  190. Id = 23,
  191. Name = "User.Create",
  192. Desc = "User.Create",
  193. CategoryName = "Adminstration"
  194. },
  195. new Permission()
  196. {
  197. Id = 24,
  198. Name = "User.Update",
  199. Desc = "User.Update",
  200. CategoryName = "Adminstration"
  201. },
  202. new Permission()
  203. {
  204. Id = 25,
  205. Name = "User.Delete",
  206. Desc = "User.Delete",
  207. CategoryName = "Adminstration"
  208. },
  209. new Permission()
  210. {
  211. Id = 26,
  212. Name = "User.Suspend",
  213. Desc = "User.Suspend",
  214. CategoryName = "Adminstration"
  215. },
  216. #endregion
  217. #region Role
  218. new Permission()
  219. {
  220. Id = 27,
  221. Name = "Role",
  222. Desc = "Role",
  223. Show = true,
  224. CategoryName = "Adminstration"
  225. },
  226. new Permission()
  227. {
  228. Id = 28,
  229. Name = "Role.Create",
  230. Desc = "Role.Create",
  231. CategoryName = "Adminstration"
  232. },
  233. new Permission()
  234. {
  235. Id = 29,
  236. Name = "Role.Update",
  237. Desc = "Role.Update",
  238. CategoryName = "Adminstration"
  239. },
  240. new Permission()
  241. {
  242. Id = 30,
  243. Name = "Role.Delete",
  244. Desc = "Role.Delete",
  245. CategoryName = "Adminstration"
  246. },
  247. #endregion
  248. #region Attendance
  249. new Permission()
  250. {
  251. Id = 31,
  252. Name = "Attendance",
  253. Desc = "Attendance",
  254. Show = true,
  255. CategoryName = "Adminstration"
  256. },
  257. new Permission()
  258. {
  259. Id = 32,
  260. Name = "Attendance.Create",
  261. Desc = "Attendance.Create",
  262. CategoryName = "Adminstration"
  263. },
  264. new Permission()
  265. {
  266. Id = 33,
  267. Name = "Attendance.Update",
  268. Desc = "Attendance.Update",
  269. CategoryName = "Adminstration"
  270. },
  271. new Permission()
  272. {
  273. Id = 34,
  274. Name = "Attendance.Delete",
  275. Desc = "Attendance.Delete",
  276. CategoryName = "Adminstration"
  277. },
  278. #endregion
  279. #region Contract
  280. new Permission()
  281. {
  282. Id = 35,
  283. Name = "Contract",
  284. Desc = "Contract",
  285. Show = true,
  286. CategoryName = "Adminstration"
  287. },
  288. new Permission()
  289. {
  290. Id = 36,
  291. Name = "Contract.Create",
  292. Desc = "Contract.Create",
  293. CategoryName = "Adminstration"
  294. },
  295. new Permission()
  296. {
  297. Id = 37,
  298. Name = "Contract.Update",
  299. Desc = "Contract.Update",
  300. CategoryName = "Adminstration"
  301. },
  302. new Permission()
  303. {
  304. Id = 38,
  305. Name = "Contract.Delete",
  306. Desc = "Contract.Delete",
  307. CategoryName = "Adminstration"
  308. },
  309. #endregion
  310. #region OrderAllocation
  311. new Permission()
  312. {
  313. Id = 39,
  314. Name = "OrderAllocation",
  315. Desc = "OrderAllocation",
  316. Show = true,
  317. CategoryName = "Adminstration"
  318. },
  319. new Permission()
  320. {
  321. Id = 40,
  322. Name = "OrderAllocation.Create",
  323. Desc = "OrderAllocation.Create",
  324. CategoryName = "Adminstration"
  325. },
  326. new Permission()
  327. {
  328. Id = 41,
  329. Name = "OrderAllocation.Update",
  330. Desc = "OrderAllocation.Update",
  331. CategoryName = "Adminstration"
  332. },
  333. new Permission()
  334. {
  335. Id = 42,
  336. Name = "OrderAllocation.Delete",
  337. Desc = "OrderAllocation.Delete",
  338. CategoryName = "Adminstration"
  339. },
  340. #endregion
  341. #region OrderRequest
  342. new Permission()
  343. {
  344. Id = 43,
  345. Name = "OrderRequest",
  346. Desc = "OrderRequest",
  347. Show = true,
  348. CategoryName = "Adminstration"
  349. },
  350. new Permission()
  351. {
  352. Id = 44,
  353. Name = "OrderRequest.Create",
  354. Desc = "OrderRequest.Create",
  355. CategoryName = "Adminstration"
  356. },
  357. new Permission()
  358. {
  359. Id = 45,
  360. Name = "OrderRequest.Update",
  361. Desc = "OrderRequest.Update",
  362. CategoryName = "Adminstration"
  363. },
  364. new Permission()
  365. {
  366. Id = 46,
  367. Name = "OrderRequest.Delete",
  368. Desc = "OrderRequest.Delete",
  369. CategoryName = "Adminstration"
  370. }
  371. #endregion
  372. , new Permission()
  373. {
  374. Id = 47,
  375. Name = "User.ResetPassword",
  376. Desc = "User.ResetPassword",
  377. CategoryName = "Adminstration"
  378. }
  379. );
  380. }
  381. }
  382. }