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
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|
17
17
|
You should have received a copy of the GNU General Public License
|
18
18
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
19
|
|
20
|
-
Lesli · Ruby on Rails SaaS
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
21
|
|
22
22
|
Made with ♥ by https://www.lesli.tech
|
23
23
|
Building a better future, one line of code at a time.
|
@@ -28,7 +28,6 @@ Building a better future, one line of code at a time.
|
|
28
28
|
|
29
29
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
30
|
// ·
|
31
|
-
|
32
31
|
=end
|
33
32
|
|
34
33
|
module LesliVault
|
@@ -40,7 +39,7 @@ module LesliVault
|
|
40
39
|
respond_to do |format|
|
41
40
|
format.html {}
|
42
41
|
format.json do
|
43
|
-
respond_with_successful(
|
42
|
+
respond_with_successful(DescriptorService.new(current_user, query).list)
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
@@ -50,7 +49,8 @@ module LesliVault
|
|
50
49
|
respond_to do |format|
|
51
50
|
format.html {}
|
52
51
|
format.json do
|
53
|
-
|
52
|
+
#respond_with_successful(DescriptorService.new(current_user, query).index)
|
53
|
+
respond_with_pagination(DescriptorService.new(current_user, query).index)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -75,15 +75,14 @@ module LesliVault
|
|
75
75
|
|
76
76
|
# POST /descriptors
|
77
77
|
def create
|
78
|
-
descriptor =
|
79
|
-
descriptor.create(descriptor_params)
|
78
|
+
descriptor = DescriptorService.new(current_user, query).create(descriptor_params)
|
80
79
|
|
81
80
|
# Check if the creation went ok
|
82
|
-
|
83
|
-
|
81
|
+
if descriptor.successful?
|
82
|
+
respond_with_successful(descriptor)
|
83
|
+
else
|
84
|
+
respond_with_error(descriptor.errors)
|
84
85
|
end
|
85
|
-
|
86
|
-
respond_with_successful(descriptor)
|
87
86
|
end
|
88
87
|
|
89
88
|
# PATCH/PUT /descriptors/:id
|
@@ -34,23 +34,7 @@ Building a better future, one line of code at a time.
|
|
34
34
|
module LesliVault
|
35
35
|
class RolesController < ApplicationController
|
36
36
|
|
37
|
-
before_action :set_role, only: %i[ show update destroy ]
|
38
|
-
|
39
|
-
|
40
|
-
#@return [HTML|JSON] HTML view for listing all roles or a Json that contains a list of all roles
|
41
|
-
# associated to this *account*
|
42
|
-
#@description Retrieves and returns all roles associated to a *CloudHouse::Account*. The account
|
43
|
-
# is obtained directly from *current_user*. The HTTP request has to specify
|
44
|
-
# wheter the HTML or the JSON text should be rendered
|
45
|
-
#@example
|
46
|
-
# # Executing this controller's action from javascript's frontend
|
47
|
-
# this.http.get(`127.0.0.1/house/roles`);
|
48
|
-
def list
|
49
|
-
respond_to do |format|
|
50
|
-
format.html { }
|
51
|
-
format.json { respond_with_successful(RoleServices.new(current_user).list) }
|
52
|
-
end
|
53
|
-
end
|
37
|
+
#before_action :set_role, only: %i[ show update destroy ]
|
54
38
|
|
55
39
|
#@return [HTML|JSON] HTML view for listing all roles or a Json that contains a list of all roles
|
56
40
|
# associated to this *account*
|
@@ -64,7 +48,8 @@ module LesliVault
|
|
64
48
|
respond_to do |format|
|
65
49
|
format.html { }
|
66
50
|
format.json {
|
67
|
-
|
51
|
+
respond_with_successful(RoleService.new(current_user, query).index)
|
52
|
+
#respond_with_pagination(RoleService.new(current_user, query).index)
|
68
53
|
}
|
69
54
|
end
|
70
55
|
end
|
@@ -120,14 +105,13 @@ module LesliVault
|
|
120
105
|
# this.http.post('127.0.0.1/house/roles', data);
|
121
106
|
def create
|
122
107
|
|
123
|
-
role =
|
124
|
-
role.create(role_params)
|
108
|
+
role = RoleService.new(current_user).create(role_params)
|
125
109
|
|
126
|
-
|
127
|
-
|
110
|
+
if role.successful?
|
111
|
+
respond_with_successful(role.result)
|
112
|
+
else
|
113
|
+
respond_with_error(role.errors_as_sentence)
|
128
114
|
end
|
129
|
-
|
130
|
-
respond_with_successful(role)
|
131
115
|
end
|
132
116
|
|
133
117
|
# @controller_action_param :name [String] The name of the role
|
@@ -178,9 +162,7 @@ module LesliVault
|
|
178
162
|
# @return [JSON]
|
179
163
|
# @description Gets all the specific options for roles CRUD
|
180
164
|
def options
|
181
|
-
respond_with_successful(
|
182
|
-
:object_level_permissions => RoleServices.new(current_user).options
|
183
|
-
})
|
165
|
+
respond_with_successful(RoleService.new(current_user).options)
|
184
166
|
end
|
185
167
|
|
186
168
|
private
|
@@ -32,7 +32,7 @@ Building a better future, one line of code at a time.
|
|
32
32
|
=end
|
33
33
|
|
34
34
|
module LesliVault
|
35
|
-
class
|
35
|
+
class DescriptorService < Lesli::ApplicationLesliService
|
36
36
|
|
37
37
|
# @overwrite
|
38
38
|
# @return {Object}
|
@@ -46,14 +46,9 @@ module LesliVault
|
|
46
46
|
# @return [Array] Paginated index of users.
|
47
47
|
# @description Return a paginated array of users, used mostly in frontend views
|
48
48
|
def index
|
49
|
+
|
49
50
|
descriptors = current_user.account.descriptors.where.not(
|
50
51
|
:name => ["owner"]
|
51
|
-
).select(
|
52
|
-
:id,
|
53
|
-
:name,
|
54
|
-
:category,
|
55
|
-
"coalesce(actions.total, 0) as privileges_count",
|
56
|
-
Date2.new.date_time.db_timestamps("descriptors")
|
57
52
|
)
|
58
53
|
|
59
54
|
# Count the amount of privileges assigned to every descriptor
|
@@ -62,12 +57,20 @@ module LesliVault
|
|
62
57
|
select
|
63
58
|
count(1) as total,
|
64
59
|
descriptor_id
|
65
|
-
from
|
60
|
+
from lesli_descriptor_privileges
|
66
61
|
--where apga.status = TRUE
|
67
62
|
group by descriptor_id
|
68
63
|
) as actions
|
69
|
-
on actions.descriptor_id =
|
64
|
+
on actions.descriptor_id = lesli_descriptors.id
|
70
65
|
))
|
66
|
+
|
67
|
+
descriptors = descriptors.select(
|
68
|
+
:id,
|
69
|
+
:name,
|
70
|
+
:method,
|
71
|
+
"coalesce(actions.total, 0) as privileges_count",
|
72
|
+
Date2.new.date_time.db_timestamps("lesli_descriptors")
|
73
|
+
)
|
71
74
|
|
72
75
|
# skip native descriptors
|
73
76
|
#descriptors = descriptors.where.not("descriptors.name in (?)", ["owner", "sysadmin", "profile"])
|
@@ -77,10 +80,10 @@ module LesliVault
|
|
77
80
|
# descriptors = descriptors.where("(LOWER(descriptors.name) SIMILAR TO ?)", search_string)
|
78
81
|
# end
|
79
82
|
|
80
|
-
descriptors
|
81
|
-
|
82
|
-
|
83
|
-
|
83
|
+
return descriptors
|
84
|
+
.page(query[:pagination][:page])
|
85
|
+
.per(query[:pagination][:perPage])
|
86
|
+
.order("#{query[:order][:by]} #{query[:order][:dir]} NULLS LAST")
|
84
87
|
end
|
85
88
|
|
86
89
|
# @overwrite
|
@@ -144,54 +147,6 @@ module LesliVault
|
|
144
147
|
end
|
145
148
|
|
146
149
|
self
|
147
|
-
end
|
148
|
-
|
149
|
-
# @return [void]
|
150
|
-
# @param role_descriptor [RoleDescriptor] The role_descriptor on wich we want to add the system actions
|
151
|
-
# @description Return the list of privilege actions defined for
|
152
|
-
# profile descriptor
|
153
|
-
# Example
|
154
|
-
# RoleDescriptor::DefaultPrivilegeActionsService.add_profile_actions(RoleDescriptor.last)
|
155
|
-
def self.add_profile_privileges(descriptor)
|
156
|
-
|
157
|
-
# Adding default system actions for profile descriptor
|
158
|
-
[
|
159
|
-
{ controller: "Profiles", actions: ["show"] }, # enable profile view
|
160
|
-
#{ controller: "profile/subscriptions", actions: ["options", "index"] }, # enable profile subscriptions
|
161
|
-
#{ controller: "user/sessions", actions: ["index"] }, # seession management
|
162
|
-
{ controller: "Users", actions: ["options", "update"] } # enable user edition
|
163
|
-
].each do |controller_action|
|
164
|
-
|
165
|
-
controller_action[:actions].each do |action_name|
|
166
|
-
|
167
|
-
system_controller_action = SystemController::Action.joins(:system_controller)
|
168
|
-
.where("system_controllers.reference = ?", controller_action[:controller])
|
169
|
-
.where("system_controller_actions.name = ?", action_name).first
|
170
|
-
|
171
|
-
descriptor.privileges.find_or_create_by(
|
172
|
-
system_controller_action: system_controller_action
|
173
|
-
)
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# @return [void]
|
179
|
-
# @param role_descriptor [RoleDescriptor] The role_descriptor on wich we want to add the system actions
|
180
|
-
# @description Return the list of privilege actions defined for
|
181
|
-
# profile descriptor
|
182
|
-
# Example
|
183
|
-
# RoleDescriptor::DefaultPrivilegeActionsService.add_profile_actions(RoleDescriptor.last)
|
184
|
-
def self.add_owner_privileges(descriptor)
|
185
|
-
|
186
|
-
# Adding default system actions for profile descriptor
|
187
|
-
actions = SystemController::Action.all
|
188
|
-
|
189
|
-
actions.each do |action|
|
190
|
-
descriptor.privileges.find_or_create_by(
|
191
|
-
system_controller_action: action
|
192
|
-
)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
150
|
+
end
|
196
151
|
end
|
197
152
|
end
|
@@ -32,44 +32,28 @@ Building a better future, one line of code at a time.
|
|
32
32
|
=end
|
33
33
|
|
34
34
|
module LesliVault
|
35
|
-
class
|
35
|
+
class RoleService < Lesli::ApplicationLesliService
|
36
36
|
|
37
|
-
# @overwrite
|
38
|
-
# @return {Object}
|
39
|
-
# @description Finds a role according the ID given
|
40
|
-
def find id
|
41
|
-
self.resource = current_user.account.roles.find_by_id(id)
|
42
|
-
self
|
43
|
-
end
|
44
37
|
|
45
|
-
# @
|
46
|
-
# @
|
47
|
-
# @description Retrives the role
|
48
|
-
def show
|
49
|
-
self.resource
|
50
|
-
end
|
51
|
-
|
52
|
-
# @overwrite
|
53
|
-
# @return [Array] Paginated index of roles.
|
54
|
-
# @description Return a paginated array of roles, used mostly in frontend views
|
38
|
+
# @return [Array] Paginated index of users.
|
39
|
+
# @description Return a paginated array of users, used mostly in frontend views
|
55
40
|
def index
|
56
41
|
|
57
|
-
current_user.account.roles
|
58
|
-
|
42
|
+
current_user.account.roles.where.not(
|
43
|
+
:name => ["owner"]
|
44
|
+
).joins("
|
59
45
|
left join (
|
60
46
|
select
|
61
47
|
count(1) users,
|
62
48
|
role_id
|
63
|
-
from
|
64
|
-
inner join
|
65
|
-
on u.id =
|
49
|
+
from lesli_user_powers
|
50
|
+
inner join lesli_users as u
|
51
|
+
on u.id = lesli_user_powers.user_id
|
66
52
|
and u.deleted_at is null
|
67
|
-
where
|
53
|
+
where lesli_user_powers.deleted_at is null
|
68
54
|
group by (role_id)
|
69
|
-
)
|
70
|
-
|
71
|
-
")
|
72
|
-
.where("roles.object_level_permission < ?", current_user.max_object_level_permission)
|
55
|
+
) users on users.role_id = lesli_roles.id
|
56
|
+
").where("lesli_roles.object_level_permission <= ?", current_user.max_object_level_permission)
|
73
57
|
.select(
|
74
58
|
:id,
|
75
59
|
:name,
|
@@ -85,15 +69,11 @@ module LesliVault
|
|
85
69
|
.order(object_level_permission: :desc, name: :asc)
|
86
70
|
end
|
87
71
|
|
88
|
-
#
|
89
|
-
#
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
).order(
|
94
|
-
object_level_permission: :desc,
|
95
|
-
name: :asc
|
96
|
-
).select(:id, :name, :object_level_permission)
|
72
|
+
# @overwrite
|
73
|
+
# @return {Object}
|
74
|
+
# @description Retrives the role
|
75
|
+
def show
|
76
|
+
self.resource
|
97
77
|
end
|
98
78
|
|
99
79
|
# @overwrite
|
@@ -101,6 +81,7 @@ module LesliVault
|
|
101
81
|
# @param {params} Hash of the permitted attributes for a role
|
102
82
|
# @description Creates a new role
|
103
83
|
def create params
|
84
|
+
|
104
85
|
role = current_user.account.roles.new(params)
|
105
86
|
|
106
87
|
unless current_user.can_work_with_role?(role)
|
@@ -112,10 +93,13 @@ module LesliVault
|
|
112
93
|
self.error(I18n.t("core.roles.messages_danger_creating_role_object_level_permission_too_high"))
|
113
94
|
end
|
114
95
|
|
96
|
+
# do not create if errors found
|
97
|
+
return self unless self.successful?
|
98
|
+
|
115
99
|
# Try to save role and logs if it went OK
|
116
100
|
if role.save
|
117
101
|
self.resource = role
|
118
|
-
Role::Activity.log_create(current_user, self.resource)
|
102
|
+
#Role::Activity.log_create(current_user, self.resource)
|
119
103
|
else
|
120
104
|
self.error(role.errors.full_messages.to_sentence)
|
121
105
|
end
|
@@ -158,7 +142,23 @@ module LesliVault
|
|
158
142
|
self
|
159
143
|
end
|
160
144
|
|
161
|
-
|
145
|
+
# @overwrite
|
146
|
+
# @return {Object}
|
147
|
+
# @description Finds a role according the ID given
|
148
|
+
def find id
|
149
|
+
#self.resource = current_user.account.roles.find_by_id(id)
|
150
|
+
#self
|
151
|
+
end
|
152
|
+
|
153
|
+
def options
|
154
|
+
{
|
155
|
+
:object_level_permissions => self.roles_with_object_level_permission
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
private
|
160
|
+
|
161
|
+
def roles_with_object_level_permission
|
162
162
|
levels = {}
|
163
163
|
|
164
164
|
# get all the different object level permission registered in the roles
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<%
|
1
2
|
=begin
|
2
3
|
|
3
4
|
Lesli
|
@@ -28,13 +29,9 @@ Building a better future, one line of code at a time.
|
|
28
29
|
|
29
30
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
31
|
// ·
|
31
|
-
|
32
32
|
=end
|
33
|
+
%>
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
has_many :actions
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
35
|
+
<%= navigation_item(lesli_vault.dashboard_path, "Dashboard", "ri-dashboard-3-line"); %>
|
36
|
+
<%= navigation_item(lesli_vault.roles_path, "Roles", "ri-shield-user-line") %>
|
37
|
+
<%= navigation_item(lesli_vault.descriptors_path, "Descriptors", "ri-shield-check-line") %>
|
data/config/routes.rb
CHANGED
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|
17
17
|
You should have received a copy of the GNU General Public License
|
18
18
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
19
|
|
20
|
-
Lesli · Ruby on Rails SaaS
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
21
|
|
22
22
|
Made with ♥ by https://www.lesli.tech
|
23
23
|
Building a better future, one line of code at a time.
|
@@ -28,13 +28,17 @@ Building a better future, one line of code at a time.
|
|
28
28
|
|
29
29
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
30
|
// ·
|
31
|
-
|
32
31
|
=end
|
33
32
|
|
34
33
|
LesliVault::Engine.routes.draw do
|
35
34
|
root to: "dashboards#show"
|
36
35
|
|
36
|
+
resource :dashboard, only: [:show]
|
37
|
+
|
37
38
|
resources :roles do
|
39
|
+
collection do
|
40
|
+
get :options
|
41
|
+
end
|
38
42
|
scope module: :role do
|
39
43
|
resources :privileges
|
40
44
|
resources :descriptors
|
@@ -42,7 +46,7 @@ LesliVault::Engine.routes.draw do
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
|
-
resources :descriptors do
|
49
|
+
resources :descriptors, only: [:index, :new, :create] do
|
46
50
|
scope module: :descriptor do
|
47
51
|
resources :privileges
|
48
52
|
resources :activities
|
data/lib/lesli_vault/version.rb
CHANGED
data/lib/vue/application.js
CHANGED
@@ -1,7 +1,54 @@
|
|
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 SaaS Development Framework.
|
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
|
+
|
1
32
|
|
2
33
|
// ·
|
3
34
|
import application from "Lesli/application"
|
35
|
+
import appRolesNew from "LesliVault/apps/roles/new.vue"
|
36
|
+
import appRolesIndex from "LesliVault/apps/roles/index.vue"
|
37
|
+
import appDescriptorsIndex from "LesliVault/apps/descriptors/index.vue"
|
38
|
+
import appDescriptorsNew from "LesliVault/apps/descriptors/new.vue"
|
4
39
|
|
5
40
|
|
6
41
|
// ·
|
7
|
-
application("LesliVault", [
|
42
|
+
application("LesliVault", [{
|
43
|
+
path: "/roles",
|
44
|
+
component: appRolesIndex
|
45
|
+
}, {
|
46
|
+
path: "/roles/new",
|
47
|
+
component: appRolesNew
|
48
|
+
}, {
|
49
|
+
path: "/descriptors",
|
50
|
+
component: appDescriptorsIndex
|
51
|
+
}, {
|
52
|
+
path: "/descriptors/new",
|
53
|
+
component: appDescriptorsNew
|
54
|
+
}])
|
@@ -18,18 +18,17 @@ GNU General Public License for more details.
|
|
18
18
|
You should have received a copy of the GNU General Public License
|
19
19
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
20
20
|
|
21
|
-
Lesli ·
|
21
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
22
22
|
|
23
23
|
Made with ♥ by https://www.lesli.tech
|
24
24
|
Building a better future, one line of code at a time.
|
25
25
|
|
26
26
|
@contact hello@lesli.tech
|
27
|
-
@website https://lesli.tech
|
27
|
+
@website https://www.lesli.tech
|
28
28
|
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
29
29
|
|
30
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
31
|
// ·
|
32
|
-
|
33
32
|
*/
|
34
33
|
|
35
34
|
|
@@ -38,14 +37,14 @@ Building a better future, one line of code at a time.
|
|
38
37
|
import { inject, onMounted } from "vue"
|
39
38
|
|
40
39
|
|
41
|
-
// · import lesli stores
|
42
|
-
import { useDescriptor } from "../../../stores/descriptor"
|
43
|
-
|
44
|
-
|
45
40
|
// · import vue router composable
|
46
41
|
import { useRouter, useRoute } from "vue-router"
|
47
42
|
|
48
43
|
|
44
|
+
// · import lesli stores
|
45
|
+
import { useDescriptor } from "LesliVault/stores/descriptor"
|
46
|
+
|
47
|
+
|
49
48
|
// · implement stores
|
50
49
|
const storeDescriptor = useDescriptor()
|
51
50
|
|
@@ -73,21 +72,14 @@ const translations = {
|
|
73
72
|
shared: I18n.t("core.shared"),
|
74
73
|
role_descriptors: I18n.t('core.role_descriptors')
|
75
74
|
}
|
76
|
-
|
77
75
|
}
|
78
76
|
|
79
|
-
|
80
|
-
* @description This function is used to update the descriptor information
|
81
|
-
*/
|
82
|
-
const onUpdate = () => {
|
77
|
+
function onUpdate() {
|
83
78
|
storeDescriptor.updateDescriptor()
|
84
79
|
}
|
85
80
|
|
86
|
-
|
87
|
-
|
88
|
-
*/
|
89
|
-
const onCreate = () => {
|
90
|
-
storeDescriptor.createDescriptor()
|
81
|
+
function onCreate() {
|
82
|
+
storeDescriptor.postDescriptor()
|
91
83
|
}
|
92
84
|
|
93
85
|
onMounted(() => {
|
@@ -100,10 +92,7 @@ onMounted(() => {
|
|
100
92
|
|
101
93
|
</script>
|
102
94
|
<template>
|
103
|
-
<lesli-form
|
104
|
-
class="information"
|
105
|
-
v-if="!storeDescriptor.loading"
|
106
|
-
@submit="isEditable ? onUpdate() : onCreate()">
|
95
|
+
<lesli-form @submit="isEditable ? onUpdate() : onCreate()">
|
107
96
|
|
108
97
|
<div class="field">
|
109
98
|
<label class="label">
|
@@ -111,7 +100,7 @@ onMounted(() => {
|
|
111
100
|
<sup class="has-text-danger">*</sup>
|
112
101
|
</label>
|
113
102
|
<div class="control">
|
114
|
-
<input name="name" v-model="storeDescriptor.descriptor.name" required="required" type="text" class="input">
|
103
|
+
<input name="name" v-model="storeDescriptor.descriptor.payload.name" required="required" type="text" class="input">
|
115
104
|
</div>
|
116
105
|
</div>
|
117
106
|
|
@@ -121,7 +110,7 @@ onMounted(() => {
|
|
121
110
|
</label>
|
122
111
|
<div class="control">
|
123
112
|
<lesli-select
|
124
|
-
v-model="storeDescriptor.descriptor.descriptors_id"
|
113
|
+
v-model="storeDescriptor.descriptor.payload.descriptors_id"
|
125
114
|
:options="storeDescriptor.descriptors_options">
|
126
115
|
</lesli-select>
|
127
116
|
</div>
|
@@ -132,7 +121,7 @@ onMounted(() => {
|
|
132
121
|
{{ translations.core.role_descriptors.column_description }}
|
133
122
|
</label>
|
134
123
|
<div class="control">
|
135
|
-
<textarea class="textarea" v-model="storeDescriptor.descriptor.description"></textarea>
|
124
|
+
<textarea class="textarea" v-model="storeDescriptor.descriptor.payload.description"></textarea>
|
136
125
|
</div>
|
137
126
|
</div>
|
138
127
|
|
@@ -38,7 +38,7 @@ import { useRouter } from 'vue-router'
|
|
38
38
|
|
39
39
|
|
40
40
|
// · import lesli stores
|
41
|
-
import { useDescriptors } from "
|
41
|
+
import { useDescriptors } from "LesliVault/stores/descriptors"
|
42
42
|
|
43
43
|
|
44
44
|
// · initialize/inject plugins
|
@@ -87,30 +87,28 @@ onMounted(() => {
|
|
87
87
|
|
88
88
|
</script>
|
89
89
|
<template>
|
90
|
-
<application-
|
90
|
+
<lesli-application-container>
|
91
91
|
<lesli-header title="Role Descriptors">
|
92
92
|
<lesli-button icon="refresh"
|
93
93
|
:loading="storeDescriptors.index.loading"
|
94
94
|
@click="storeDescriptors.getDescriptors()">
|
95
|
-
|
96
|
-
</lesli-button>
|
97
|
-
<lesli-button icon="add" :to="url.admin(`descriptors/new`)">
|
98
|
-
{{ translations.core.role_descriptors.view_btn_new_role_descriptor }}
|
95
|
+
Reload
|
99
96
|
</lesli-button>
|
97
|
+
<lesli-link main icon="add" :to="url.vault('descriptors/new')">
|
98
|
+
Add descriptor
|
99
|
+
</lesli-link>
|
100
100
|
</lesli-header>
|
101
101
|
|
102
|
-
<lesli-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
</lesli-card>
|
115
|
-
</application-component>
|
102
|
+
<lesli-toolbar @search="storeDescriptors.search"></lesli-toolbar>
|
103
|
+
|
104
|
+
<lesli-table
|
105
|
+
:link="(descriptor) => url.vault('descriptors/:id', descriptor.id)"
|
106
|
+
:columns="columns"
|
107
|
+
:loading="storeDescriptors.index.loading"
|
108
|
+
:records="storeDescriptors.index.records"
|
109
|
+
:pagination="storeDescriptors.index.pagination"
|
110
|
+
@paginate="storeDescriptors.paginateIndex"
|
111
|
+
@sort="storeDescriptors.sortIndex">
|
112
|
+
</lesli-table>
|
113
|
+
</lesli-application-container>
|
116
114
|
</template>
|