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
@@ -1,89 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Lesli
|
3
|
-
|
4
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
5
|
-
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
7
|
-
it under the terms of the GNU General Public License as published by
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
9
|
-
(at your option) any later version.
|
10
|
-
|
11
|
-
This program is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
GNU General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU General Public License
|
17
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
-
|
19
|
-
Lesli · Ruby on Rails Development Platform.
|
20
|
-
|
21
|
-
Made with ♥ by https://www.lesli.tech
|
22
|
-
Building a better future, one line of code at a time.
|
23
|
-
|
24
|
-
@contact hello@lesli.tech
|
25
|
-
@website https://www.lesli.tech
|
26
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
-
|
28
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
-
// ·
|
30
|
-
*/
|
31
|
-
|
32
|
-
|
33
|
-
// ·
|
34
|
-
import { defineStore } from "pinia"
|
35
|
-
|
36
|
-
|
37
|
-
// ·
|
38
|
-
export const useRoles = defineStore("administration.roles", {
|
39
|
-
state: () => {
|
40
|
-
return {
|
41
|
-
list: [],
|
42
|
-
index: {
|
43
|
-
pagination: {},
|
44
|
-
records: []
|
45
|
-
}
|
46
|
-
}
|
47
|
-
},
|
48
|
-
actions: {
|
49
|
-
|
50
|
-
fetchList() {
|
51
|
-
if (!this.list.length > 0) {
|
52
|
-
this.getList()
|
53
|
-
}
|
54
|
-
},
|
55
|
-
|
56
|
-
// Get the list of role user is able to work with
|
57
|
-
// according to object level permissions
|
58
|
-
getList() {
|
59
|
-
this.http.get(this.url.admin("roles/list")).then(result => {
|
60
|
-
this.list = result
|
61
|
-
|
62
|
-
// parse the list of roles to be used in select control
|
63
|
-
/*
|
64
|
-
this.listOptions = []
|
65
|
-
this.listOptions = result.map(role => {
|
66
|
-
return {
|
67
|
-
label: role.name,
|
68
|
-
value: role.id
|
69
|
-
}
|
70
|
-
})
|
71
|
-
*/
|
72
|
-
})
|
73
|
-
},
|
74
|
-
|
75
|
-
fetchRoles() {
|
76
|
-
if (!this.list.length > 0) {
|
77
|
-
this.getRoles()
|
78
|
-
}
|
79
|
-
},
|
80
|
-
|
81
|
-
// Get the list of role user is able to work with
|
82
|
-
// according to object level permissions
|
83
|
-
getRoles() {
|
84
|
-
this.http.get(this.url.admin("roles")).then(result => {
|
85
|
-
this.index = result
|
86
|
-
})
|
87
|
-
},
|
88
|
-
}
|
89
|
-
})
|
@@ -1,67 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Lesli
|
3
|
-
|
4
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
5
|
-
|
6
|
-
This program is free software: you can redistribute it and/or modify
|
7
|
-
it under the terms of the GNU General Public License as published by
|
8
|
-
the Free Software Foundation, either version 3 of the License, or
|
9
|
-
(at your option) any later version.
|
10
|
-
|
11
|
-
This program is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
GNU General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU General Public License
|
17
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
|
-
|
19
|
-
Lesli · Ruby on Rails Development Platform.
|
20
|
-
|
21
|
-
Made with ♥ by https://www.lesli.tech
|
22
|
-
Building a better future, one line of code at a time.
|
23
|
-
|
24
|
-
@contact hello@lesli.tech
|
25
|
-
@website https://www.lesli.tech
|
26
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
|
-
|
28
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
-
// ·
|
30
|
-
*/
|
31
|
-
|
32
|
-
|
33
|
-
// ·
|
34
|
-
import { defineStore } from "pinia"
|
35
|
-
|
36
|
-
|
37
|
-
// ·
|
38
|
-
export const useSystemController = defineStore("administration.systemController", {
|
39
|
-
state: () => {
|
40
|
-
return {
|
41
|
-
options: { categories: []},
|
42
|
-
controllerActions: {},
|
43
|
-
}
|
44
|
-
},
|
45
|
-
actions: {
|
46
|
-
|
47
|
-
fetchControllers() {
|
48
|
-
this.http.get(this.url.admin("system_controllers")).then(result => {
|
49
|
-
result.forEach(controllerAction => {
|
50
|
-
if (!this.controllerActions[controllerAction.action]) {
|
51
|
-
this.controllerActions[controllerAction.action] = []
|
52
|
-
}
|
53
|
-
controllerAction['active'] = false
|
54
|
-
this.controllerActions[controllerAction.action].push(controllerAction)
|
55
|
-
})
|
56
|
-
}).catch(error => {
|
57
|
-
console.log(error)
|
58
|
-
})
|
59
|
-
},
|
60
|
-
|
61
|
-
fetchOptions() {
|
62
|
-
this.http.get(this.url.admin("system_controllers/options")).then(result => {
|
63
|
-
this.options = result
|
64
|
-
})
|
65
|
-
}
|
66
|
-
}
|
67
|
-
})
|
@@ -1,112 +0,0 @@
|
|
1
|
-
namespace :lesli_vault do
|
2
|
-
namespace :system do
|
3
|
-
|
4
|
-
desc "Testing"
|
5
|
-
task test: :environment do
|
6
|
-
puts "Testing environment"
|
7
|
-
end
|
8
|
-
|
9
|
-
namespace :controllers do
|
10
|
-
|
11
|
-
desc "Scan new routes added and create role privileges"
|
12
|
-
task build: :environment do
|
13
|
-
|
14
|
-
L2.msg("Registering engines, controllers and actions")
|
15
|
-
|
16
|
-
# get all the engines, controllers and actions
|
17
|
-
engines = scan_for_engine_controllers
|
18
|
-
|
19
|
-
# Register descriptors and privileges for all the accounts
|
20
|
-
engines.each do |engine, controllers|
|
21
|
-
|
22
|
-
controllers.each do |controller_route, controller_actions|
|
23
|
-
|
24
|
-
# Build a strig with the standard name of a Rails controller from the standard routes
|
25
|
-
# Examples:
|
26
|
-
# users converts to Users
|
27
|
-
# cloud_bell/notifications converts to CloudBell::Notifications
|
28
|
-
# sometimes we need a second split to deal with third level deep of controllers
|
29
|
-
# Example: "Account::Currency::ExchangeRatesController" from "account/currency/exchange_rates"
|
30
|
-
reference = controller_route
|
31
|
-
.split('/') # split the controller path by namespace
|
32
|
-
.collect(&:capitalize) # uppercase the first letter to match the class name convention of Rails
|
33
|
-
.join("::") # join by ruby class separator for namespaces
|
34
|
-
.split('_') # work with compound words like "exchange_rates"
|
35
|
-
.collect { |x| x[0] = x[0].upcase; x } # convert ['exchange', 'rates'] to ['Exchange', 'Rates']
|
36
|
-
.join('')
|
37
|
-
|
38
|
-
name = reference.sub('::',' ')
|
39
|
-
|
40
|
-
controller = SystemController.create_with({
|
41
|
-
name: name,
|
42
|
-
:engine => engine,
|
43
|
-
:reference => reference
|
44
|
-
}).find_or_create_by!(route: controller_route)
|
45
|
-
|
46
|
-
controller_actions.each do |action_name|
|
47
|
-
controller.actions.find_or_create_by!(name: action_name)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def scan_for_engine_controllers
|
54
|
-
|
55
|
-
# Global container
|
56
|
-
controller_list = {
|
57
|
-
"core" => {}
|
58
|
-
}
|
59
|
-
|
60
|
-
# Get the name of the instance (builder engine)
|
61
|
-
instance = Rails.configuration.lesli.dig(:instance, :name)
|
62
|
-
|
63
|
-
# Get the list of controllers and actions of the core
|
64
|
-
Rails.application.routes.routes.each do |route|
|
65
|
-
route = route.defaults
|
66
|
-
|
67
|
-
# filter the non-used core routes
|
68
|
-
next if route[:controller].blank?
|
69
|
-
next if route[:controller].include? "rails"
|
70
|
-
next if route[:controller].include? "action_mailbox"
|
71
|
-
next if route[:controller].include? "active_storage"
|
72
|
-
|
73
|
-
# create a container for the actions related to a controller
|
74
|
-
controller_list["core"][route[:controller]] = [] unless controller_list["core"][route[:controller]]
|
75
|
-
|
76
|
-
# assign and group all the actions related to the controller
|
77
|
-
controller_list["core"][route[:controller]].push(route[:action])
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
# Get the list of controllers and actions from engines
|
82
|
-
Rails.configuration.lesli.dig(:engines).each do |engine|
|
83
|
-
|
84
|
-
# load and retrieve the list of controllers and actions from an engine
|
85
|
-
routes = "#{engine[:name]}::Engine".constantize.routes.routes.each do |route|
|
86
|
-
route = route.defaults
|
87
|
-
|
88
|
-
# validate if route has information, some special routes like redirects
|
89
|
-
# can generate an empty entry in the route hash
|
90
|
-
next if route.empty?
|
91
|
-
|
92
|
-
# get the engine code
|
93
|
-
engine_code = engine[:name].underscore
|
94
|
-
|
95
|
-
# create a container for the controllers related to the engine
|
96
|
-
controller_list[engine_code] = {} if controller_list[engine_code].blank?
|
97
|
-
|
98
|
-
# assign and group all the actions related to the controller
|
99
|
-
controller_list[engine_code][route[:controller]] = [] if controller_list[engine_code][route[:controller]].blank?
|
100
|
-
|
101
|
-
# assign and group all the actions related to the controller
|
102
|
-
controller_list[engine_code][route[:controller]].push(route[:action])
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
return controller_list
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|