lesli_guard 0.2.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_guard_manifest.js +38 -0
- data/app/assets/images/lesli_guard/guard-logo.svg +160 -0
- data/app/assets/javascripts/lesli_guard/application.js +4787 -0
- data/app/assets/stylesheets/lesli_guard/application.scss +33 -0
- data/app/assets/stylesheets/lesli_guard/dashboards.scss +32 -0
- data/app/assets/stylesheets/lesli_guard/descriptors.scss +32 -0
- data/app/assets/stylesheets/lesli_guard/roles.scss +32 -0
- data/app/assets/stylesheets/lesli_guard/system_controller.scss +32 -0
- data/app/assets/stylesheets/lesli_guard/users.scss +67 -0
- data/app/controllers/lesli_guard/accounts_controller.rb +60 -0
- data/app/controllers/lesli_guard/application_controller.rb +37 -0
- data/app/controllers/lesli_guard/dashboard/components_controller.rb +60 -0
- data/app/controllers/lesli_guard/dashboards_controller.rb +36 -0
- data/app/controllers/lesli_guard/descriptor/activities_controller.rb +122 -0
- data/app/controllers/lesli_guard/descriptor/privileges_controller.rb +112 -0
- data/app/controllers/lesli_guard/descriptors_controller.rb +129 -0
- data/app/controllers/lesli_guard/role/activities_controller.rb +76 -0
- data/app/controllers/lesli_guard/role/descriptors_controller.rb +97 -0
- data/app/controllers/lesli_guard/role/privileges_controller.rb +47 -0
- data/app/controllers/lesli_guard/roles_controller.rb +185 -0
- data/app/controllers/lesli_guard/user/roles_controller.rb +98 -0
- data/app/controllers/lesli_guard/user/sessions_controller.rb +71 -0
- data/app/controllers/lesli_guard/users_controller.rb +206 -0
- data/app/helpers/lesli_guard/accounts_helper.rb +4 -0
- data/app/helpers/lesli_guard/application_helper.rb +4 -0
- data/app/helpers/lesli_guard/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_guard/descriptor/activities_helper.rb +4 -0
- data/app/helpers/lesli_guard/descriptor/privileges_helper.rb +4 -0
- data/app/helpers/lesli_guard/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_guard/role/activities_helper.rb +4 -0
- data/app/helpers/lesli_guard/role/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_guard/role/privileges_helper.rb +4 -0
- data/app/helpers/lesli_guard/roles_helper.rb +4 -0
- data/app/jobs/lesli_guard/application_job.rb +37 -0
- data/app/mailers/lesli_guard/application_mailer.rb +39 -0
- data/app/models/lesli_guard/account.rb +43 -0
- data/app/models/lesli_guard/application_record.rb +37 -0
- data/app/models/lesli_guard/dashboard/component.rb +42 -0
- data/app/models/lesli_guard/dashboard.rb +58 -0
- data/app/models/lesli_guard/descriptor/activity.rb +40 -0
- data/app/models/lesli_guard/descriptor/privilege.rb +40 -0
- data/app/models/lesli_guard/descriptor.rb +41 -0
- data/app/models/lesli_guard/role/activity.rb +40 -0
- data/app/services/lesli_guard/descriptor_privilege_service.rb +74 -0
- data/app/services/lesli_guard/descriptor_service.rb +152 -0
- data/app/services/lesli_guard/role_descriptor_service.rb +61 -0
- data/app/services/lesli_guard/role_service.rb +215 -0
- data/app/services/lesli_guard/user_service.rb +305 -0
- data/app/views/lesli_guard/accounts/_account.html.erb +2 -0
- data/app/views/lesli_guard/accounts/_form.html.erb +17 -0
- data/app/views/lesli_guard/accounts/edit.html.erb +10 -0
- data/app/views/lesli_guard/accounts/index.html.erb +14 -0
- data/app/views/lesli_guard/accounts/new.html.erb +9 -0
- data/app/views/lesli_guard/accounts/show.html.erb +10 -0
- data/app/views/lesli_guard/dashboards/show.html.erb +1 -0
- data/app/views/lesli_guard/descriptor/activities/_form.html.erb +32 -0
- data/app/views/lesli_guard/descriptor/activities/edit.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/activities/index.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/activities/new.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/activities/show.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/privileges/_form.html.erb +32 -0
- data/app/views/lesli_guard/descriptor/privileges/edit.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/privileges/index.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/privileges/new.html.erb +34 -0
- data/app/views/lesli_guard/descriptor/privileges/show.html.erb +34 -0
- data/app/views/lesli_guard/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_guard/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_guard/descriptors/index.html.erb +34 -0
- data/app/views/lesli_guard/descriptors/new.html.erb +34 -0
- data/app/views/lesli_guard/descriptors/show.html.erb +34 -0
- data/app/views/lesli_guard/partials/_engine-navigation.html.erb +38 -0
- data/app/views/lesli_guard/role/activities/_form.html.erb +32 -0
- data/app/views/lesli_guard/role/activities/edit.html.erb +34 -0
- data/app/views/lesli_guard/role/activities/index.html.erb +34 -0
- data/app/views/lesli_guard/role/activities/new.html.erb +34 -0
- data/app/views/lesli_guard/role/activities/show.html.erb +34 -0
- data/app/views/lesli_guard/role/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_guard/role/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_guard/role/descriptors/index.html.erb +34 -0
- data/app/views/lesli_guard/role/descriptors/new.html.erb +34 -0
- data/app/views/lesli_guard/role/descriptors/show.html.erb +34 -0
- data/app/views/lesli_guard/role/privileges/_form.html.erb +32 -0
- data/app/views/lesli_guard/role/privileges/edit.html.erb +34 -0
- data/app/views/lesli_guard/role/privileges/index.html.erb +34 -0
- data/app/views/lesli_guard/role/privileges/new.html.erb +34 -0
- data/app/views/lesli_guard/role/privileges/show.html.erb +34 -0
- data/app/views/lesli_guard/roles/edit.html.erb +34 -0
- data/app/views/lesli_guard/roles/index.html.erb +34 -0
- data/app/views/lesli_guard/roles/new.html.erb +34 -0
- data/app/views/lesli_guard/roles/show.html.erb +34 -0
- data/app/views/lesli_guard/users/edit.html.erb +10 -0
- data/app/views/lesli_guard/users/index.html.erb +34 -0
- data/app/views/lesli_guard/users/new.html.erb +34 -0
- data/app/views/lesli_guard/users/show.html.erb +1 -0
- data/config/locales/translations.en.yml +43 -0
- data/config/locales/translations.es.yml +43 -0
- data/config/routes.rb +90 -0
- data/db/migrate/v1/0801000110_create_lesli_guard_accounts.rb +42 -0
- data/db/migrate/v1/0801050110_create_lesli_guard_dashboards.rb +51 -0
- data/db/migrate/v1/0801050210_create_lesli_guard_dashboard_components.rb +53 -0
- data/lib/lesli_guard/engine.rb +18 -0
- data/lib/lesli_guard/version.rb +4 -0
- data/lib/lesli_guard.rb +6 -0
- data/lib/tasks/lesli_guard_tasks.rake +50 -0
- data/lib/vue/application.js +112 -0
- data/lib/vue/apps/descriptors/components/form.vue +136 -0
- data/lib/vue/apps/descriptors/edit.vue +83 -0
- data/lib/vue/apps/descriptors/index.vue +113 -0
- data/lib/vue/apps/descriptors/new.vue +69 -0
- data/lib/vue/apps/descriptors/show.vue +233 -0
- data/lib/vue/apps/roles/components/descriptors.vue +81 -0
- data/lib/vue/apps/roles/components/form.vue +253 -0
- data/lib/vue/apps/roles/components/privilegeCustom.vue +86 -0
- data/lib/vue/apps/roles/components/privilegeStandard.vue +196 -0
- data/lib/vue/apps/roles/edit.vue +118 -0
- data/lib/vue/apps/roles/index.vue +168 -0
- data/lib/vue/apps/roles/logs.vue +110 -0
- data/lib/vue/apps/roles/new.vue +86 -0
- data/lib/vue/apps/roles/show.vue +109 -0
- data/lib/vue/apps/users/components/information-card.vue +107 -0
- data/lib/vue/apps/users/components/information-form.vue +176 -0
- data/lib/vue/apps/users/components/integrations-information.vue +61 -0
- data/lib/vue/apps/users/components/management-roles.vue +107 -0
- data/lib/vue/apps/users/components/management-security.vue +113 -0
- data/lib/vue/apps/users/components/management-sessions.vue +101 -0
- data/lib/vue/apps/users/components/management-settings.vue +93 -0
- data/lib/vue/apps/users/index.vue +207 -0
- data/lib/vue/apps/users/new.vue +181 -0
- data/lib/vue/apps/users/show.vue +131 -0
- data/lib/vue/stores/descriptor.js +117 -0
- data/lib/vue/stores/descriptors.js +156 -0
- data/lib/vue/stores/role.js +203 -0
- data/lib/vue/stores/roles.js +58 -0
- data/lib/vue/stores/translations.json +98 -0
- data/lib/vue/stores/user.js +331 -0
- data/lib/vue/stores/users.js +176 -0
- data/license +674 -0
- data/readme.md +76 -0
- metadata +199 -0
@@ -0,0 +1,53 @@
|
|
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 Framework.
|
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
|
+
=end
|
32
|
+
|
33
|
+
class CreateLesliGuardDashboardComponents < ActiveRecord::Migration[6.1]
|
34
|
+
def change
|
35
|
+
gem_path = Lesli::System.engine("Lesli", "dir")
|
36
|
+
table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000502_dashboard_components.json")))
|
37
|
+
create_table :lesli_guard_dashboard_components do |t|
|
38
|
+
table_base_structure.each do |column|
|
39
|
+
t.send(
|
40
|
+
column["type"].parameterize.underscore.to_sym,
|
41
|
+
column["name"].parameterize.underscore.to_sym
|
42
|
+
)
|
43
|
+
end
|
44
|
+
t.timestamps
|
45
|
+
end
|
46
|
+
|
47
|
+
add_reference(
|
48
|
+
:lesli_guard_dashboard_components, :dashboard,
|
49
|
+
foreign_key: { to_table: :lesli_guard_dashboards },
|
50
|
+
index: { name: "lesli_guard_dashboard_components_index" }
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module LesliGuard
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace LesliGuard
|
4
|
+
|
5
|
+
initializer :lesli_guard do |app|
|
6
|
+
|
7
|
+
# register assets manifest
|
8
|
+
config.assets.precompile += %w[lesli_guard_manifest.js]
|
9
|
+
|
10
|
+
# register engine migrations path
|
11
|
+
unless app.root.to_s.match root.to_s
|
12
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
13
|
+
app.config.paths["db/migrate"] << expanded_path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/lesli_guard.rb
ADDED
@@ -0,0 +1,50 @@
|
|
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 Framework.
|
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
|
+
=end
|
32
|
+
namespace :lesli_guard do
|
33
|
+
|
34
|
+
desc "Syncing privileges for all the available roles"
|
35
|
+
task :privileges => :environment do |task, args|
|
36
|
+
role_sync_privileges()
|
37
|
+
end
|
38
|
+
|
39
|
+
# Drop, build, migrate & seed database (development only)
|
40
|
+
def role_sync_privileges
|
41
|
+
|
42
|
+
L2.msg("Syncing privileges for all the available roles")
|
43
|
+
|
44
|
+
Lesli::Descriptor.where(:name => ["owner", "sysadmin"]).each do |descriptor|
|
45
|
+
descriptor.initialize_descriptor_privileges
|
46
|
+
end
|
47
|
+
|
48
|
+
Lesli::RoleDescriptorOperator.new(Lesli::Role.all.pluck(:id)).synchronize
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,112 @@
|
|
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
|
+
|
32
|
+
|
33
|
+
// · Import Lesli builders
|
34
|
+
import application from "Lesli/application"
|
35
|
+
import translation from "Lesli/translation"
|
36
|
+
|
37
|
+
|
38
|
+
// · Import engine translations
|
39
|
+
import translations from "LesliGuard/stores/translations.json"
|
40
|
+
|
41
|
+
|
42
|
+
// ·
|
43
|
+
import applicationUserIndex from "LesliGuard/apps/users/index.vue"
|
44
|
+
import applicationUserShow from "LesliGuard/apps/users/show.vue"
|
45
|
+
|
46
|
+
import appRoleNew from "LesliGuard/apps/roles/new.vue"
|
47
|
+
import appRoleShow from "LesliGuard/apps/roles/show.vue"
|
48
|
+
import appRoleEdit from "LesliGuard/apps/roles/edit.vue"
|
49
|
+
import appRoleIndex from "LesliGuard/apps/roles/index.vue"
|
50
|
+
|
51
|
+
import appDescriptorIndex from "LesliGuard/apps/descriptors/index.vue"
|
52
|
+
import appDescriptorNew from "LesliGuard/apps/descriptors/new.vue"
|
53
|
+
import appDescriptorShow from "LesliGuard/apps/descriptors/show.vue"
|
54
|
+
|
55
|
+
|
56
|
+
// ·
|
57
|
+
import appDashboardShow from "Lesli/shared/dashboards/apps/show.vue"
|
58
|
+
import appDashboardEdit from "Lesli/shared/dashboards/apps/edit.vue"
|
59
|
+
|
60
|
+
|
61
|
+
// ·
|
62
|
+
const dashboardProps = {
|
63
|
+
components: {
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
// · Buil Lesli translations
|
69
|
+
translation(translations)
|
70
|
+
|
71
|
+
|
72
|
+
// ·
|
73
|
+
application("LesliGuard", [{
|
74
|
+
path: "/",
|
75
|
+
component: appDashboardShow,
|
76
|
+
props: dashboardProps
|
77
|
+
}, {
|
78
|
+
path: "/dashboard",
|
79
|
+
component: appDashboardShow,
|
80
|
+
props: dashboardProps
|
81
|
+
}, {
|
82
|
+
path: "/dashboards/:id/edit",
|
83
|
+
component: appDashboardEdit,
|
84
|
+
props: dashboardProps
|
85
|
+
}, {
|
86
|
+
path: "/users",
|
87
|
+
component: applicationUserIndex
|
88
|
+
}, {
|
89
|
+
path: "/users/:id",
|
90
|
+
component: applicationUserShow
|
91
|
+
}, {
|
92
|
+
path: "/roles",
|
93
|
+
component: appRoleIndex
|
94
|
+
}, {
|
95
|
+
path: "/roles/new",
|
96
|
+
component: appRoleNew
|
97
|
+
}, {
|
98
|
+
path: "/roles/:id",
|
99
|
+
component: appRoleShow
|
100
|
+
}, {
|
101
|
+
path: "/roles/:id/edit",
|
102
|
+
component: appRoleEdit
|
103
|
+
}, {
|
104
|
+
path: "/descriptors",
|
105
|
+
component: appDescriptorIndex
|
106
|
+
}, {
|
107
|
+
path: "/descriptors/new",
|
108
|
+
component: appDescriptorNew
|
109
|
+
}, {
|
110
|
+
path: "/descriptors/:id",
|
111
|
+
component: appDescriptorShow
|
112
|
+
}])
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<script setup>
|
2
|
+
/*
|
3
|
+
|
4
|
+
Lesli
|
5
|
+
|
6
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
20
|
+
|
21
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
22
|
+
|
23
|
+
Made with ♥ by https://www.lesli.tech
|
24
|
+
Building a better future, one line of code at a time.
|
25
|
+
|
26
|
+
@contact hello@lesli.tech
|
27
|
+
@website https://www.lesli.tech
|
28
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
29
|
+
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
|
+
// ·
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
// · import vue tools
|
37
|
+
import { inject, onMounted } from "vue"
|
38
|
+
|
39
|
+
|
40
|
+
// · import vue router composable
|
41
|
+
import { useRouter, useRoute } from "vue-router"
|
42
|
+
|
43
|
+
|
44
|
+
// · import lesli stores
|
45
|
+
import { useDescriptor } from "LesliGuard/stores/descriptor"
|
46
|
+
|
47
|
+
|
48
|
+
// · implement stores
|
49
|
+
const storeDescriptor = useDescriptor()
|
50
|
+
|
51
|
+
|
52
|
+
// · initialize/inject plugins
|
53
|
+
const router = useRouter()
|
54
|
+
const url = inject("url")
|
55
|
+
const route = useRoute()
|
56
|
+
|
57
|
+
|
58
|
+
// · defining props
|
59
|
+
const props = defineProps({
|
60
|
+
isEditable: {
|
61
|
+
type: Boolean,
|
62
|
+
required: false,
|
63
|
+
default: false,
|
64
|
+
},
|
65
|
+
})
|
66
|
+
|
67
|
+
|
68
|
+
// · translations
|
69
|
+
const translations = {
|
70
|
+
core: {
|
71
|
+
roles: I18n.t("core.roles"),
|
72
|
+
shared: I18n.t("core.shared"),
|
73
|
+
role_descriptors: I18n.t('core.role_descriptors')
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
function onUpdate() {
|
78
|
+
storeDescriptor.updateDescriptor()
|
79
|
+
}
|
80
|
+
|
81
|
+
function onCreate() {
|
82
|
+
storeDescriptor.postDescriptor()
|
83
|
+
}
|
84
|
+
|
85
|
+
onMounted(() => {
|
86
|
+
if (!props.isEditable){
|
87
|
+
storeDescriptor.resetDescriptor()
|
88
|
+
} else {
|
89
|
+
storeDescriptor.fetchDescriptor(route.params?.id)
|
90
|
+
}
|
91
|
+
})
|
92
|
+
|
93
|
+
</script>
|
94
|
+
<template>
|
95
|
+
<lesli-form @submit="isEditable ? onUpdate() : onCreate()">
|
96
|
+
|
97
|
+
<div class="field">
|
98
|
+
<label class="label">
|
99
|
+
{{ translations.core.view_text_name }}
|
100
|
+
<sup class="has-text-danger">*</sup>
|
101
|
+
</label>
|
102
|
+
<div class="control">
|
103
|
+
<input name="name" v-model="storeDescriptor.descriptor.payload.name" required="required" type="text" class="input">
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div class="field">
|
108
|
+
<label class="label">
|
109
|
+
{{ translations.core.role_descriptors.view_text_assign_parent_descriptor }}
|
110
|
+
</label>
|
111
|
+
<div class="control">
|
112
|
+
<lesli-select
|
113
|
+
v-model="storeDescriptor.descriptor.payload.descriptors_id"
|
114
|
+
:options="storeDescriptor.descriptors_options">
|
115
|
+
</lesli-select>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="field">
|
120
|
+
<label class="label">
|
121
|
+
{{ translations.core.role_descriptors.column_description }}
|
122
|
+
</label>
|
123
|
+
<div class="control">
|
124
|
+
<textarea class="textarea" v-model="storeDescriptor.descriptor.payload.description"></textarea>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div class="field">
|
129
|
+
<div class="control">
|
130
|
+
<lesli-button icon="save">
|
131
|
+
{{ translations.core.shared.view_btn_save }}
|
132
|
+
</lesli-button>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
</lesli-form>
|
136
|
+
</template>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<script setup>
|
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
|
+
|
33
|
+
|
34
|
+
// · import vue tools
|
35
|
+
import { onMounted, inject } from "vue"
|
36
|
+
import { useRouter, useRoute } from 'vue-router'
|
37
|
+
|
38
|
+
|
39
|
+
// · import lesli stores
|
40
|
+
import { useDescriptor } from "LesliApp/administration/stores/descriptor"
|
41
|
+
|
42
|
+
|
43
|
+
// · import components
|
44
|
+
import descriptorForm from "./components/form.vue"
|
45
|
+
|
46
|
+
|
47
|
+
// · initialize/inject plugins
|
48
|
+
const route = useRoute()
|
49
|
+
const url = inject("url")
|
50
|
+
|
51
|
+
|
52
|
+
// ·
|
53
|
+
const storeDescriptor = useDescriptor()
|
54
|
+
|
55
|
+
|
56
|
+
// ·
|
57
|
+
const translations = {
|
58
|
+
core: {
|
59
|
+
roles: I18n.t("core.roles"),
|
60
|
+
role_descriptors: I18n.t('core.role_descriptors'),
|
61
|
+
shared: I18n.t("core.shared")
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
// ·
|
67
|
+
onMounted(() => {
|
68
|
+
storeDescriptor.fetchDescriptor(route.params.id)
|
69
|
+
})
|
70
|
+
</script>
|
71
|
+
<template>
|
72
|
+
<section class="application-component">
|
73
|
+
<lesli-header :title="'Descriptor: '+storeDescriptor.descriptor.name">
|
74
|
+
<lesli-button icon="list" :to="url.admin('descriptors')">
|
75
|
+
{{ translations.core.view_btn_list }}
|
76
|
+
</lesli-button>
|
77
|
+
<lesli-button icon="settings" :to="url.admin('descriptors/:id/privileges', storeDescriptor.descriptor.id)">
|
78
|
+
{{ translations.core.roles.view_btn_edit_privilege_actions }}
|
79
|
+
</lesli-button>
|
80
|
+
</lesli-header>
|
81
|
+
<descriptor-form is-editable></descriptor-form>
|
82
|
+
</section>
|
83
|
+
</template>
|
@@ -0,0 +1,113 @@
|
|
1
|
+
<script setup>
|
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 Framework.
|
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
|
+
|
33
|
+
|
34
|
+
// · import vue tools
|
35
|
+
import {onMounted, inject } from "vue"
|
36
|
+
import { useRouter } from 'vue-router'
|
37
|
+
|
38
|
+
|
39
|
+
// · import lesli stores
|
40
|
+
import { useDescriptors } from "LesliGuard/stores/descriptors"
|
41
|
+
|
42
|
+
|
43
|
+
// · initialize/inject plugins
|
44
|
+
const url = inject("url")
|
45
|
+
|
46
|
+
|
47
|
+
// ·
|
48
|
+
const storeDescriptors = useDescriptors()
|
49
|
+
|
50
|
+
|
51
|
+
// ·
|
52
|
+
const translations = {
|
53
|
+
core: {
|
54
|
+
roles: I18n.t("core.roles"),
|
55
|
+
users: I18n.t("core.users"),
|
56
|
+
role_descriptors: I18n.t('core.role_descriptors'),
|
57
|
+
shared: I18n.t("core.shared")
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
// ·
|
63
|
+
const columns = [{
|
64
|
+
field: "id",
|
65
|
+
label: "ID",
|
66
|
+
sort: true
|
67
|
+
}, {
|
68
|
+
field: "name",
|
69
|
+
label: "Name",
|
70
|
+
sort: true
|
71
|
+
}, {
|
72
|
+
field: "privileges_count",
|
73
|
+
label: "Privileges",
|
74
|
+
align: "center",
|
75
|
+
sort: true
|
76
|
+
}, {
|
77
|
+
field: "created_at_date",
|
78
|
+
label: "Created at"
|
79
|
+
}]
|
80
|
+
|
81
|
+
|
82
|
+
// ·
|
83
|
+
onMounted(() => {
|
84
|
+
storeDescriptors.fetchDescriptors()
|
85
|
+
})
|
86
|
+
|
87
|
+
</script>
|
88
|
+
<template>
|
89
|
+
<lesli-application-container>
|
90
|
+
<lesli-header title="Role Descriptors">
|
91
|
+
<lesli-link solid icon="add" :to="url.guard('descriptors/new')">
|
92
|
+
Add descriptor
|
93
|
+
</lesli-link>
|
94
|
+
<lesli-button icon="refresh"
|
95
|
+
:loading="storeDescriptors.index.loading"
|
96
|
+
@click="storeDescriptors.getDescriptors()">
|
97
|
+
Reload
|
98
|
+
</lesli-button>
|
99
|
+
</lesli-header>
|
100
|
+
|
101
|
+
<lesli-toolbar @search="storeDescriptors.search"></lesli-toolbar>
|
102
|
+
|
103
|
+
<lesli-table
|
104
|
+
:link="(descriptor) => url.guard('descriptors/:id', descriptor.id)"
|
105
|
+
:columns="columns"
|
106
|
+
:loading="storeDescriptors.index.loading"
|
107
|
+
:records="storeDescriptors.index.records"
|
108
|
+
:pagination="storeDescriptors.index.pagination"
|
109
|
+
@paginate="storeDescriptors.paginateIndex"
|
110
|
+
@sort="storeDescriptors.sortIndex">
|
111
|
+
</lesli-table>
|
112
|
+
</lesli-application-container>
|
113
|
+
</template>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<script setup>
|
2
|
+
/*
|
3
|
+
|
4
|
+
Lesli
|
5
|
+
|
6
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
20
|
+
|
21
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
22
|
+
|
23
|
+
Made with ♥ by https://www.lesli.tech
|
24
|
+
Building a better future, one line of code at a time.
|
25
|
+
|
26
|
+
@contact hello@lesli.tech
|
27
|
+
@website https://www.lesli.tech
|
28
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
29
|
+
|
30
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
|
+
// ·
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
// · import vue tools
|
37
|
+
import { onMounted, inject } from "vue"
|
38
|
+
import { useRouter, useRoute } from "vue-router"
|
39
|
+
|
40
|
+
|
41
|
+
// ·
|
42
|
+
const url = inject("url")
|
43
|
+
|
44
|
+
|
45
|
+
// · import components
|
46
|
+
import descriptorForm from "LesliGuard/apps/descriptors/components/form.vue"
|
47
|
+
|
48
|
+
|
49
|
+
// · translations
|
50
|
+
const translations = {
|
51
|
+
core: {
|
52
|
+
roles: I18n.t("core.roles"),
|
53
|
+
shared: I18n.t("core.shared"),
|
54
|
+
role_descriptors: I18n.t('core.role_descriptors')
|
55
|
+
}
|
56
|
+
|
57
|
+
}
|
58
|
+
</script>
|
59
|
+
|
60
|
+
<template>
|
61
|
+
<lesli-application-container>
|
62
|
+
<lesli-header title="Create a new descriptor">
|
63
|
+
<lesli-button icon="list" :to="url.admin('descriptors')">
|
64
|
+
{{ translations.core.view_btn_list }}
|
65
|
+
</lesli-button>
|
66
|
+
</lesli-header>
|
67
|
+
<descriptor-form></descriptor-form>
|
68
|
+
</lesli-application-container>
|
69
|
+
</template>
|