lesli_vault 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +38 -0
- data/app/assets/config/lesli_vault_manifest.js +38 -0
- data/app/assets/images/lesli_vault/vault-logo.svg +160 -0
- data/app/assets/javascripts/lesli_vault/application.js +2848 -0
- data/app/assets/stylesheets/lesli_vault/application.scss +15 -0
- data/app/assets/stylesheets/lesli_vault/dashboards.scss +32 -0
- data/app/assets/stylesheets/lesli_vault/descriptors.scss +32 -0
- data/app/assets/stylesheets/lesli_vault/roles.scss +32 -0
- data/app/assets/stylesheets/lesli_vault/system_controller.scss +32 -0
- data/app/controllers/lesli_vault/application_controller.rb +37 -0
- data/app/controllers/lesli_vault/dashboards_controller.rb +6 -0
- data/app/controllers/lesli_vault/descriptor/activities_controller.rb +122 -0
- data/app/controllers/lesli_vault/descriptor/privileges_controller.rb +104 -0
- data/app/controllers/lesli_vault/descriptors_controller.rb +130 -0
- data/app/controllers/lesli_vault/role/activities_controller.rb +76 -0
- data/app/controllers/lesli_vault/role/descriptors_controller.rb +95 -0
- data/app/controllers/lesli_vault/role/privileges_controller.rb +48 -0
- data/app/controllers/lesli_vault/roles_controller.rb +226 -0
- data/app/controllers/lesli_vault/system_controller/actions_controller.rb +112 -0
- data/app/controllers/lesli_vault/system_controllers_controller.rb +64 -0
- data/app/helpers/lesli_vault/application_helper.rb +4 -0
- data/app/helpers/lesli_vault/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_vault/descriptor/activities_helper.rb +4 -0
- data/app/helpers/lesli_vault/descriptor/privileges_helper.rb +4 -0
- data/app/helpers/lesli_vault/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_vault/role/activities_helper.rb +4 -0
- data/app/helpers/lesli_vault/role/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_vault/role/privileges_helper.rb +4 -0
- data/app/helpers/lesli_vault/roles_helper.rb +4 -0
- data/app/helpers/lesli_vault/system_controller/actions_helper.rb +4 -0
- data/app/helpers/lesli_vault/system_controllers_helper.rb +4 -0
- data/app/jobs/lesli_vault/application_job.rb +37 -0
- data/app/mailers/lesli_vault/application_mailer.rb +39 -0
- data/app/models/lesli_vault/application_record.rb +39 -0
- data/app/models/lesli_vault/descriptor/activity.rb +40 -0
- data/app/models/lesli_vault/descriptor/privilege.rb +40 -0
- data/app/models/lesli_vault/descriptor.rb +41 -0
- data/app/models/lesli_vault/role/activity.rb +40 -0
- data/app/models/lesli_vault/role/descriptor.rb +40 -0
- data/app/models/lesli_vault/role/privilege.rb +40 -0
- data/app/models/lesli_vault/role.rb +39 -0
- data/app/models/lesli_vault/system_controller/action.rb +39 -0
- data/app/models/lesli_vault/system_controller.rb +40 -0
- data/app/services/application_lesli_services.rb +168 -0
- data/app/services/descriptor_services.rb +197 -0
- data/app/services/role_services.rb +218 -0
- data/app/services/system_controller_services.rb +99 -0
- data/app/views/layouts/lesli_vault/application.html.erb +15 -0
- data/app/views/lesli_vault/dashboards/show.html.erb +1 -0
- data/app/views/lesli_vault/descriptor/activities/_form.html.erb +32 -0
- data/app/views/lesli_vault/descriptor/activities/edit.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/activities/index.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/activities/new.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/activities/show.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/privileges/_form.html.erb +32 -0
- data/app/views/lesli_vault/descriptor/privileges/edit.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/privileges/index.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/privileges/new.html.erb +34 -0
- data/app/views/lesli_vault/descriptor/privileges/show.html.erb +34 -0
- data/app/views/lesli_vault/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_vault/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_vault/descriptors/index.html.erb +34 -0
- data/app/views/lesli_vault/descriptors/new.html.erb +34 -0
- data/app/views/lesli_vault/descriptors/show.html.erb +34 -0
- data/app/views/lesli_vault/role/activities/_form.html.erb +32 -0
- data/app/views/lesli_vault/role/activities/edit.html.erb +34 -0
- data/app/views/lesli_vault/role/activities/index.html.erb +34 -0
- data/app/views/lesli_vault/role/activities/new.html.erb +34 -0
- data/app/views/lesli_vault/role/activities/show.html.erb +34 -0
- data/app/views/lesli_vault/role/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_vault/role/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_vault/role/descriptors/index.html.erb +34 -0
- data/app/views/lesli_vault/role/descriptors/new.html.erb +34 -0
- data/app/views/lesli_vault/role/descriptors/show.html.erb +34 -0
- data/app/views/lesli_vault/role/privileges/_form.html.erb +32 -0
- data/app/views/lesli_vault/role/privileges/edit.html.erb +34 -0
- data/app/views/lesli_vault/role/privileges/index.html.erb +34 -0
- data/app/views/lesli_vault/role/privileges/new.html.erb +34 -0
- data/app/views/lesli_vault/role/privileges/show.html.erb +34 -0
- data/app/views/lesli_vault/roles/edit.html.erb +34 -0
- data/app/views/lesli_vault/roles/index.html.erb +34 -0
- data/app/views/lesli_vault/roles/new.html.erb +34 -0
- data/app/views/lesli_vault/roles/show.html.erb +34 -0
- data/app/views/lesli_vault/system_controller/actions/_form.html.erb +32 -0
- data/app/views/lesli_vault/system_controller/actions/edit.html.erb +34 -0
- data/app/views/lesli_vault/system_controller/actions/index.html.erb +34 -0
- data/app/views/lesli_vault/system_controller/actions/new.html.erb +34 -0
- data/app/views/lesli_vault/system_controller/actions/show.html.erb +34 -0
- data/app/views/lesli_vault/system_controllers/_form.html.erb +32 -0
- data/app/views/lesli_vault/system_controllers/edit.html.erb +34 -0
- data/app/views/lesli_vault/system_controllers/index.html.erb +34 -0
- data/app/views/lesli_vault/system_controllers/new.html.erb +34 -0
- data/app/views/lesli_vault/system_controllers/show.html.erb +34 -0
- data/app/vue/lesli_vault/application.js +38 -0
- data/app/vue/lesli_vault/apps/descriptors/components/form.vue +147 -0
- data/app/vue/lesli_vault/apps/descriptors/edit.vue +83 -0
- data/app/vue/lesli_vault/apps/descriptors/index.vue +116 -0
- data/app/vue/lesli_vault/apps/descriptors/new.vue +76 -0
- data/app/vue/lesli_vault/apps/descriptors/privileges.vue +179 -0
- data/app/vue/lesli_vault/apps/descriptors/show.vue +240 -0
- data/app/vue/lesli_vault/apps/roles/componentForm.vue +231 -0
- data/app/vue/lesli_vault/apps/roles/componentPrivilegeCustom.vue +86 -0
- data/app/vue/lesli_vault/apps/roles/componentPrivilegeStandard.vue +173 -0
- data/app/vue/lesli_vault/apps/roles/edit.vue +93 -0
- data/app/vue/lesli_vault/apps/roles/index.vue +169 -0
- data/app/vue/lesli_vault/apps/roles/logs.vue +110 -0
- data/app/vue/lesli_vault/apps/roles/new.vue +89 -0
- data/app/vue/lesli_vault/apps/roles/show.vue +111 -0
- data/app/vue/lesli_vault/apps/security/index.vue +208 -0
- data/app/vue/lesli_vault/stores/descriptor.js +116 -0
- data/app/vue/lesli_vault/stores/descriptors.js +167 -0
- data/app/vue/lesli_vault/stores/role.js +243 -0
- data/app/vue/lesli_vault/stores/roles.js +89 -0
- data/app/vue/lesli_vault/stores/systemController.js +67 -0
- data/config/routes.rb +52 -0
- data/lib/lesli_vault/engine.rb +18 -0
- data/lib/lesli_vault/version.rb +3 -0
- data/lib/lesli_vault.rb +6 -0
- data/lib/tasks/lesli_vault_tasks.rake +4 -0
- data/lib/tasks/system/controllers.rake +112 -0
- data/lib/vue/application.js +7 -0
- data/readme.md +19 -0
- metadata +181 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
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
|
+
*/
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
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
|
+
*/
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
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
|
+
*/
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
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
|
+
*/
|
@@ -0,0 +1,37 @@
|
|
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 ApplicationController < Lesli::ApplicationLesliController
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,122 @@
|
|
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::ActivitiesController < ApplicationController
|
36
|
+
before_action :set_descriptor_activity, only: %i[ show update destroy ]
|
37
|
+
|
38
|
+
# GET /descriptor/activities/list.json
|
39
|
+
def list
|
40
|
+
respond_to do |format|
|
41
|
+
format.html {}
|
42
|
+
format.json do
|
43
|
+
respond_with_successful(Descriptor::ActivityServices.new(current_user, query).list)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /descriptor/activities
|
49
|
+
def index
|
50
|
+
respond_to do |format|
|
51
|
+
format.html {}
|
52
|
+
format.json do
|
53
|
+
respond_with_pagination(Descriptor::ActivityServices.new(current_user, query).index)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# GET /descriptor/activities/:id
|
59
|
+
def show
|
60
|
+
respond_to do |format|
|
61
|
+
format.html {}
|
62
|
+
format.json do
|
63
|
+
return respond_with_successful(@descriptor_activity.show)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# GET /descriptor/activities/new
|
69
|
+
def new
|
70
|
+
end
|
71
|
+
|
72
|
+
# GET /descriptor/activities/:id/edit
|
73
|
+
def edit
|
74
|
+
end
|
75
|
+
|
76
|
+
# POST /descriptor/activities
|
77
|
+
def create
|
78
|
+
descriptor_activity = Descriptor::ActivityServices.new(current_user, query).create(descriptor_activity_params)
|
79
|
+
if descriptor_activity.successful?
|
80
|
+
respond_with_successful(descriptor_activity.result)
|
81
|
+
else
|
82
|
+
respond_with_error(descriptor_activity.errors)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# PATCH/PUT /descriptor/activities/:id
|
87
|
+
def update
|
88
|
+
@descriptor_activity.update(descriptor_activity_params)
|
89
|
+
|
90
|
+
if @descriptor_activity.successful?
|
91
|
+
respond_with_successful(@descriptor_activity.result)
|
92
|
+
else
|
93
|
+
respond_with_error(@descriptor_activity.errors)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# DELETE /descriptor/activities/1
|
98
|
+
def destroy
|
99
|
+
return respond_with_not_found unless @descriptor_activity
|
100
|
+
|
101
|
+
if @descriptor_activity.destroy
|
102
|
+
respond_with_successful
|
103
|
+
else
|
104
|
+
respond_with_error(@descriptor_activity.errors.full_messages.to_sentence)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
# Use callbacks to share common setup or constraints between actions.
|
111
|
+
def set_descriptor_activity
|
112
|
+
@descriptor_activity = Descriptor::ActivityServices.new(current_user, query).find(params[:id])
|
113
|
+
return respond_with_not_found unless @descriptor_activity.found?
|
114
|
+
end
|
115
|
+
|
116
|
+
# Only allow a list of trusted parameters through.
|
117
|
+
def descriptor_activity_params
|
118
|
+
params.require(:descriptor_activity).permit(:id, :name)
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,104 @@
|
|
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::PrivilegesController < ApplicationController
|
36
|
+
before_action :set_descriptor, only: %i[ create destroy ]
|
37
|
+
before_action :set_descriptor_privilege, only: %i[ destroy ]
|
38
|
+
|
39
|
+
|
40
|
+
# GET /descriptor/privileges
|
41
|
+
def index
|
42
|
+
respond_to do |format|
|
43
|
+
format.html {}
|
44
|
+
format.json do
|
45
|
+
respond_with_successful(Descriptor::Privilege.index(current_user, @query, params))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# POST /descriptor/privileges
|
51
|
+
def create
|
52
|
+
|
53
|
+
descriptor_privilege_status = false
|
54
|
+
|
55
|
+
descriptor_privilege = @descriptor.privileges.with_deleted.find_by(
|
56
|
+
:system_controller_action_id => descriptor_privilege_params[:action_id]
|
57
|
+
)
|
58
|
+
|
59
|
+
if not descriptor_privilege
|
60
|
+
descriptor_privilege = @descriptor.privileges.new(
|
61
|
+
:system_controller_action_id => descriptor_privilege_params[:action_id]
|
62
|
+
)
|
63
|
+
descriptor_privilege_status = descriptor_privilege.save
|
64
|
+
elsif descriptor_privilege.deleted?
|
65
|
+
descriptor_privilege_status = descriptor_privilege.recover
|
66
|
+
end
|
67
|
+
|
68
|
+
if descriptor_privilege_status
|
69
|
+
#Role::Activity.log_create_descriptor(current_user, @role, role_descriptor)
|
70
|
+
respond_with_successful(descriptor_privilege)
|
71
|
+
else
|
72
|
+
respond_with_error(descriptor_privilege.errors.full_messages.to_sentence)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# DELETE /descriptor/privileges/1
|
77
|
+
def destroy
|
78
|
+
if @descriptor_privilege.destroy
|
79
|
+
respond_with_successful
|
80
|
+
else
|
81
|
+
respond_with_error(@descriptor_privilege.errors.full_messages.to_sentence)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
# Use callbacks to share common setup or constraints between actions.
|
88
|
+
def set_descriptor
|
89
|
+
@descriptor = current_user.account.descriptors.find_by_id(params[:descriptor_id])
|
90
|
+
return respond_with_not_found if @descriptor.blank?
|
91
|
+
end
|
92
|
+
|
93
|
+
# Use callbacks to share common setup or constraints between actions.
|
94
|
+
def set_descriptor_privilege
|
95
|
+
@descriptor_privilege = @descriptor.privileges.find_by_id(params[:id])
|
96
|
+
return respond_with_not_found if @descriptor_privilege.blank?
|
97
|
+
end
|
98
|
+
|
99
|
+
# Only allow a list of trusted parameters through.
|
100
|
+
def descriptor_privilege_params
|
101
|
+
params.require(:descriptor_privilege).permit(:id, :name, :action_id)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,130 @@
|
|
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 DescriptorsController < ApplicationController
|
36
|
+
before_action :set_descriptor, only: %i[ show update destroy ]
|
37
|
+
|
38
|
+
# GET /descriptors/list.json
|
39
|
+
def list
|
40
|
+
respond_to do |format|
|
41
|
+
format.html {}
|
42
|
+
format.json do
|
43
|
+
respond_with_successful(DescriptorServices.new(current_user, @query).list)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# GET /descriptors
|
49
|
+
def index
|
50
|
+
respond_to do |format|
|
51
|
+
format.html {}
|
52
|
+
format.json do
|
53
|
+
respond_with_pagination(DescriptorServices.new(current_user, @query).index)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# GET /descriptors/:id
|
59
|
+
def show
|
60
|
+
respond_to do |format|
|
61
|
+
format.html {}
|
62
|
+
format.json do
|
63
|
+
respond_with_successful(@descriptor.show)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# GET /descriptors/new
|
69
|
+
def new
|
70
|
+
end
|
71
|
+
|
72
|
+
# GET /descriptors/:id/edit
|
73
|
+
def edit
|
74
|
+
end
|
75
|
+
|
76
|
+
# POST /descriptors
|
77
|
+
def create
|
78
|
+
descriptor = DescriptorServices.new(current_user, @query)
|
79
|
+
descriptor.create(descriptor_params)
|
80
|
+
|
81
|
+
# Check if the creation went ok
|
82
|
+
unless descriptor.successful?
|
83
|
+
return respond_with_error(descriptor.errors)
|
84
|
+
end
|
85
|
+
|
86
|
+
respond_with_successful(descriptor)
|
87
|
+
end
|
88
|
+
|
89
|
+
# PATCH/PUT /descriptors/:id
|
90
|
+
def update
|
91
|
+
return respond_with_not_found unless @descriptor.found?
|
92
|
+
|
93
|
+
@descriptor.update(descriptor_params)
|
94
|
+
|
95
|
+
# Check if the update went ok
|
96
|
+
unless @descriptor.successful?
|
97
|
+
return respond_with_error(@descriptor.errors)
|
98
|
+
end
|
99
|
+
|
100
|
+
respond_with_successful(@descriptor.result)
|
101
|
+
end
|
102
|
+
|
103
|
+
# DELETE /descriptors/1
|
104
|
+
def destroy
|
105
|
+
return respond_with_not_found unless @descriptor.found?
|
106
|
+
|
107
|
+
@descriptor.destroy
|
108
|
+
|
109
|
+
# Check if the deletion went ok
|
110
|
+
unless @descriptor.successful?
|
111
|
+
return respond_with_error(@descriptor.errors)
|
112
|
+
end
|
113
|
+
|
114
|
+
respond_with_successful
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
# Use callbacks to share common setup or constraints between actions.
|
120
|
+
def set_descriptor
|
121
|
+
@descriptor = DescriptorServices.new(current_user, @query).find(params[:id])
|
122
|
+
end
|
123
|
+
|
124
|
+
# Only allow a list of trusted parameters through.
|
125
|
+
def descriptor_params
|
126
|
+
params.require(:descriptor).permit(:id, :name)
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,76 @@
|
|
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::ActivitiesController < ApplicationController
|
36
|
+
# @return [HTML|JSON] HTML view for listing all activities associated to a *role*
|
37
|
+
# @description Retrieves and returns all the activities associated to a *Role*.
|
38
|
+
# The HTTP request has to specify wheter the HTML or the JSON text should be rendered
|
39
|
+
# @example
|
40
|
+
# # Executing this controller's action from javascript's frontend
|
41
|
+
# this.http.get(`127.0.0.1/administration/roles/1/activities.json`);
|
42
|
+
def index
|
43
|
+
respond_to do |format|
|
44
|
+
format.html {}
|
45
|
+
format.json do
|
46
|
+
return respond_with_not_found unless @role
|
47
|
+
|
48
|
+
respond_with_successful(Role::Activity.index(@role, @query))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Json] Json that contains all the information needed to create a new role_activity
|
54
|
+
# @description Retrieves and retuns all the information needed to create a new role_activity,
|
55
|
+
# including the list of companies and contacts.
|
56
|
+
# @example
|
57
|
+
# # Executing this controller's action from javascript's frontend
|
58
|
+
# this.http.get('127.0.0.1/house/options/projects')
|
59
|
+
def options
|
60
|
+
respond_with_successful(Role::Activity.options(current_user, @query))
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
# @return [void]
|
66
|
+
# @description Sets the requested user based on the current_users's account
|
67
|
+
# @example
|
68
|
+
# # Executing this method from a controller action:
|
69
|
+
# set_role
|
70
|
+
# puts @role
|
71
|
+
# # This will either display nil or an instance of Role
|
72
|
+
def set_role
|
73
|
+
@role = current_user.account.roles.find_by(id: params[:role_id])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|