lesli_vault 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +38 -0
  3. data/app/assets/config/lesli_vault_manifest.js +38 -0
  4. data/app/assets/images/lesli_vault/vault-logo.svg +160 -0
  5. data/app/assets/javascripts/lesli_vault/application.js +2848 -0
  6. data/app/assets/stylesheets/lesli_vault/application.scss +15 -0
  7. data/app/assets/stylesheets/lesli_vault/dashboards.scss +32 -0
  8. data/app/assets/stylesheets/lesli_vault/descriptors.scss +32 -0
  9. data/app/assets/stylesheets/lesli_vault/roles.scss +32 -0
  10. data/app/assets/stylesheets/lesli_vault/system_controller.scss +32 -0
  11. data/app/controllers/lesli_vault/application_controller.rb +37 -0
  12. data/app/controllers/lesli_vault/dashboards_controller.rb +6 -0
  13. data/app/controllers/lesli_vault/descriptor/activities_controller.rb +122 -0
  14. data/app/controllers/lesli_vault/descriptor/privileges_controller.rb +104 -0
  15. data/app/controllers/lesli_vault/descriptors_controller.rb +130 -0
  16. data/app/controllers/lesli_vault/role/activities_controller.rb +76 -0
  17. data/app/controllers/lesli_vault/role/descriptors_controller.rb +95 -0
  18. data/app/controllers/lesli_vault/role/privileges_controller.rb +48 -0
  19. data/app/controllers/lesli_vault/roles_controller.rb +226 -0
  20. data/app/controllers/lesli_vault/system_controller/actions_controller.rb +112 -0
  21. data/app/controllers/lesli_vault/system_controllers_controller.rb +64 -0
  22. data/app/helpers/lesli_vault/application_helper.rb +4 -0
  23. data/app/helpers/lesli_vault/dashboards_helper.rb +4 -0
  24. data/app/helpers/lesli_vault/descriptor/activities_helper.rb +4 -0
  25. data/app/helpers/lesli_vault/descriptor/privileges_helper.rb +4 -0
  26. data/app/helpers/lesli_vault/descriptors_helper.rb +4 -0
  27. data/app/helpers/lesli_vault/role/activities_helper.rb +4 -0
  28. data/app/helpers/lesli_vault/role/descriptors_helper.rb +4 -0
  29. data/app/helpers/lesli_vault/role/privileges_helper.rb +4 -0
  30. data/app/helpers/lesli_vault/roles_helper.rb +4 -0
  31. data/app/helpers/lesli_vault/system_controller/actions_helper.rb +4 -0
  32. data/app/helpers/lesli_vault/system_controllers_helper.rb +4 -0
  33. data/app/jobs/lesli_vault/application_job.rb +37 -0
  34. data/app/mailers/lesli_vault/application_mailer.rb +39 -0
  35. data/app/models/lesli_vault/application_record.rb +39 -0
  36. data/app/models/lesli_vault/descriptor/activity.rb +40 -0
  37. data/app/models/lesli_vault/descriptor/privilege.rb +40 -0
  38. data/app/models/lesli_vault/descriptor.rb +41 -0
  39. data/app/models/lesli_vault/role/activity.rb +40 -0
  40. data/app/models/lesli_vault/role/descriptor.rb +40 -0
  41. data/app/models/lesli_vault/role/privilege.rb +40 -0
  42. data/app/models/lesli_vault/role.rb +39 -0
  43. data/app/models/lesli_vault/system_controller/action.rb +39 -0
  44. data/app/models/lesli_vault/system_controller.rb +40 -0
  45. data/app/services/application_lesli_services.rb +168 -0
  46. data/app/services/descriptor_services.rb +197 -0
  47. data/app/services/role_services.rb +218 -0
  48. data/app/services/system_controller_services.rb +99 -0
  49. data/app/views/layouts/lesli_vault/application.html.erb +15 -0
  50. data/app/views/lesli_vault/dashboards/show.html.erb +1 -0
  51. data/app/views/lesli_vault/descriptor/activities/_form.html.erb +32 -0
  52. data/app/views/lesli_vault/descriptor/activities/edit.html.erb +34 -0
  53. data/app/views/lesli_vault/descriptor/activities/index.html.erb +34 -0
  54. data/app/views/lesli_vault/descriptor/activities/new.html.erb +34 -0
  55. data/app/views/lesli_vault/descriptor/activities/show.html.erb +34 -0
  56. data/app/views/lesli_vault/descriptor/privileges/_form.html.erb +32 -0
  57. data/app/views/lesli_vault/descriptor/privileges/edit.html.erb +34 -0
  58. data/app/views/lesli_vault/descriptor/privileges/index.html.erb +34 -0
  59. data/app/views/lesli_vault/descriptor/privileges/new.html.erb +34 -0
  60. data/app/views/lesli_vault/descriptor/privileges/show.html.erb +34 -0
  61. data/app/views/lesli_vault/descriptors/_form.html.erb +32 -0
  62. data/app/views/lesli_vault/descriptors/edit.html.erb +34 -0
  63. data/app/views/lesli_vault/descriptors/index.html.erb +34 -0
  64. data/app/views/lesli_vault/descriptors/new.html.erb +34 -0
  65. data/app/views/lesli_vault/descriptors/show.html.erb +34 -0
  66. data/app/views/lesli_vault/role/activities/_form.html.erb +32 -0
  67. data/app/views/lesli_vault/role/activities/edit.html.erb +34 -0
  68. data/app/views/lesli_vault/role/activities/index.html.erb +34 -0
  69. data/app/views/lesli_vault/role/activities/new.html.erb +34 -0
  70. data/app/views/lesli_vault/role/activities/show.html.erb +34 -0
  71. data/app/views/lesli_vault/role/descriptors/_form.html.erb +32 -0
  72. data/app/views/lesli_vault/role/descriptors/edit.html.erb +34 -0
  73. data/app/views/lesli_vault/role/descriptors/index.html.erb +34 -0
  74. data/app/views/lesli_vault/role/descriptors/new.html.erb +34 -0
  75. data/app/views/lesli_vault/role/descriptors/show.html.erb +34 -0
  76. data/app/views/lesli_vault/role/privileges/_form.html.erb +32 -0
  77. data/app/views/lesli_vault/role/privileges/edit.html.erb +34 -0
  78. data/app/views/lesli_vault/role/privileges/index.html.erb +34 -0
  79. data/app/views/lesli_vault/role/privileges/new.html.erb +34 -0
  80. data/app/views/lesli_vault/role/privileges/show.html.erb +34 -0
  81. data/app/views/lesli_vault/roles/edit.html.erb +34 -0
  82. data/app/views/lesli_vault/roles/index.html.erb +34 -0
  83. data/app/views/lesli_vault/roles/new.html.erb +34 -0
  84. data/app/views/lesli_vault/roles/show.html.erb +34 -0
  85. data/app/views/lesli_vault/system_controller/actions/_form.html.erb +32 -0
  86. data/app/views/lesli_vault/system_controller/actions/edit.html.erb +34 -0
  87. data/app/views/lesli_vault/system_controller/actions/index.html.erb +34 -0
  88. data/app/views/lesli_vault/system_controller/actions/new.html.erb +34 -0
  89. data/app/views/lesli_vault/system_controller/actions/show.html.erb +34 -0
  90. data/app/views/lesli_vault/system_controllers/_form.html.erb +32 -0
  91. data/app/views/lesli_vault/system_controllers/edit.html.erb +34 -0
  92. data/app/views/lesli_vault/system_controllers/index.html.erb +34 -0
  93. data/app/views/lesli_vault/system_controllers/new.html.erb +34 -0
  94. data/app/views/lesli_vault/system_controllers/show.html.erb +34 -0
  95. data/app/vue/lesli_vault/application.js +38 -0
  96. data/app/vue/lesli_vault/apps/descriptors/components/form.vue +147 -0
  97. data/app/vue/lesli_vault/apps/descriptors/edit.vue +83 -0
  98. data/app/vue/lesli_vault/apps/descriptors/index.vue +116 -0
  99. data/app/vue/lesli_vault/apps/descriptors/new.vue +76 -0
  100. data/app/vue/lesli_vault/apps/descriptors/privileges.vue +179 -0
  101. data/app/vue/lesli_vault/apps/descriptors/show.vue +240 -0
  102. data/app/vue/lesli_vault/apps/roles/componentForm.vue +231 -0
  103. data/app/vue/lesli_vault/apps/roles/componentPrivilegeCustom.vue +86 -0
  104. data/app/vue/lesli_vault/apps/roles/componentPrivilegeStandard.vue +173 -0
  105. data/app/vue/lesli_vault/apps/roles/edit.vue +93 -0
  106. data/app/vue/lesli_vault/apps/roles/index.vue +169 -0
  107. data/app/vue/lesli_vault/apps/roles/logs.vue +110 -0
  108. data/app/vue/lesli_vault/apps/roles/new.vue +89 -0
  109. data/app/vue/lesli_vault/apps/roles/show.vue +111 -0
  110. data/app/vue/lesli_vault/apps/security/index.vue +208 -0
  111. data/app/vue/lesli_vault/stores/descriptor.js +116 -0
  112. data/app/vue/lesli_vault/stores/descriptors.js +167 -0
  113. data/app/vue/lesli_vault/stores/role.js +243 -0
  114. data/app/vue/lesli_vault/stores/roles.js +89 -0
  115. data/app/vue/lesli_vault/stores/systemController.js +67 -0
  116. data/config/routes.rb +52 -0
  117. data/lib/lesli_vault/engine.rb +18 -0
  118. data/lib/lesli_vault/version.rb +3 -0
  119. data/lib/lesli_vault.rb +6 -0
  120. data/lib/tasks/lesli_vault_tasks.rake +4 -0
  121. data/lib/tasks/system/controllers.rake +112 -0
  122. data/lib/vue/application.js +7 -0
  123. data/readme.md +19 -0
  124. metadata +181 -0
@@ -0,0 +1,39 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class ApplicationRecord < ActiveRecord::Base
36
+ # class ApplicationRecord < ApplicationLesliRecord
37
+ # self.abstract_class = true
38
+ end
39
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Descriptor::Activity < ApplicationRecord
36
+
37
+ belongs_to :descriptor
38
+
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Descriptor::Privilege < ApplicationRecord
36
+
37
+ belongs_to :descriptor
38
+
39
+ end
40
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Descriptor < ApplicationRecord
36
+
37
+ has_many :activities
38
+ has_many :privileges
39
+
40
+ end
41
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Role::Activity < ApplicationRecord
36
+
37
+ belongs_to :role
38
+
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Role::Descriptor < ApplicationRecord
36
+
37
+ belongs_to :role
38
+
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Role::Privilege < ApplicationRecord
36
+
37
+ belongs_to :role
38
+
39
+ end
40
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class Role < ApplicationRecord
36
+
37
+
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+ module LesliVault
34
+ class SystemController::Action < ApplicationRecord
35
+
36
+ belongs_to :system_controller
37
+
38
+ end
39
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ module LesliVault
35
+ class SystemController < ApplicationRecord
36
+
37
+ has_many :actions
38
+
39
+ end
40
+ end
@@ -0,0 +1,168 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS development platform.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+
32
+ =end
33
+
34
+ # · IMPORTANT: THIS SERVICES SHOULD COME FROM LESLI, ONCE IT'S READY
35
+ module LesliVault
36
+ class ApplicationLesliServices
37
+
38
+
39
+ # Set container attributes to manage the life-cycle of the service
40
+ @query;
41
+ @resource;
42
+ @failures;
43
+ @current_user;
44
+
45
+
46
+ # Service constructor
47
+ # current_user is always required to initialize a service object
48
+ # current user is used to get the data only from the account context
49
+ def initialize current_user, query={}
50
+
51
+ # make the current user globaly available in the service object
52
+ @current_user = current_user
53
+
54
+ # stores the resources from the database as result of the active record queries
55
+ @resource = nil
56
+
57
+ # stores any error found during the life-cycle of the service object
58
+ @failures = []
59
+
60
+ # standard conditions to query the database
61
+ @query = query
62
+ end
63
+
64
+
65
+ # Find an specific resource through the main id
66
+ def find resource = nil
67
+ # Look for the resource in the database
68
+ # self.resource = current_user.account.users.find_by_id(id) # example
69
+
70
+ # Should always return self
71
+ self.resource = resource if resource
72
+ self
73
+ end
74
+
75
+
76
+ # Standard method to list data from the database
77
+ def list params=nil
78
+ end
79
+
80
+
81
+ # Standard method to index data from the database
82
+ def index params=nil
83
+ end
84
+
85
+
86
+ # Standard method to show data from the database
87
+ def show
88
+ end
89
+
90
+
91
+ # Standard method to create new resource into the database
92
+ def create resource
93
+ # Example:
94
+ # user = current_user.account.users.new(params)
95
+
96
+ # if user.save
97
+ # self.resource = user
98
+ # else
99
+ # self.error(user.errors.full_messages.to_sentence)
100
+ # end
101
+
102
+ self.resource = resource if resource
103
+ self
104
+ end
105
+
106
+
107
+ # Standard method to update resources into the database
108
+ def update params
109
+ end
110
+
111
+
112
+ # Standard method to delete data from the database
113
+ def delete
114
+ end
115
+
116
+
117
+ # Method to check if the service object has data available
118
+ # this method ment to be used together and after the find method
119
+ def found?
120
+ !self.resource.blank?
121
+ end
122
+
123
+
124
+ # Check if the service object has errors
125
+ def successful?
126
+ self.failures.empty?
127
+ end
128
+
129
+
130
+ # Get the list of erros
131
+ def errors
132
+ self.failures
133
+ end
134
+
135
+
136
+ # Get the list of erros as single string
137
+ def errors_as_sentence
138
+ self.failures.to_sentence
139
+ end
140
+
141
+
142
+ # Register a new error for the current service object
143
+ def error error
144
+ self.failures.push(error)
145
+ end
146
+
147
+
148
+ # Return the resource as a result
149
+ def result
150
+ self.resource
151
+ end
152
+
153
+ private
154
+
155
+ attr_reader :current_user
156
+
157
+ attr_reader :resource
158
+ attr_writer :resource
159
+
160
+ attr_reader :successful
161
+ attr_writer :successful
162
+
163
+ attr_reader :failures
164
+ attr_writer :failures
165
+
166
+ attr_reader :query
167
+ end
168
+ end