lesli_vault 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lesli_vault/application.js +730 -300
- data/app/controllers/lesli_vault/descriptors_controller.rb +9 -10
- data/app/controllers/lesli_vault/roles_controller.rb +9 -27
- data/app/services/{descriptor_services.rb → lesli_vault/descriptor_service.rb} +17 -62
- data/app/services/{role_services.rb → lesli_vault/role_service.rb} +39 -39
- data/app/{models/lesli_vault/system_controller.rb → views/lesli_vault/partials/_engine-navigation.html.erb} +5 -8
- data/config/routes.rb +7 -3
- data/lib/lesli_vault/version.rb +2 -1
- data/lib/vue/application.js +48 -1
- data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/components/form.vue +14 -25
- data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/index.vue +18 -20
- data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/new.vue +12 -19
- data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentForm.vue +63 -59
- data/{app/vue/lesli_vault → lib/vue}/apps/roles/index.vue +25 -27
- data/{app/vue/lesli_vault → lib/vue}/apps/roles/new.vue +6 -7
- data/{app/vue/lesli_vault → lib/vue}/stores/descriptor.js +21 -5
- data/{app/vue/lesli_vault → lib/vue}/stores/descriptors.js +1 -12
- data/{app/vue/lesli_vault → lib/vue}/stores/role.js +17 -42
- data/{app/vue/lesli_vault/application.js → lib/vue/stores/roles.js} +30 -7
- data/license +674 -0
- data/readme.md +60 -9
- metadata +29 -49
- data/app/controllers/lesli_vault/system_controller/actions_controller.rb +0 -112
- data/app/controllers/lesli_vault/system_controllers_controller.rb +0 -64
- data/app/helpers/lesli_vault/system_controller/actions_helper.rb +0 -4
- data/app/helpers/lesli_vault/system_controllers_helper.rb +0 -4
- data/app/models/lesli_vault/system_controller/action.rb +0 -39
- data/app/services/application_lesli_services.rb +0 -168
- data/app/services/system_controller_services.rb +0 -99
- data/app/views/layouts/lesli_vault/application.html.erb +0 -15
- data/app/views/lesli_vault/system_controller/actions/_form.html.erb +0 -32
- data/app/views/lesli_vault/system_controller/actions/edit.html.erb +0 -34
- data/app/views/lesli_vault/system_controller/actions/index.html.erb +0 -34
- data/app/views/lesli_vault/system_controller/actions/new.html.erb +0 -34
- data/app/views/lesli_vault/system_controller/actions/show.html.erb +0 -34
- data/app/views/lesli_vault/system_controllers/_form.html.erb +0 -32
- data/app/views/lesli_vault/system_controllers/edit.html.erb +0 -34
- data/app/views/lesli_vault/system_controllers/index.html.erb +0 -34
- data/app/views/lesli_vault/system_controllers/new.html.erb +0 -34
- data/app/views/lesli_vault/system_controllers/show.html.erb +0 -34
- data/app/vue/lesli_vault/apps/security/index.vue +0 -208
- data/app/vue/lesli_vault/stores/roles.js +0 -89
- data/app/vue/lesli_vault/stores/systemController.js +0 -67
- data/lib/tasks/system/controllers.rake +0 -112
- /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/edit.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/privileges.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/show.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentPrivilegeCustom.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentPrivilegeStandard.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/roles/edit.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/roles/logs.vue +0 -0
- /data/{app/vue/lesli_vault → lib/vue}/apps/roles/show.vue +0 -0
data/readme.md
CHANGED
@@ -1,19 +1,70 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<img width="
|
2
|
+
<img width="90" alt="LesliVault logo" src="./app/assets/images/lesli_vault/vault-logo.svg" />
|
3
|
+
<h3 align="center">Security Management Module for the Lesli Framework.</h3>
|
3
4
|
</p>
|
4
5
|
|
5
|
-
<h3 align="center">LesliVault</h3>
|
6
|
-
|
7
6
|
<hr/>
|
7
|
+
<p align="center">
|
8
|
+
<a target="blank" href="https://rubygems.org/gems/lesli_vault">
|
9
|
+
<img src="https://badge.fury.io/rb/lesli_vault.svg" alt="Gem Version" height="24">
|
10
|
+
</a>
|
11
|
+
</p>
|
12
|
+
<hr/>
|
13
|
+
|
14
|
+
### Quick start
|
15
|
+
|
16
|
+
```shell
|
17
|
+
# Add LesliAdmin engine
|
18
|
+
bundle add lesli_vault
|
19
|
+
```
|
20
|
+
|
21
|
+
```shell
|
22
|
+
# Setup database
|
23
|
+
rake lesli:db:setup
|
24
|
+
```
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# Load LesliAdmin
|
28
|
+
Rails.application.routes.draw do
|
29
|
+
mount LesliVault::Engine => "/vault"
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
### Documentation
|
35
|
+
* [database](./docs/database.md)
|
36
|
+
* [documentation](https://www.lesli.dev/documentation/)
|
8
37
|
|
9
|
-
Version 1
|
10
38
|
|
11
|
-
###
|
12
|
-
------
|
13
|
-
Software developed in [Guatemala](http://visitguatemala.com/) by [LesliTech](https://www.lesli.tech) distributed under the *General Public License v 3.0* you can read the full license [here](http://www.gnu.org/licenses/gpl-3.0.html)
|
39
|
+
### Get in touch
|
14
40
|
|
15
|
-
|
41
|
+
* [Website: https://www.lesli.tech](https://www.lesli.tech)
|
42
|
+
* [Email: hello@lesli.tech](hello@lesli.tech)
|
43
|
+
* [Twitter: @LesliTech](https://twitter.com/LesliTech)
|
44
|
+
|
45
|
+
|
46
|
+
### License
|
47
|
+
-------
|
48
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
49
|
+
|
50
|
+
This program is free software: you can redistribute it and/or modify
|
51
|
+
it under the terms of the GNU General Public License as published by
|
52
|
+
the Free Software Foundation, either version 3 of the License, or
|
53
|
+
(at your option) any later version.
|
54
|
+
|
55
|
+
This program is distributed in the hope that it will be useful,
|
56
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
57
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
58
|
+
GNU General Public License for more details.
|
59
|
+
|
60
|
+
You should have received a copy of the GNU General Public License
|
61
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
62
|
+
|
63
|
+
<hr />
|
64
|
+
<br />
|
16
65
|
|
17
66
|
<p align="center">
|
18
|
-
<img alt="Lesli logo"
|
67
|
+
<img width="200" alt="Lesli logo" src="https://cdn.lesli.tech/lesli/brand/app-logo.svg" />
|
68
|
+
<h4 align="center">Ruby on Rails SaaS Development Framework.</h4>
|
19
69
|
</p>
|
70
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lesli_vault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Lesli Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '7'
|
27
|
-
description: Security
|
27
|
+
description: Security Management Module for the Lesli Framework.
|
28
28
|
email:
|
29
29
|
- hello@lesli.tech
|
30
30
|
executables: []
|
@@ -49,8 +49,6 @@ files:
|
|
49
49
|
- app/controllers/lesli_vault/role/descriptors_controller.rb
|
50
50
|
- app/controllers/lesli_vault/role/privileges_controller.rb
|
51
51
|
- app/controllers/lesli_vault/roles_controller.rb
|
52
|
-
- app/controllers/lesli_vault/system_controller/actions_controller.rb
|
53
|
-
- app/controllers/lesli_vault/system_controllers_controller.rb
|
54
52
|
- app/helpers/lesli_vault/application_helper.rb
|
55
53
|
- app/helpers/lesli_vault/dashboards_helper.rb
|
56
54
|
- app/helpers/lesli_vault/descriptor/activities_helper.rb
|
@@ -60,8 +58,6 @@ files:
|
|
60
58
|
- app/helpers/lesli_vault/role/descriptors_helper.rb
|
61
59
|
- app/helpers/lesli_vault/role/privileges_helper.rb
|
62
60
|
- app/helpers/lesli_vault/roles_helper.rb
|
63
|
-
- app/helpers/lesli_vault/system_controller/actions_helper.rb
|
64
|
-
- app/helpers/lesli_vault/system_controllers_helper.rb
|
65
61
|
- app/jobs/lesli_vault/application_job.rb
|
66
62
|
- app/mailers/lesli_vault/application_mailer.rb
|
67
63
|
- app/models/lesli_vault/application_record.rb
|
@@ -72,13 +68,8 @@ files:
|
|
72
68
|
- app/models/lesli_vault/role/activity.rb
|
73
69
|
- app/models/lesli_vault/role/descriptor.rb
|
74
70
|
- app/models/lesli_vault/role/privilege.rb
|
75
|
-
- app/
|
76
|
-
- app/
|
77
|
-
- app/services/application_lesli_services.rb
|
78
|
-
- app/services/descriptor_services.rb
|
79
|
-
- app/services/role_services.rb
|
80
|
-
- app/services/system_controller_services.rb
|
81
|
-
- app/views/layouts/lesli_vault/application.html.erb
|
71
|
+
- app/services/lesli_vault/descriptor_service.rb
|
72
|
+
- app/services/lesli_vault/role_service.rb
|
82
73
|
- app/views/lesli_vault/dashboards/show.html.erb
|
83
74
|
- app/views/lesli_vault/descriptor/activities/_form.html.erb
|
84
75
|
- app/views/lesli_vault/descriptor/activities/edit.html.erb
|
@@ -95,6 +86,7 @@ files:
|
|
95
86
|
- app/views/lesli_vault/descriptors/index.html.erb
|
96
87
|
- app/views/lesli_vault/descriptors/new.html.erb
|
97
88
|
- app/views/lesli_vault/descriptors/show.html.erb
|
89
|
+
- app/views/lesli_vault/partials/_engine-navigation.html.erb
|
98
90
|
- app/views/lesli_vault/role/activities/_form.html.erb
|
99
91
|
- app/views/lesli_vault/role/activities/edit.html.erb
|
100
92
|
- app/views/lesli_vault/role/activities/index.html.erb
|
@@ -114,51 +106,39 @@ files:
|
|
114
106
|
- app/views/lesli_vault/roles/index.html.erb
|
115
107
|
- app/views/lesli_vault/roles/new.html.erb
|
116
108
|
- app/views/lesli_vault/roles/show.html.erb
|
117
|
-
- app/views/lesli_vault/system_controller/actions/_form.html.erb
|
118
|
-
- app/views/lesli_vault/system_controller/actions/edit.html.erb
|
119
|
-
- app/views/lesli_vault/system_controller/actions/index.html.erb
|
120
|
-
- app/views/lesli_vault/system_controller/actions/new.html.erb
|
121
|
-
- app/views/lesli_vault/system_controller/actions/show.html.erb
|
122
|
-
- app/views/lesli_vault/system_controllers/_form.html.erb
|
123
|
-
- app/views/lesli_vault/system_controllers/edit.html.erb
|
124
|
-
- app/views/lesli_vault/system_controllers/index.html.erb
|
125
|
-
- app/views/lesli_vault/system_controllers/new.html.erb
|
126
|
-
- app/views/lesli_vault/system_controllers/show.html.erb
|
127
|
-
- app/vue/lesli_vault/application.js
|
128
|
-
- app/vue/lesli_vault/apps/descriptors/components/form.vue
|
129
|
-
- app/vue/lesli_vault/apps/descriptors/edit.vue
|
130
|
-
- app/vue/lesli_vault/apps/descriptors/index.vue
|
131
|
-
- app/vue/lesli_vault/apps/descriptors/new.vue
|
132
|
-
- app/vue/lesli_vault/apps/descriptors/privileges.vue
|
133
|
-
- app/vue/lesli_vault/apps/descriptors/show.vue
|
134
|
-
- app/vue/lesli_vault/apps/roles/componentForm.vue
|
135
|
-
- app/vue/lesli_vault/apps/roles/componentPrivilegeCustom.vue
|
136
|
-
- app/vue/lesli_vault/apps/roles/componentPrivilegeStandard.vue
|
137
|
-
- app/vue/lesli_vault/apps/roles/edit.vue
|
138
|
-
- app/vue/lesli_vault/apps/roles/index.vue
|
139
|
-
- app/vue/lesli_vault/apps/roles/logs.vue
|
140
|
-
- app/vue/lesli_vault/apps/roles/new.vue
|
141
|
-
- app/vue/lesli_vault/apps/roles/show.vue
|
142
|
-
- app/vue/lesli_vault/apps/security/index.vue
|
143
|
-
- app/vue/lesli_vault/stores/descriptor.js
|
144
|
-
- app/vue/lesli_vault/stores/descriptors.js
|
145
|
-
- app/vue/lesli_vault/stores/role.js
|
146
|
-
- app/vue/lesli_vault/stores/roles.js
|
147
|
-
- app/vue/lesli_vault/stores/systemController.js
|
148
109
|
- config/routes.rb
|
149
110
|
- lib/lesli_vault.rb
|
150
111
|
- lib/lesli_vault/engine.rb
|
151
112
|
- lib/lesli_vault/version.rb
|
152
113
|
- lib/tasks/lesli_vault_tasks.rake
|
153
|
-
- lib/tasks/system/controllers.rake
|
154
114
|
- lib/vue/application.js
|
115
|
+
- lib/vue/apps/descriptors/components/form.vue
|
116
|
+
- lib/vue/apps/descriptors/edit.vue
|
117
|
+
- lib/vue/apps/descriptors/index.vue
|
118
|
+
- lib/vue/apps/descriptors/new.vue
|
119
|
+
- lib/vue/apps/descriptors/privileges.vue
|
120
|
+
- lib/vue/apps/descriptors/show.vue
|
121
|
+
- lib/vue/apps/roles/componentForm.vue
|
122
|
+
- lib/vue/apps/roles/componentPrivilegeCustom.vue
|
123
|
+
- lib/vue/apps/roles/componentPrivilegeStandard.vue
|
124
|
+
- lib/vue/apps/roles/edit.vue
|
125
|
+
- lib/vue/apps/roles/index.vue
|
126
|
+
- lib/vue/apps/roles/logs.vue
|
127
|
+
- lib/vue/apps/roles/new.vue
|
128
|
+
- lib/vue/apps/roles/show.vue
|
129
|
+
- lib/vue/stores/descriptor.js
|
130
|
+
- lib/vue/stores/descriptors.js
|
131
|
+
- lib/vue/stores/role.js
|
132
|
+
- lib/vue/stores/roles.js
|
133
|
+
- license
|
155
134
|
- readme.md
|
156
135
|
homepage: https://www.lesli.dev/
|
157
|
-
licenses:
|
136
|
+
licenses:
|
137
|
+
- GPL-3.0
|
158
138
|
metadata:
|
159
139
|
homepage_uri: https://www.lesli.dev/
|
160
|
-
source_code_uri: https://github.com/LesliTech/LesliVault
|
161
140
|
changelog_uri: https://github.com/LesliTech/LesliVault
|
141
|
+
source_code_uri: https://github.com/LesliTech/LesliVault
|
162
142
|
post_install_message:
|
163
143
|
rdoc_options: []
|
164
144
|
require_paths:
|
@@ -177,5 +157,5 @@ requirements: []
|
|
177
157
|
rubygems_version: 3.3.7
|
178
158
|
signing_key:
|
179
159
|
specification_version: 4
|
180
|
-
summary: Security
|
160
|
+
summary: Security Management Module for the Lesli Framework.
|
181
161
|
test_files: []
|
@@ -1,112 +0,0 @@
|
|
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::ActionsController < ApplicationController
|
36
|
-
before_action :set_system_controllers_action, only: %i[ show update destroy ]
|
37
|
-
|
38
|
-
# GET /system_controllers/actions
|
39
|
-
def index
|
40
|
-
respond_to do |format|
|
41
|
-
format.html {}
|
42
|
-
format.json do
|
43
|
-
respond_with_successful(SystemControllers::Action.index(current_user, @query))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# GET /system_controllers/actions/1
|
49
|
-
def show
|
50
|
-
respond_to do |format|
|
51
|
-
format.html {}
|
52
|
-
format.json do
|
53
|
-
return respond_with_not_found unless @system_controllers_action
|
54
|
-
return respond_with_successful(@system_controllers_action.show(current_user, @query))
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# GET /system_controllers/actions/new
|
60
|
-
def new
|
61
|
-
end
|
62
|
-
|
63
|
-
# GET /system_controllers/actions/1/edit
|
64
|
-
def edit
|
65
|
-
end
|
66
|
-
|
67
|
-
# POST /system_controllers/actions
|
68
|
-
def create
|
69
|
-
system_controllers_action = SystemControllers::Action.new(system_controllers_action_params)
|
70
|
-
if system_controllers_action.save
|
71
|
-
respond_with_successful(system_controllers_action)
|
72
|
-
else
|
73
|
-
respond_with_error(system_controllers_action.errors.full_messages.to_sentence)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# PATCH/PUT /system_controllers/actions/1
|
78
|
-
def update
|
79
|
-
return respond_with_not_found unless @system_controllers_action
|
80
|
-
|
81
|
-
if @system_controllers_action.update(system_controllers_action_params)
|
82
|
-
respond_with_successful(@system_controllers_action.show(current_user, @query))
|
83
|
-
else
|
84
|
-
respond_with_error(@system_controllers_action.errors.full_messages.to_sentence)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
# DELETE /system_controllers/actions/1
|
89
|
-
def destroy
|
90
|
-
return respond_with_not_found unless @system_controllers_action
|
91
|
-
|
92
|
-
if @system_controllers_action.destroy
|
93
|
-
respond_with_successful
|
94
|
-
else
|
95
|
-
respond_with_error(@system_controllers_action.errors.full_messages.to_sentence)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
# Use callbacks to share common setup or constraints between actions.
|
102
|
-
def set_system_controllers_action
|
103
|
-
@system_controllers_action = current_user.account.system_controllers_actions.find(class_name, params[:id])
|
104
|
-
end
|
105
|
-
|
106
|
-
# Only allow a list of trusted parameters through.
|
107
|
-
def system_controllers_action_params
|
108
|
-
params.require(:system_controllers_action).permit(:id, :name)
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
@@ -1,64 +0,0 @@
|
|
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 SystemControllersController < ApplicationController
|
36
|
-
before_action :set_system_controller, only: %i[ show update destroy ]
|
37
|
-
|
38
|
-
# GET /system_controllers
|
39
|
-
def index
|
40
|
-
respond_to do |format|
|
41
|
-
format.html {}
|
42
|
-
format.json do
|
43
|
-
respond_with_successful(SystemControllerServices.new(current_user).index)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def options
|
49
|
-
respond_to do |format|
|
50
|
-
format.html {}
|
51
|
-
format.json do
|
52
|
-
respond_with_successful(SystemControllerServices.new(current_user).options)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
# Only allow a list of trusted parameters through.
|
60
|
-
def system_controller_params
|
61
|
-
[]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,39 +0,0 @@
|
|
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
|
@@ -1,168 +0,0 @@
|
|
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
|