PermissionConfiguration.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. #endregion
  172. #region User
  173. new Permission()
  174. {
  175. Id = 21,
  176. Name = "User",
  177. Desc = "User",
  178. Show = true,
  179. CategoryName = "Adminstration"
  180. },
  181. new Permission()
  182. {
  183. Id = 22,
  184. Name = "User.Create",
  185. Desc = "User.Create",
  186. CategoryName = "Adminstration"
  187. },
  188. new Permission()
  189. {
  190. Id = 23,
  191. Name = "User.Update",
  192. Desc = "User.Update",
  193. CategoryName = "Adminstration"
  194. },
  195. new Permission()
  196. {
  197. Id = 24,
  198. Name = "User.Delete",
  199. Desc = "User.Delete",
  200. CategoryName = "Adminstration"
  201. },
  202. #endregion
  203. #region Role
  204. new Permission()
  205. {
  206. Id = 25,
  207. Name = "Role",
  208. Desc = "Role",
  209. Show = true,
  210. CategoryName = "Adminstration"
  211. },
  212. new Permission()
  213. {
  214. Id = 26,
  215. Name = "Role.Create",
  216. Desc = "Role.Create",
  217. CategoryName = "Adminstration"
  218. },
  219. new Permission()
  220. {
  221. Id = 27,
  222. Name = "Role.Update",
  223. Desc = "Role.Update",
  224. CategoryName = "Adminstration"
  225. },
  226. new Permission()
  227. {
  228. Id = 28,
  229. Name = "Role.Delete",
  230. Desc = "Role.Delete",
  231. CategoryName = "Adminstration"
  232. }
  233. #endregion
  234. );
  235. }
  236. }
  237. }