daevin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (536) hide show
  1. package/Daevin_test/.editorconfig +15 -0
  2. package/Daevin_test/.env.example +92 -0
  3. package/Daevin_test/.gitattributes +10 -0
  4. package/Daevin_test/CODE_OF_CONDUCT.md +3 -0
  5. package/Daevin_test/CONTRIBUTING.md +3 -0
  6. package/Daevin_test/LICENSE +21 -0
  7. package/Daevin_test/README.md +314 -0
  8. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiLoginProxyForWebClientAction.php +52 -0
  9. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiLogoutAction.php +23 -0
  10. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiRefreshProxyForWebClientAction.php +47 -0
  11. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ForgotPasswordAction.php +43 -0
  12. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/GetAuthenticatedUserAction.php +19 -0
  13. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/RegisterUserAction.php +39 -0
  14. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ResetPasswordAction.php +61 -0
  15. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/SendVerificationEmailAction.php +19 -0
  16. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/VerifyEmailAction.php +43 -0
  17. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/WebLoginAction.php +46 -0
  18. package/Daevin_test/app/Containers/AppSection/Authentication/Actions/WebLogoutAction.php +17 -0
  19. package/Daevin_test/app/Containers/AppSection/Authentication/Classes/LoginCustomAttribute.php +97 -0
  20. package/Daevin_test/app/Containers/AppSection/Authentication/Configs/appSection-authentication.php +117 -0
  21. package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/EmailNotVerifiedException.php +12 -0
  22. package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/InvalidEmailVerificationDataException.php +12 -0
  23. package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/InvalidResetPasswordTokenException.php +12 -0
  24. package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/LoginFailedException.php +12 -0
  25. package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/RefreshTokenMissingException.php +12 -0
  26. package/Daevin_test/app/Containers/AppSection/Authentication/Mails/ForgotPassword.php +32 -0
  27. package/Daevin_test/app/Containers/AppSection/Authentication/Mails/Templates/forgot-password.blade.php +73 -0
  28. package/Daevin_test/app/Containers/AppSection/Authentication/Middlewares/RedirectIfAuthenticated.php +35 -0
  29. package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/EmailVerified.php +26 -0
  30. package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/PasswordReset.php +26 -0
  31. package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/VerifyEmail.php +49 -0
  32. package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/Welcome.php +25 -0
  33. package/Daevin_test/app/Containers/AppSection/Authentication/Providers/AuthServiceProvider.php +76 -0
  34. package/Daevin_test/app/Containers/AppSection/Authentication/Providers/MainServiceProvider.php +32 -0
  35. package/Daevin_test/app/Containers/AppSection/Authentication/Providers/MiddlewareServiceProvider.php +19 -0
  36. package/Daevin_test/app/Containers/AppSection/Authentication/README.md +1 -0
  37. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CallOAuthServerTask.php +36 -0
  38. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CreatePasswordResetTokenTask.php +14 -0
  39. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CreateUserByCredentialsTask.php +34 -0
  40. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/LoginTask.php +14 -0
  41. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/MakeRefreshCookieTask.php +25 -0
  42. package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/SendVerificationEmailTask.php +16 -0
  43. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Stubs/oauth-private.key +51 -0
  44. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Stubs/oauth-public.key +14 -0
  45. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/TestCase.php +18 -0
  46. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/CreatePasswordResetTokenTaskTest.php +27 -0
  47. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/CreateUserByCredentialsTaskTest.php +42 -0
  48. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/ForgotPasswordActionTest.php +28 -0
  49. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/LoginCustomAttributeTest.php +48 -0
  50. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/RedirectIfAuthenticatedMiddlewareTest.php +44 -0
  51. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/RegisterUserActionTest.php +64 -0
  52. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/ResetPasswordActionTest.php +83 -0
  53. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/SendVerificationEmailTaskTest.php +40 -0
  54. package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/WebLoginActionTest.php +75 -0
  55. package/Daevin_test/app/Containers/AppSection/Authentication/Traits/AuthenticationTrait.php +25 -0
  56. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/ForgotPasswordController.php +24 -0
  57. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/GetAuthenticatedUserController.php +24 -0
  58. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/LoginProxyForWebClientController.php +33 -0
  59. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/LogoutController.php +25 -0
  60. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/RefreshProxyForWebClientController.php +35 -0
  61. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/RegisterUserController.php +24 -0
  62. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/ResetPasswordController.php +30 -0
  63. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/SendVerificationEmailController.php +22 -0
  64. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/VerifyEmailController.php +26 -0
  65. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/ForgotPasswordRequest.php +50 -0
  66. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/GetAuthenticatedUserRequest.php +45 -0
  67. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/LoginProxyPasswordGrantRequest.php +57 -0
  68. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/LogoutRequest.php +51 -0
  69. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/RefreshProxyRequest.php +51 -0
  70. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/RegisterUserRequest.php +61 -0
  71. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/ResetPasswordRequest.php +55 -0
  72. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/SendVerificationEmailRequest.php +56 -0
  73. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/VerifyEmailRequest.php +51 -0
  74. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/ForgotPassword.v1.public.php +26 -0
  75. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/GetAuthenticatedUser.v1.private.php +23 -0
  76. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginProxyForWebClient.v1.public.php +30 -0
  77. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginUsingCredentialGrant.v1.public.php +29 -0
  78. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginUsingPasswordGrant.v1.private.php +31 -0
  79. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/Logout.v1.public.php +26 -0
  80. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/RefreshProxyForWebClient.v1.public.php +29 -0
  81. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/RegisterUser.v1.private.php +38 -0
  82. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/ResetPassword.v1.public.php +37 -0
  83. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/SendVerificationEmail.v1.public.php +32 -0
  84. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/VerifyEmail.v1.public.php +35 -0
  85. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/ApiTestCase.php +74 -0
  86. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiLoginProxyForWebClientTest.php +129 -0
  87. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiLogoutTest.php +28 -0
  88. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiRefreshProxyForWebClientTest.php +86 -0
  89. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ForgotPasswordTest.php +56 -0
  90. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php +76 -0
  91. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/RegisterUserTest.php +208 -0
  92. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ResetPasswordTest.php +79 -0
  93. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/SendVerificationEmailTest.php +95 -0
  94. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/Stubs/oauth-private.key +51 -0
  95. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/Stubs/oauth-public.key +14 -0
  96. package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/VerifyEmailTest.php +84 -0
  97. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Controllers/LoginController.php +39 -0
  98. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Controllers/LogoutController.php +25 -0
  99. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Requests/LoginRequest.php +54 -0
  100. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Requests/LogoutRequest.php +50 -0
  101. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/GetLogin.v1.public.php +8 -0
  102. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/PostLogin.v1.public.php +8 -0
  103. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/PostLogout.php +7 -0
  104. package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Views/login.blade.php +121 -0
  105. package/Daevin_test/app/Containers/AppSection/Authentication/composer.json +11 -0
  106. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AssignRolesToUserAction.php +32 -0
  107. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AttachPermissionsToRoleAction.php +31 -0
  108. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AttachPermissionsToUserAction.php +31 -0
  109. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/CreatePermissionAction.php +22 -0
  110. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/CreateRoleAction.php +22 -0
  111. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DeleteRoleAction.php +22 -0
  112. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DetachPermissionsFromRoleAction.php +30 -0
  113. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DetachPermissionsFromUserAction.php +31 -0
  114. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/FindPermissionAction.php +22 -0
  115. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/FindRoleAction.php +22 -0
  116. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetAllPermissionsAction.php +21 -0
  117. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetAllRolesAction.php +21 -0
  118. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetRolePermissionsAction.php +23 -0
  119. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetUserPermissionsAction.php +23 -0
  120. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetUserRolesAction.php +23 -0
  121. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/RevokeRolesFromUserAction.php +40 -0
  122. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/SyncPermissionsOnRoleAction.php +33 -0
  123. package/Daevin_test/app/Containers/AppSection/Authorization/Actions/SyncUserRolesAction.php +33 -0
  124. package/Daevin_test/app/Containers/AppSection/Authorization/Configs/appSection-authorization.php +24 -0
  125. package/Daevin_test/app/Containers/AppSection/Authorization/Configs/permission.php +161 -0
  126. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Factories/PermissionFactory.php +19 -0
  127. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Factories/RoleFactory.php +28 -0
  128. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2016_12_29_201047_create_permission_tables.php +141 -0
  129. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2017_04_22_122453_add_extra_fields_to_permissions_tale.php +30 -0
  130. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2017_04_22_122522_add_extra_fields_to_roles_table.php +30 -0
  131. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Repositories/PermissionRepository.php +19 -0
  132. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Repositories/RoleRepository.php +19 -0
  133. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationDefaultUsersSeeder_4.php +36 -0
  134. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php +24 -0
  135. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationPermissionsSeeder_1.php +27 -0
  136. package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationRolesSeeder_2.php +21 -0
  137. package/Daevin_test/app/Containers/AppSection/Authorization/Models/Permission.php +27 -0
  138. package/Daevin_test/app/Containers/AppSection/Authorization/Models/Role.php +27 -0
  139. package/Daevin_test/app/Containers/AppSection/Authorization/Providers/MainServiceProvider.php +27 -0
  140. package/Daevin_test/app/Containers/AppSection/Authorization/README.md +1 -0
  141. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/AssignRolesToUserTask.php +21 -0
  142. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/CreatePermissionTask.php +41 -0
  143. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/CreateRoleTask.php +41 -0
  144. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DeleteRoleTask.php +35 -0
  145. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DetachPermissionsFromRoleTask.php +24 -0
  146. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DetachPermissionsFromUserTask.php +24 -0
  147. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/FindPermissionTask.php +49 -0
  148. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/FindRoleTask.php +49 -0
  149. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/GetAllPermissionsTask.php +40 -0
  150. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/GetAllRolesTask.php +40 -0
  151. package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/RevokeRoleFromUserTask.php +21 -0
  152. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/TestCase.php +18 -0
  153. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/CreatePermissionTaskTest.php +29 -0
  154. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/CreateRoleTaskTest.php +29 -0
  155. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/DeleteRoleTaskTest.php +36 -0
  156. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/FindPermissionTaskTest.php +44 -0
  157. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/FindRoleTaskTest.php +44 -0
  158. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/PermissionFactoryTest.php +22 -0
  159. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/PermissionMigrationTest.php +95 -0
  160. package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/RoleFactoryTest.php +33 -0
  161. package/Daevin_test/app/Containers/AppSection/Authorization/Traits/AuthorizationTrait.php +11 -0
  162. package/Daevin_test/app/Containers/AppSection/Authorization/Traits/IsResourceOwnerTrait.php +19 -0
  163. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AssignRolesToUserController.php +26 -0
  164. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AttachPermissionsToRoleController.php +26 -0
  165. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AttachPermissionsToUserController.php +27 -0
  166. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/CreateRoleController.php +27 -0
  167. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DeleteRoleController.php +26 -0
  168. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DetachPermissionsFromRoleController.php +26 -0
  169. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DetachPermissionsFromUserController.php +26 -0
  170. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/FindPermissionController.php +26 -0
  171. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/FindRoleController.php +26 -0
  172. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetAllPermissionsController.php +28 -0
  173. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetAllRolesController.php +28 -0
  174. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetRolePermissionsController.php +26 -0
  175. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetUserPermissionsController.php +26 -0
  176. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetUserRolesController.php +27 -0
  177. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/RevokeRolesFromUserController.php +26 -0
  178. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/SyncPermissionOnRoleController.php +26 -0
  179. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/SyncUserRolesController.php +26 -0
  180. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AssignRolesToUserRequest.php +48 -0
  181. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AttachPermissionsToRoleRequest.php +48 -0
  182. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AttachPermissionsToUserRequest.php +53 -0
  183. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/CreateRoleRequest.php +47 -0
  184. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DeleteRoleRequest.php +45 -0
  185. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DetachPermissionsFromRoleRequest.php +48 -0
  186. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DetachPermissionsFromUserRequest.php +53 -0
  187. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/FindPermissionRequest.php +45 -0
  188. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/FindRoleRequest.php +45 -0
  189. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetAllPermissionsRequest.php +45 -0
  190. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetAllRolesRequest.php +45 -0
  191. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetRolePermissionsRequest.php +51 -0
  192. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetUserPermissionsRequest.php +51 -0
  193. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetUserRolesRequest.php +51 -0
  194. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/RevokeRolesFromUserRequest.php +48 -0
  195. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/SyncPermissionsOnRoleRequest.php +48 -0
  196. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/SyncUserRolesRequest.php +48 -0
  197. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AssignRolesToUser.v1.private.php +29 -0
  198. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AttachPermissionsToRole.v1.private.php +29 -0
  199. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AttachPermissionsToUser.v1.private.php +27 -0
  200. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/CreateRole.v1.private.php +25 -0
  201. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DeleteRole.v1.private.php +28 -0
  202. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DetachPermissionsFromRole.v1.private.php +29 -0
  203. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DetachPermissionsFromUser.v1.private.php +27 -0
  204. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/FindPermission.v1.private.php +23 -0
  205. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/FindRole.v1.private.php +23 -0
  206. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetAllPermissions.v1.private.php +21 -0
  207. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetAllRoles.v1.private.php +21 -0
  208. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetRolePermissions.v1.private.php +25 -0
  209. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetUserPermissions.v1.private.php +25 -0
  210. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetUserRoles.v1.private.php +25 -0
  211. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/RevokeRolesFromUser.v1.private.php +29 -0
  212. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/SyncPermissionOnRole.v1.private.php +26 -0
  213. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/SyncUserRoles.v1.private.php +27 -0
  214. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_permission.v1.public.php +25 -0
  215. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_role.v1.public.php +43 -0
  216. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_userPermissions.v1.public.php +48 -0
  217. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/ApiTestCase.php +15 -0
  218. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AssignRolesToUserTest.php +71 -0
  219. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AttachPermissionToUserTest.php +114 -0
  220. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AttachPermissionsToRoleTest.php +115 -0
  221. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/CreateRoleTest.php +65 -0
  222. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DeleteRoleTest.php +40 -0
  223. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DetachPermissionFromUserTest.php +120 -0
  224. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DetachPermissionsFromRoleTest.php +115 -0
  225. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/FindPermissionTest.php +42 -0
  226. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/FindRoleTest.php +42 -0
  227. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetAllPermissionsTest.php +30 -0
  228. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetAllRolesTest.php +32 -0
  229. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetRolePermissionsTest.php +39 -0
  230. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetUserPermissionsTest.php +40 -0
  231. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetUserRolesTest.php +40 -0
  232. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/RevokeRolesFromUserTest.php +115 -0
  233. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/SyncPermissionsOnRoleTest.php +92 -0
  234. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/SyncUserRolesTest.php +93 -0
  235. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Transformers/PermissionTransformer.php +28 -0
  236. package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Transformers/RoleTransformer.php +34 -0
  237. package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Controllers/UnauthorizedController.php +19 -0
  238. package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Requests/UnauthorizedRequest.php +49 -0
  239. package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Routes/GetUnauthorized.php +7 -0
  240. package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Views/unauthorized.blade.php +43 -0
  241. package/Daevin_test/app/Containers/AppSection/Authorization/composer.json +11 -0
  242. package/Daevin_test/app/Containers/AppSection/Posts/Actions/CreatePostsAction.php +26 -0
  243. package/Daevin_test/app/Containers/AppSection/Posts/Actions/DeletePostsAction.php +18 -0
  244. package/Daevin_test/app/Containers/AppSection/Posts/Actions/FindPostsByIdAction.php +18 -0
  245. package/Daevin_test/app/Containers/AppSection/Posts/Actions/GetAllPostsAction.php +23 -0
  246. package/Daevin_test/app/Containers/AppSection/Posts/Actions/UpdatePostsAction.php +26 -0
  247. package/Daevin_test/app/Containers/AppSection/Posts/Configs/appSection-posts.php +14 -0
  248. package/Daevin_test/app/Containers/AppSection/Posts/Data/Factories/PostsFactory.php +22 -0
  249. package/Daevin_test/app/Containers/AppSection/Posts/Data/Migrations/2023_2_19_55939_create_posts_migration.php +30 -0
  250. package/Daevin_test/app/Containers/AppSection/Posts/Data/Repositories/PostsRepository.php +17 -0
  251. package/Daevin_test/app/Containers/AppSection/Posts/Models/Posts.php +42 -0
  252. package/Daevin_test/app/Containers/AppSection/Posts/Posts.json +7 -0
  253. package/Daevin_test/app/Containers/AppSection/Posts/README.md +194 -0
  254. package/Daevin_test/app/Containers/AppSection/Posts/Tasks/CreatePostsTask.php +34 -0
  255. package/Daevin_test/app/Containers/AppSection/Posts/Tasks/DeletePostsTask.php +35 -0
  256. package/Daevin_test/app/Containers/AppSection/Posts/Tasks/FindPostsByIdTask.php +33 -0
  257. package/Daevin_test/app/Containers/AppSection/Posts/Tasks/GetAllPostsTask.php +31 -0
  258. package/Daevin_test/app/Containers/AppSection/Posts/Tasks/UpdatePostsTask.php +33 -0
  259. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Controllers/Controller.php +94 -0
  260. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/CreatePostsRequest.php +54 -0
  261. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/DeletePostsRequest.php +54 -0
  262. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/FindPostsByIdRequest.php +53 -0
  263. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/GetAllPostsRequest.php +54 -0
  264. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/UpdatePostsRequest.php +56 -0
  265. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/CreatePostsRoute.v1.private.php +52 -0
  266. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/DeletePostsRoute.v1.private.php +31 -0
  267. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/FindPostsByIdRoute.v1.private.php +52 -0
  268. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/GetAllPostsRoute.v1.private.php +74 -0
  269. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/UpdatePostsRoute.v1.private.php +52 -0
  270. package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Transformers/PostsTransformer.php +49 -0
  271. package/Daevin_test/app/Containers/AppSection/Posts/composer.json +7 -0
  272. package/Daevin_test/app/Containers/AppSection/User/Actions/CreateAdminAction.php +39 -0
  273. package/Daevin_test/app/Containers/AppSection/User/Actions/DeleteUserAction.php +22 -0
  274. package/Daevin_test/app/Containers/AppSection/User/Actions/FindUserByIdAction.php +22 -0
  275. package/Daevin_test/app/Containers/AppSection/User/Actions/GetAllUsersAction.php +21 -0
  276. package/Daevin_test/app/Containers/AppSection/User/Actions/UpdateUserAction.php +33 -0
  277. package/Daevin_test/app/Containers/AppSection/User/Actions/UpdateUserPasswordAction.php +35 -0
  278. package/Daevin_test/app/Containers/AppSection/User/Configs/appSection-user.php +5 -0
  279. package/Daevin_test/app/Containers/AppSection/User/Data/Factories/UserFactory.php +44 -0
  280. package/Daevin_test/app/Containers/AppSection/User/Data/Migrations/2000_01_01_000001_create_users_table.php +34 -0
  281. package/Daevin_test/app/Containers/AppSection/User/Data/Migrations/2000_01_01_000002_create_password_resets_table.php +28 -0
  282. package/Daevin_test/app/Containers/AppSection/User/Data/Repositories/UserRepository.php +21 -0
  283. package/Daevin_test/app/Containers/AppSection/User/Data/Seeders/UserPermissionsSeeder_1.php +26 -0
  284. package/Daevin_test/app/Containers/AppSection/User/Models/User.php +58 -0
  285. package/Daevin_test/app/Containers/AppSection/User/Notifications/PasswordUpdatedNotification.php +28 -0
  286. package/Daevin_test/app/Containers/AppSection/User/Providers/MainServiceProvider.php +39 -0
  287. package/Daevin_test/app/Containers/AppSection/User/README.md +1 -0
  288. package/Daevin_test/app/Containers/AppSection/User/Tasks/DeleteUserTask.php +35 -0
  289. package/Daevin_test/app/Containers/AppSection/User/Tasks/FindUserByEmailTask.php +28 -0
  290. package/Daevin_test/app/Containers/AppSection/User/Tasks/FindUserByIdTask.php +31 -0
  291. package/Daevin_test/app/Containers/AppSection/User/Tasks/GetAllUsersTask.php +26 -0
  292. package/Daevin_test/app/Containers/AppSection/User/Tasks/UpdateUserTask.php +42 -0
  293. package/Daevin_test/app/Containers/AppSection/User/Tests/TestCase.php +18 -0
  294. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/CreateAdminActionTest.php +50 -0
  295. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/DeleteUserTaskTest.php +35 -0
  296. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/FindUserByIdTaskTest.php +35 -0
  297. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/PasswordResetsMigrationTest.php +28 -0
  298. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UpdateUserTaskTest.php +52 -0
  299. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UserFactoryTest.php +36 -0
  300. package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UsersMigrationTest.php +34 -0
  301. package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/DeleteUserController.php +26 -0
  302. package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/FindUserByIdController.php +26 -0
  303. package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/GetAllUsersController.php +28 -0
  304. package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/UpdateUserController.php +30 -0
  305. package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/UpdateUserPasswordController.php +30 -0
  306. package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/DeleteUserRequest.php +48 -0
  307. package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/FindUserByIdRequest.php +45 -0
  308. package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/GetAllUsersRequest.php +45 -0
  309. package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/UpdateUserPasswordRequest.php +56 -0
  310. package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/UpdateUserRequest.php +50 -0
  311. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/DeleteUser.v1.private.php +26 -0
  312. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/FindUserById.v1.private.php +24 -0
  313. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/GetAllUsers.v1.private.php +23 -0
  314. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/UpdateUser.v1.private.php +27 -0
  315. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/UpdateUserPassword.v1.private.php +36 -0
  316. package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/_user.v1.public.php +25 -0
  317. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/ApiTestCase.php +15 -0
  318. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/DeleteUserTest.php +50 -0
  319. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/FindUserByIdTest.php +80 -0
  320. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/GetAllUsersTest.php +88 -0
  321. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/UpdateUserPasswordTest.php +126 -0
  322. package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/UpdateUserTest.php +80 -0
  323. package/Daevin_test/app/Containers/AppSection/User/UI/API/Transformers/UserTransformer.php +52 -0
  324. package/Daevin_test/app/Containers/AppSection/User/UI/CLI/Commands/CreateAdminCommand.php +37 -0
  325. package/Daevin_test/app/Containers/AppSection/User/composer.json +7 -0
  326. package/Daevin_test/app/Containers/AppSection/Users/Actions/CreateUsersAction.php +26 -0
  327. package/Daevin_test/app/Containers/AppSection/Users/Actions/DeleteUsersAction.php +18 -0
  328. package/Daevin_test/app/Containers/AppSection/Users/Actions/FindUsersByIdAction.php +18 -0
  329. package/Daevin_test/app/Containers/AppSection/Users/Actions/GetAllUsersAction.php +23 -0
  330. package/Daevin_test/app/Containers/AppSection/Users/Actions/UpdateUsersAction.php +26 -0
  331. package/Daevin_test/app/Containers/AppSection/Users/Configs/appSection-users.php +14 -0
  332. package/Daevin_test/app/Containers/AppSection/Users/Data/Factories/UsersFactory.php +22 -0
  333. package/Daevin_test/app/Containers/AppSection/Users/Data/Migrations/2023_2_19_55939_create_users_migration.php +31 -0
  334. package/Daevin_test/app/Containers/AppSection/Users/Data/Repositories/UsersRepository.php +17 -0
  335. package/Daevin_test/app/Containers/AppSection/Users/Models/Users.php +44 -0
  336. package/Daevin_test/app/Containers/AppSection/Users/README.md +194 -0
  337. package/Daevin_test/app/Containers/AppSection/Users/Tasks/CreateUsersTask.php +34 -0
  338. package/Daevin_test/app/Containers/AppSection/Users/Tasks/DeleteUsersTask.php +35 -0
  339. package/Daevin_test/app/Containers/AppSection/Users/Tasks/FindUsersByIdTask.php +33 -0
  340. package/Daevin_test/app/Containers/AppSection/Users/Tasks/GetAllUsersTask.php +31 -0
  341. package/Daevin_test/app/Containers/AppSection/Users/Tasks/UpdateUsersTask.php +33 -0
  342. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Controllers/Controller.php +94 -0
  343. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/CreateUsersRequest.php +55 -0
  344. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/DeleteUsersRequest.php +54 -0
  345. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/FindUsersByIdRequest.php +53 -0
  346. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/GetAllUsersRequest.php +54 -0
  347. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/UpdateUsersRequest.php +57 -0
  348. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/CreateUsersRoute.v1.private.php +53 -0
  349. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/DeleteUsersRoute.v1.private.php +31 -0
  350. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/FindUsersByIdRoute.v1.private.php +53 -0
  351. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/GetAllUsersRoute.v1.private.php +75 -0
  352. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/UpdateUsersRoute.v1.private.php +53 -0
  353. package/Daevin_test/app/Containers/AppSection/Users/UI/API/Transformers/UsersTransformer.php +49 -0
  354. package/Daevin_test/app/Containers/AppSection/Users/Users.json +7 -0
  355. package/Daevin_test/app/Containers/AppSection/Users/composer.json +7 -0
  356. package/Daevin_test/app/Ship/Broadcasts/channels.php +16 -0
  357. package/Daevin_test/app/Ship/Commands/HelloWorldCommand.php +32 -0
  358. package/Daevin_test/app/Ship/Commands/closures.php +19 -0
  359. package/Daevin_test/app/Ship/Configs/apiato.php +185 -0
  360. package/Daevin_test/app/Ship/Configs/debugbar.php +275 -0
  361. package/Daevin_test/app/Ship/Configs/fractal.php +43 -0
  362. package/Daevin_test/app/Ship/Configs/hashids.php +54 -0
  363. package/Daevin_test/app/Ship/Configs/ide-helper.php +319 -0
  364. package/Daevin_test/app/Ship/Configs/notification.php +16 -0
  365. package/Daevin_test/app/Ship/Configs/repository.php +250 -0
  366. package/Daevin_test/app/Ship/Contracts/MustVerifyEmail.php +14 -0
  367. package/Daevin_test/app/Ship/Criterias/CreatedTodayCriteria.php +15 -0
  368. package/Daevin_test/app/Ship/Criterias/GroupByCriteria.php +21 -0
  369. package/Daevin_test/app/Ship/Criterias/IsNullCriteria.php +21 -0
  370. package/Daevin_test/app/Ship/Criterias/NotNullCriteria.php +21 -0
  371. package/Daevin_test/app/Ship/Criterias/OrderByCreationDateAscendingCriteria.php +14 -0
  372. package/Daevin_test/app/Ship/Criterias/OrderByCreationDateDescendingCriteria.php +14 -0
  373. package/Daevin_test/app/Ship/Criterias/OrderByFieldCriteria.php +37 -0
  374. package/Daevin_test/app/Ship/Criterias/OrderByNameCriteria.php +14 -0
  375. package/Daevin_test/app/Ship/Criterias/OrderByUpdateDateAscendingCriteria.php +14 -0
  376. package/Daevin_test/app/Ship/Criterias/OrderByUpdateDateDescendingCriteria.php +14 -0
  377. package/Daevin_test/app/Ship/Criterias/ThisBetweenDatesCriteria.php +21 -0
  378. package/Daevin_test/app/Ship/Criterias/ThisEqualThatCriteria.php +20 -0
  379. package/Daevin_test/app/Ship/Criterias/ThisLikeThatCriteria.php +35 -0
  380. package/Daevin_test/app/Ship/Criterias/ThisUserCriteria.php +19 -0
  381. package/Daevin_test/app/Ship/Events/.gitkeep +0 -0
  382. package/Daevin_test/app/Ship/Exceptions/CreateResourceFailedException.php +12 -0
  383. package/Daevin_test/app/Ship/Exceptions/DeleteResourceFailedException.php +12 -0
  384. package/Daevin_test/app/Ship/Exceptions/EmailIsMissedException.php +12 -0
  385. package/Daevin_test/app/Ship/Exceptions/Handlers/ExceptionsHandler.php +107 -0
  386. package/Daevin_test/app/Ship/Exceptions/InternalErrorException.php +12 -0
  387. package/Daevin_test/app/Ship/Exceptions/NotAuthorizedResourceException.php +12 -0
  388. package/Daevin_test/app/Ship/Exceptions/NotFoundException.php +12 -0
  389. package/Daevin_test/app/Ship/Exceptions/NotImplementedException.php +12 -0
  390. package/Daevin_test/app/Ship/Exceptions/UnsupportedFractalSerializerException.php +12 -0
  391. package/Daevin_test/app/Ship/Exceptions/UpdateResourceFailedException.php +12 -0
  392. package/Daevin_test/app/Ship/Exceptions/ValidationFailedException.php +12 -0
  393. package/Daevin_test/app/Ship/Generators/CustomStubs/.gitkeep +0 -0
  394. package/Daevin_test/app/Ship/Helpers/helpers.php +12 -0
  395. package/Daevin_test/app/Ship/Kernels/ConsoleKernel.php +46 -0
  396. package/Daevin_test/app/Ship/Kernels/HttpKernel.php +113 -0
  397. package/Daevin_test/app/Ship/Listeners/.gitkeep +0 -0
  398. package/Daevin_test/app/Ship/Mails/.gitkeep +0 -0
  399. package/Daevin_test/app/Ship/Mails/Templates/.gitkeep +0 -0
  400. package/Daevin_test/app/Ship/Middlewares/Authenticate.php +16 -0
  401. package/Daevin_test/app/Ship/Middlewares/EncryptCookies.php +17 -0
  402. package/Daevin_test/app/Ship/Middlewares/PreventRequestsDuringMaintenance.php +17 -0
  403. package/Daevin_test/app/Ship/Middlewares/TrimStrings.php +19 -0
  404. package/Daevin_test/app/Ship/Middlewares/TrustHosts.php +20 -0
  405. package/Daevin_test/app/Ship/Middlewares/TrustProxies.php +28 -0
  406. package/Daevin_test/app/Ship/Middlewares/VerifyCsrfToken.php +17 -0
  407. package/Daevin_test/app/Ship/Migrations/2017_09_12_174826_create_notifications_table.php +35 -0
  408. package/Daevin_test/app/Ship/Migrations/2019_08_19_000000_create_failed_jobs_table.php +36 -0
  409. package/Daevin_test/app/Ship/Migrations/2021_03_01_150940_create_jobs_table.php +39 -0
  410. package/Daevin_test/app/Ship/Notifications/.gitkeep +0 -0
  411. package/Daevin_test/app/Ship/Parents/Actions/Action.php +10 -0
  412. package/Daevin_test/app/Ship/Parents/Actions/SubAction.php +10 -0
  413. package/Daevin_test/app/Ship/Parents/Commands/ConsoleCommand.php +10 -0
  414. package/Daevin_test/app/Ship/Parents/Controllers/ApiController.php +10 -0
  415. package/Daevin_test/app/Ship/Parents/Controllers/WebController.php +10 -0
  416. package/Daevin_test/app/Ship/Parents/Criterias/Criteria.php +10 -0
  417. package/Daevin_test/app/Ship/Parents/Events/Event.php +10 -0
  418. package/Daevin_test/app/Ship/Parents/Exceptions/Exception.php +10 -0
  419. package/Daevin_test/app/Ship/Parents/Factories/Factory.php +10 -0
  420. package/Daevin_test/app/Ship/Parents/Jobs/Job.php +25 -0
  421. package/Daevin_test/app/Ship/Parents/Listeners/Listener.php +10 -0
  422. package/Daevin_test/app/Ship/Parents/Mails/Mail.php +10 -0
  423. package/Daevin_test/app/Ship/Parents/Middlewares/Middleware.php +10 -0
  424. package/Daevin_test/app/Ship/Parents/Models/Model.php +11 -0
  425. package/Daevin_test/app/Ship/Parents/Models/UserModel.php +17 -0
  426. package/Daevin_test/app/Ship/Parents/Notifications/Notification.php +10 -0
  427. package/Daevin_test/app/Ship/Parents/Policies/Policy.php +26 -0
  428. package/Daevin_test/app/Ship/Parents/Providers/AuthServiceProvider.php +20 -0
  429. package/Daevin_test/app/Ship/Parents/Providers/BroadcastServiceProvider.php +26 -0
  430. package/Daevin_test/app/Ship/Parents/Providers/EventServiceProvider.php +40 -0
  431. package/Daevin_test/app/Ship/Parents/Providers/MainServiceProvider.php +24 -0
  432. package/Daevin_test/app/Ship/Parents/Providers/MiddlewareServiceProvider.php +16 -0
  433. package/Daevin_test/app/Ship/Parents/Providers/RouteServiceProvider.php +24 -0
  434. package/Daevin_test/app/Ship/Parents/Repositories/Repository.php +10 -0
  435. package/Daevin_test/app/Ship/Parents/Requests/Request.php +10 -0
  436. package/Daevin_test/app/Ship/Parents/Seeders/Seeder.php +10 -0
  437. package/Daevin_test/app/Ship/Parents/Tasks/Task.php +10 -0
  438. package/Daevin_test/app/Ship/Parents/Tests/PhpUnit/TestCase.php +51 -0
  439. package/Daevin_test/app/Ship/Parents/Transformers/Transformer.php +25 -0
  440. package/Daevin_test/app/Ship/Parents/Values/Value.php +9 -0
  441. package/Daevin_test/app/Ship/Providers/RouteServiceProvider.php +35 -0
  442. package/Daevin_test/app/Ship/Providers/ShipProvider.php +44 -0
  443. package/Daevin_test/app/Ship/Seeders/SeedDeploymentData.php +18 -0
  444. package/Daevin_test/app/Ship/Seeders/SeedTestingData.php +18 -0
  445. package/Daevin_test/app/Ship/Tests/TestCase.php +10 -0
  446. package/Daevin_test/app/Ship/composer.json +21 -0
  447. package/Daevin_test/artisan +53 -0
  448. package/Daevin_test/bootstrap/app.php +55 -0
  449. package/Daevin_test/bootstrap/cache/.gitignore +2 -0
  450. package/Daevin_test/composer.json +112 -0
  451. package/Daevin_test/composer.lock +12696 -0
  452. package/Daevin_test/config/app.php +206 -0
  453. package/Daevin_test/config/auth.php +117 -0
  454. package/Daevin_test/config/broadcasting.php +67 -0
  455. package/Daevin_test/config/cache.php +110 -0
  456. package/Daevin_test/config/cors.php +34 -0
  457. package/Daevin_test/config/database.php +151 -0
  458. package/Daevin_test/config/filesystems.php +76 -0
  459. package/Daevin_test/config/hashing.php +52 -0
  460. package/Daevin_test/config/logging.php +119 -0
  461. package/Daevin_test/config/mail.php +117 -0
  462. package/Daevin_test/config/queue.php +93 -0
  463. package/Daevin_test/config/services.php +34 -0
  464. package/Daevin_test/config/session.php +201 -0
  465. package/Daevin_test/config/view.php +36 -0
  466. package/Daevin_test/database/factories/ModelFactory.php +4 -0
  467. package/Daevin_test/database/migrations/.gitkeep +0 -0
  468. package/Daevin_test/database/seeders/DatabaseSeeder.php +24 -0
  469. package/Daevin_test/lang/ar/auth.php +19 -0
  470. package/Daevin_test/lang/ar/pagination.php +19 -0
  471. package/Daevin_test/lang/ar/passwords.php +22 -0
  472. package/Daevin_test/lang/ar/validation.php +149 -0
  473. package/Daevin_test/lang/en/auth.php +20 -0
  474. package/Daevin_test/lang/en/pagination.php +19 -0
  475. package/Daevin_test/lang/en/passwords.php +22 -0
  476. package/Daevin_test/lang/en/validation.php +169 -0
  477. package/Daevin_test/lang/es/auth.php +19 -0
  478. package/Daevin_test/lang/es/pagination.php +19 -0
  479. package/Daevin_test/lang/es/passwords.php +22 -0
  480. package/Daevin_test/lang/es/validation.php +149 -0
  481. package/Daevin_test/lang/fa/auth.php +18 -0
  482. package/Daevin_test/lang/fa/pagination.php +17 -0
  483. package/Daevin_test/lang/fa/passwords.php +20 -0
  484. package/Daevin_test/lang/fa/validation.php +182 -0
  485. package/Daevin_test/lang/fr/auth.php +19 -0
  486. package/Daevin_test/lang/fr/pagination.php +19 -0
  487. package/Daevin_test/lang/fr/passwords.php +22 -0
  488. package/Daevin_test/lang/fr/validation.php +149 -0
  489. package/Daevin_test/package-lock.json +10031 -0
  490. package/Daevin_test/package.json +19 -0
  491. package/Daevin_test/php_cs.dist.php +39 -0
  492. package/Daevin_test/phpspec.yml +5 -0
  493. package/Daevin_test/phpunit.xml +38 -0
  494. package/Daevin_test/psalm.dist.xml +18 -0
  495. package/Daevin_test/public/.htaccess +21 -0
  496. package/Daevin_test/public/favicon.ico +0 -0
  497. package/Daevin_test/public/index.php +55 -0
  498. package/Daevin_test/public/robots.txt +2 -0
  499. package/Daevin_test/public/web.config +28 -0
  500. package/Daevin_test/resources/css/app.css +0 -0
  501. package/Daevin_test/resources/js/app.js +1 -0
  502. package/Daevin_test/resources/js/bootstrap.js +28 -0
  503. package/Daevin_test/resources/views/.gitkeep +0 -0
  504. package/Daevin_test/server.php +21 -0
  505. package/Daevin_test/storage/app/.gitignore +3 -0
  506. package/Daevin_test/storage/app/public/.gitignore +2 -0
  507. package/Daevin_test/storage/debugbar/.gitignore +2 -0
  508. package/Daevin_test/storage/framework/cache/.gitignore +2 -0
  509. package/Daevin_test/storage/framework/sessions/.gitignore +2 -0
  510. package/Daevin_test/storage/framework/testing/.gitignore +2 -0
  511. package/Daevin_test/storage/framework/views/.gitignore +2 -0
  512. package/Daevin_test/storage/logs/.gitignore +2 -0
  513. package/Daevin_test/webpack.mix.js +17 -0
  514. package/bin/classes/Apiato/index.js +208 -0
  515. package/bin/classes/Containers/Action.js +169 -0
  516. package/bin/classes/Containers/ComposerJSON.js +27 -0
  517. package/bin/classes/Containers/Config.js +39 -0
  518. package/bin/classes/Containers/Controller.js +120 -0
  519. package/bin/classes/Containers/Factory.js +47 -0
  520. package/bin/classes/Containers/Migration.js +80 -0
  521. package/bin/classes/Containers/Model.js +126 -0
  522. package/bin/classes/Containers/ReadMe.js +212 -0
  523. package/bin/classes/Containers/Repository.js +54 -0
  524. package/bin/classes/Containers/Request.js +341 -0
  525. package/bin/classes/Containers/Route.js +336 -0
  526. package/bin/classes/Containers/Task.js +225 -0
  527. package/bin/classes/Containers/Transformer.js +94 -0
  528. package/bin/classes/Helpers.js +150 -0
  529. package/bin/classes/tes.js +0 -0
  530. package/bin/constants.js +11 -0
  531. package/bin/core/output.json +13 -0
  532. package/bin/core/schemaToSql.js +118 -0
  533. package/bin/core/sqlToSchema.js +206 -0
  534. package/bin/index.js +103 -0
  535. package/dbconfig.json +74 -0
  536. package/package.json +39 -0
@@ -0,0 +1,33 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Actions;
4
+
5
+ use App\Containers\AppSection\Authorization\Tasks\FindRoleTask;
6
+ use App\Containers\AppSection\Authorization\UI\API\Requests\SyncUserRolesRequest;
7
+ use App\Containers\AppSection\User\Models\User;
8
+ use App\Containers\AppSection\User\Tasks\FindUserByIdTask;
9
+ use App\Ship\Exceptions\NotFoundException;
10
+ use App\Ship\Parents\Actions\Action as ParentAction;
11
+
12
+ class SyncUserRolesAction extends ParentAction
13
+ {
14
+ /**
15
+ * @param SyncUserRolesRequest $request
16
+ * @return User
17
+ * @throws NotFoundException
18
+ */
19
+ public function run(SyncUserRolesRequest $request): User
20
+ {
21
+ $user = app(FindUserByIdTask::class)->run($request->user_id);
22
+
23
+ $rolesIds = (array)$request->roles_ids;
24
+
25
+ $roles = array_map(static function ($roleId) {
26
+ return app(FindRoleTask::class)->run($roleId);
27
+ }, $rolesIds);
28
+
29
+ $user->syncRoles($roles);
30
+
31
+ return $user;
32
+ }
33
+ }
@@ -0,0 +1,24 @@
1
+ <?php
2
+
3
+ return [
4
+
5
+ /*
6
+ |--------------------------------------------------------------------------
7
+ | AppSection Section Authorization Container
8
+ |--------------------------------------------------------------------------
9
+ |
10
+ |
11
+ |
12
+ */
13
+
14
+ /*
15
+ |--------------------------------------------------------------------------
16
+ | Admin Role
17
+ |--------------------------------------------------------------------------
18
+ |
19
+ | This role is used across the app as the main authority e.g. super admin role
20
+ |
21
+ */
22
+
23
+ 'admin_role' => env('ADMIN_ROLE', 'admin'),
24
+ ];
@@ -0,0 +1,161 @@
1
+ <?php
2
+
3
+ return [
4
+
5
+ 'models' => [
6
+
7
+ /*
8
+ * When using the "HasPermissions" trait from this package, we need to know which
9
+ * Eloquent model should be used to retrieve your permissions. Of course, it
10
+ * is often just the "Permission" model but you may use whatever you like.
11
+ *
12
+ * The model you want to use as a Permission model needs to implement the
13
+ * `Spatie\Permission\Contracts\Permission` contract.
14
+ */
15
+
16
+ 'permission' => App\Containers\AppSection\Authorization\Models\Permission::class,
17
+
18
+ /*
19
+ * When using the "HasRoles" trait from this package, we need to know which
20
+ * Eloquent model should be used to retrieve your roles. Of course, it
21
+ * is often just the "Role" model but you may use whatever you like.
22
+ *
23
+ * The model you want to use as a Role model needs to implement the
24
+ * `Spatie\Permission\Contracts\Role` contract.
25
+ */
26
+
27
+ 'role' => App\Containers\AppSection\Authorization\Models\Role::class,
28
+
29
+ ],
30
+
31
+ 'table_names' => [
32
+
33
+ /*
34
+ * When using the "HasRoles" trait from this package, we need to know which
35
+ * table should be used to retrieve your roles. We have chosen a basic
36
+ * default value but you may easily change it to any table you like.
37
+ */
38
+
39
+ 'roles' => 'roles',
40
+
41
+ /*
42
+ * When using the "HasPermissions" trait from this package, we need to know which
43
+ * table should be used to retrieve your permissions. We have chosen a basic
44
+ * default value but you may easily change it to any table you like.
45
+ */
46
+
47
+ 'permissions' => 'permissions',
48
+
49
+ /*
50
+ * When using the "HasPermissions" trait from this package, we need to know which
51
+ * table should be used to retrieve your models permissions. We have chosen a
52
+ * basic default value but you may easily change it to any table you like.
53
+ */
54
+
55
+ 'model_has_permissions' => 'model_has_permissions',
56
+
57
+ /*
58
+ * When using the "HasRoles" trait from this package, we need to know which
59
+ * table should be used to retrieve your models roles. We have chosen a
60
+ * basic default value but you may easily change it to any table you like.
61
+ */
62
+
63
+ 'model_has_roles' => 'model_has_roles',
64
+
65
+ /*
66
+ * When using the "HasRoles" trait from this package, we need to know which
67
+ * table should be used to retrieve your roles permissions. We have chosen a
68
+ * basic default value but you may easily change it to any table you like.
69
+ */
70
+
71
+ 'role_has_permissions' => 'role_has_permissions',
72
+ ],
73
+
74
+ 'column_names' => [
75
+ /*
76
+ * Change this if you want to name the related pivots other than defaults
77
+ */
78
+ 'role_pivot_key' => null, //default 'role_id',
79
+ 'permission_pivot_key' => null, //default 'permission_id',
80
+
81
+ /*
82
+ * Change this if you want to name the related model primary key other than
83
+ * `model_id`.
84
+ *
85
+ * For example, this would be nice if your primary keys are all UUIDs. In
86
+ * that case, name this `model_uuid`.
87
+ */
88
+
89
+ 'model_morph_key' => 'model_id',
90
+
91
+ /*
92
+ * Change this if you want to use the teams feature and your related model's
93
+ * foreign key is other than `team_id`.
94
+ */
95
+
96
+ 'team_foreign_key' => 'team_id',
97
+ ],
98
+
99
+ /*
100
+ * When set to true, the method for checking permissions will be registered on the gate.
101
+ * Set this to false, if you want to implement custom logic for checking permissions.
102
+ */
103
+
104
+ 'register_permission_check_method' => true,
105
+
106
+ /*
107
+ * When set to true the package implements teams using the 'team_foreign_key'. If you want
108
+ * the migrations to register the 'team_foreign_key', you must set this to true
109
+ * before doing the migration. If you already did the migration then you must make a new
110
+ * migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
111
+ * 'model_has_permissions'(view the latest version of package's migration file)
112
+ */
113
+
114
+ 'teams' => false,
115
+
116
+ /*
117
+ * When set to true, the required permission names are added to the exception
118
+ * message. This could be considered an information leak in some contexts, so
119
+ * the default setting is false here for optimum safety.
120
+ */
121
+
122
+ 'display_permission_in_exception' => false,
123
+
124
+ /*
125
+ * When set to true, the required role names are added to the exception
126
+ * message. This could be considered an information leak in some contexts, so
127
+ * the default setting is false here for optimum safety.
128
+ */
129
+
130
+ 'display_role_in_exception' => false,
131
+
132
+ /*
133
+ * By default wildcard permission lookups are disabled.
134
+ */
135
+
136
+ 'enable_wildcard_permission' => false,
137
+
138
+ 'cache' => [
139
+
140
+ /*
141
+ * By default all permissions are cached for 24 hours to speed up performance.
142
+ * When permissions or roles are updated the cache is flushed automatically.
143
+ */
144
+
145
+ 'expiration_time' => DateInterval::createFromDateString('24 hours'),
146
+
147
+ /*
148
+ * The cache key used to store all permissions.
149
+ */
150
+
151
+ 'key' => 'spatie.permission.cache',
152
+
153
+ /*
154
+ * You may optionally indicate a specific cache driver to use for permission and
155
+ * role caching using any of the `store` drivers listed in the cache.php config
156
+ * file. Using 'default' here means to use the `default` set in cache.php.
157
+ */
158
+
159
+ 'store' => 'default',
160
+ ],
161
+ ];
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Factories;
4
+
5
+ use App\Containers\AppSection\Authorization\Models\Permission;
6
+ use App\Ship\Parents\Factories\Factory as ParentFactory;
7
+
8
+ class PermissionFactory extends ParentFactory
9
+ {
10
+ protected $model = Permission::class;
11
+
12
+ public function definition(): array
13
+ {
14
+ return [
15
+ 'name' => $this->faker->firstName(),
16
+ 'guard_name' => 'api',
17
+ ];
18
+ }
19
+ }
@@ -0,0 +1,28 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Factories;
4
+
5
+ use App\Containers\AppSection\Authorization\Models\Role;
6
+ use App\Ship\Parents\Factories\Factory as ParentFactory;
7
+
8
+ class RoleFactory extends ParentFactory
9
+ {
10
+ protected $model = Role::class;
11
+
12
+ public function definition(): array
13
+ {
14
+ return [
15
+ 'name' => $this->faker->firstName(),
16
+ 'guard_name' => 'api',
17
+ ];
18
+ }
19
+
20
+ public function admin(): static
21
+ {
22
+ return $this->state(function (array $attributes) {
23
+ return [
24
+ 'name' => config('appSection-authorization.admin_role'),
25
+ ];
26
+ });
27
+ }
28
+ }
@@ -0,0 +1,141 @@
1
+ <?php
2
+
3
+ use Illuminate\Support\Facades\Schema;
4
+ use Illuminate\Database\Schema\Blueprint;
5
+ use Illuminate\Database\Migrations\Migration;
6
+ use Spatie\Permission\PermissionRegistrar;
7
+
8
+ return new class extends Migration
9
+ {
10
+ /**
11
+ * Run the migrations.
12
+ *
13
+ * @return void
14
+ */
15
+ public function up()
16
+ {
17
+ $tableNames = config('permission.table_names');
18
+ $columnNames = config('permission.column_names');
19
+ $teams = config('permission.teams');
20
+
21
+ if (empty($tableNames)) {
22
+ throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
23
+ }
24
+ if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
25
+ throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
26
+ }
27
+
28
+ Schema::create($tableNames['permissions'], function (Blueprint $table) {
29
+ $table->bigIncrements('id');
30
+ $table->string('name'); // For MySQL 8.0 use string('name', 125);
31
+ $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
32
+ $table->timestamps();
33
+
34
+ $table->unique(['name', 'guard_name']);
35
+ });
36
+
37
+ Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
38
+ $table->bigIncrements('id');
39
+ if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
40
+ $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
41
+ $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
42
+ }
43
+ $table->string('name'); // For MySQL 8.0 use string('name', 125);
44
+ $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
45
+ $table->timestamps();
46
+ if ($teams || config('permission.testing')) {
47
+ $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
48
+ } else {
49
+ $table->unique(['name', 'guard_name']);
50
+ }
51
+ });
52
+
53
+ Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
54
+ $table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
55
+
56
+ $table->string('model_type');
57
+ $table->unsignedBigInteger($columnNames['model_morph_key']);
58
+ $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
59
+
60
+ $table->foreign(PermissionRegistrar::$pivotPermission)
61
+ ->references('id')
62
+ ->on($tableNames['permissions'])
63
+ ->onDelete('cascade');
64
+ if ($teams) {
65
+ $table->unsignedBigInteger($columnNames['team_foreign_key']);
66
+ $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
67
+
68
+ $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
69
+ 'model_has_permissions_permission_model_type_primary');
70
+ } else {
71
+ $table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
72
+ 'model_has_permissions_permission_model_type_primary');
73
+ }
74
+
75
+ });
76
+
77
+ Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
78
+ $table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
79
+
80
+ $table->string('model_type');
81
+ $table->unsignedBigInteger($columnNames['model_morph_key']);
82
+ $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
83
+
84
+ $table->foreign(PermissionRegistrar::$pivotRole)
85
+ ->references('id')
86
+ ->on($tableNames['roles'])
87
+ ->onDelete('cascade');
88
+ if ($teams) {
89
+ $table->unsignedBigInteger($columnNames['team_foreign_key']);
90
+ $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
91
+
92
+ $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
93
+ 'model_has_roles_role_model_type_primary');
94
+ } else {
95
+ $table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
96
+ 'model_has_roles_role_model_type_primary');
97
+ }
98
+ });
99
+
100
+ Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
101
+ $table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
102
+ $table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
103
+
104
+ $table->foreign(PermissionRegistrar::$pivotPermission)
105
+ ->references('id')
106
+ ->on($tableNames['permissions'])
107
+ ->onDelete('cascade');
108
+
109
+ $table->foreign(PermissionRegistrar::$pivotRole)
110
+ ->references('id')
111
+ ->on($tableNames['roles'])
112
+ ->onDelete('cascade');
113
+
114
+ $table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
115
+ });
116
+
117
+ app('cache')
118
+ ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
119
+ ->forget(config('permission.cache.key'));
120
+ }
121
+
122
+ /**
123
+ * Reverse the migrations.
124
+ *
125
+ * @return void
126
+ */
127
+ public function down()
128
+ {
129
+ $tableNames = config('permission.table_names');
130
+
131
+ if (empty($tableNames)) {
132
+ throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
133
+ }
134
+
135
+ Schema::drop($tableNames['role_has_permissions']);
136
+ Schema::drop($tableNames['model_has_roles']);
137
+ Schema::drop($tableNames['model_has_permissions']);
138
+ Schema::drop($tableNames['roles']);
139
+ Schema::drop($tableNames['permissions']);
140
+ }
141
+ };
@@ -0,0 +1,30 @@
1
+ <?php
2
+
3
+ use Illuminate\Database\Migrations\Migration;
4
+ use Illuminate\Database\Schema\Blueprint;
5
+
6
+ return new class extends Migration {
7
+ /**
8
+ * Run the migrations.
9
+ */
10
+ public function up(): void
11
+ {
12
+ $permissionsTableName = config('permission.table_names')['permissions'];
13
+ Schema::table($permissionsTableName, function (Blueprint $table) {
14
+ $table->string('display_name')->nullable();
15
+ $table->string('description')->nullable();
16
+ });
17
+ }
18
+
19
+ /**
20
+ * Reverse the migrations.
21
+ */
22
+ public function down(): void
23
+ {
24
+ $permissionsTableName = config('permission.table_names')['permissions'];
25
+ Schema::table($permissionsTableName, function (Blueprint $table) {
26
+ $table->dropColumn('display_name');
27
+ $table->dropColumn('description');
28
+ });
29
+ }
30
+ };
@@ -0,0 +1,30 @@
1
+ <?php
2
+
3
+ use Illuminate\Database\Migrations\Migration;
4
+ use Illuminate\Database\Schema\Blueprint;
5
+
6
+ return new class extends Migration {
7
+ /**
8
+ * Run the migrations.
9
+ */
10
+ public function up(): void
11
+ {
12
+ $rolesTableName = config('permission.table_names')['roles'];
13
+ Schema::table($rolesTableName, function (Blueprint $table) {
14
+ $table->string('display_name')->nullable();
15
+ $table->string('description')->nullable();
16
+ });
17
+ }
18
+
19
+ /**
20
+ * Reverse the migrations.
21
+ */
22
+ public function down(): void
23
+ {
24
+ $rolesTableName = config('permission.table_names')['roles'];
25
+ Schema::table($rolesTableName, function (Blueprint $table) {
26
+ $table->dropColumn('display_name');
27
+ $table->dropColumn('description');
28
+ });
29
+ }
30
+ };
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Repositories;
4
+
5
+ use App\Ship\Parents\Repositories\Repository as ParentRepository;
6
+
7
+ class PermissionRepository extends ParentRepository
8
+ {
9
+ protected $fieldSearchable = [
10
+ 'name' => '=',
11
+ 'display_name' => 'like',
12
+ 'description' => 'like',
13
+ ];
14
+
15
+ public function model(): string
16
+ {
17
+ return config('permission.models.permission');
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Repositories;
4
+
5
+ use App\Ship\Parents\Repositories\Repository as ParentRepository;
6
+
7
+ class RoleRepository extends ParentRepository
8
+ {
9
+ protected $fieldSearchable = [
10
+ 'name' => '=',
11
+ 'display_name' => 'like',
12
+ 'description' => 'like',
13
+ ];
14
+
15
+ public function model(): string
16
+ {
17
+ return config('permission.models.role');
18
+ }
19
+ }
@@ -0,0 +1,36 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Seeders;
4
+
5
+ use App\Containers\AppSection\User\Actions\CreateAdminAction;
6
+ use App\Ship\Exceptions\CreateResourceFailedException;
7
+ use App\Ship\Parents\Seeders\Seeder as ParentSeeder;
8
+ use Throwable;
9
+
10
+ class AuthorizationDefaultUsersSeeder_4 extends ParentSeeder
11
+ {
12
+ /**
13
+ * @throws CreateResourceFailedException
14
+ * @throws Throwable
15
+ */
16
+ public function run(): void
17
+ {
18
+ // Default Users (with their roles) ---------------------------------------------
19
+ $this->createSuperAdmin();
20
+ }
21
+
22
+ /**
23
+ * @throws CreateResourceFailedException
24
+ * @throws Throwable
25
+ */
26
+ private function createSuperAdmin(): void
27
+ {
28
+ $userData = [
29
+ 'email' => 'admin@admin.com',
30
+ 'password' => 'admin',
31
+ 'name' => 'Super Admin',
32
+ ];
33
+
34
+ app(CreateAdminAction::class)->run($userData);
35
+ }
36
+ }
@@ -0,0 +1,24 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Seeders;
4
+
5
+ use App\Containers\AppSection\Authorization\Tasks\GetAllPermissionsTask;
6
+ use App\Ship\Parents\Seeders\Seeder as ParentSeeder;
7
+
8
+ class AuthorizationGivePermissionsToRolesSeeder_3 extends ParentSeeder
9
+ {
10
+ public function run(): void
11
+ {
12
+ // Give all permissions to 'admin' role on all Guards ----------------------------------------------------------------
13
+ $adminRoleName = config('appSection-authorization.admin_role');
14
+ $roleModel = config('permission.models.role');
15
+ foreach (array_keys(config('auth.guards')) as $guardName) {
16
+ $allPermissions = app(GetAllPermissionsTask::class)->whereGuard($guardName)->run(true);
17
+ $adminRole = $roleModel::findByName($adminRoleName, $guardName);
18
+ $adminRole->givePermissionTo($allPermissions);
19
+ }
20
+
21
+ // Give permissions to roles ----------------------------------------------------------------
22
+ //
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Seeders;
4
+
5
+ use App\Containers\AppSection\Authorization\Tasks\CreatePermissionTask;
6
+ use App\Ship\Exceptions\CreateResourceFailedException;
7
+ use App\Ship\Parents\Seeders\Seeder as ParentSeeder;
8
+
9
+ class AuthorizationPermissionsSeeder_1 extends ParentSeeder
10
+ {
11
+ /**
12
+ * @throws CreateResourceFailedException
13
+ */
14
+ public function run(): void
15
+ {
16
+ // Default Permissions for every Guard ----------------------------------------------------------
17
+ $createPermissionTask = app(CreatePermissionTask::class);
18
+ foreach (array_keys(config('auth.guards')) as $guardName) {
19
+ $createPermissionTask->run('manage-roles', 'Create, Update, Delete, Get All, Attach/detach permissions to Roles and Get All Permissions.', guardName: $guardName);
20
+ $createPermissionTask->run('manage-permissions', 'Create, Update, Delete, Get All, Attach/detach permissions to User.', guardName: $guardName);
21
+ $createPermissionTask->run('create-admins', 'Create new Users (Admins) from the dashboard.', guardName: $guardName);
22
+ $createPermissionTask->run('manage-admins-access', 'Assign users to Roles.', guardName: $guardName);
23
+ $createPermissionTask->run('access-dashboard', 'Access the admins dashboard.', guardName: $guardName);
24
+ $createPermissionTask->run('access-private-docs', 'Access the private docs.', guardName: $guardName);
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Data\Seeders;
4
+
5
+ use App\Containers\AppSection\Authorization\Tasks\CreateRoleTask;
6
+ use App\Ship\Exceptions\CreateResourceFailedException;
7
+ use App\Ship\Parents\Seeders\Seeder as ParentSeeder;
8
+
9
+ class AuthorizationRolesSeeder_2 extends ParentSeeder
10
+ {
11
+ /**
12
+ * @throws CreateResourceFailedException
13
+ */
14
+ public function run(): void
15
+ {
16
+ // Default Roles for every Guard ----------------------------------------------------------------
17
+ foreach (array_keys(config('auth.guards')) as $guardName) {
18
+ app(CreateRoleTask::class)->run(config('appSection-authorization.admin_role'), 'Administrator', 'Administrator Role', $guardName);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ namespace App\Containers\AppSection\Authorization\Models;
4
+
5
+ use Apiato\Core\Traits\FactoryLocatorTrait;
6
+ use Apiato\Core\Traits\HashIdTrait;
7
+ use Apiato\Core\Traits\HasResourceKeyTrait;
8
+ use Illuminate\Database\Eloquent\Factories\HasFactory;
9
+ use Spatie\Permission\Models\Permission as SpatiePermission;
10
+
11
+ class Permission extends SpatiePermission
12
+ {
13
+ use HashIdTrait;
14
+ use HasResourceKeyTrait;
15
+ use HasFactory, FactoryLocatorTrait {
16
+ FactoryLocatorTrait::newFactory insteadof HasFactory;
17
+ }
18
+
19
+ protected string $guard_name = 'api';
20
+
21
+ protected $fillable = [
22
+ 'name',
23
+ 'guard_name',
24
+ 'display_name',
25
+ 'description',
26
+ ];
27
+ }