lesli_security 0.3.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_security_manifest.js +38 -0
- data/app/assets/images/lesli_security/security-logo.svg +57 -0
- data/app/assets/javascripts/lesli_security/application.js +5583 -0
- data/app/assets/stylesheets/lesli_security/application.css +95 -0
- data/app/controllers/lesli_security/accounts_controller.rb +60 -0
- data/app/controllers/lesli_security/application_controller.rb +37 -0
- data/app/controllers/lesli_security/dashboard/components_controller.rb +60 -0
- data/app/controllers/lesli_security/dashboards_controller.rb +36 -0
- data/app/controllers/lesli_security/descriptor/activities_controller.rb +122 -0
- data/app/controllers/lesli_security/descriptor/privileges_controller.rb +112 -0
- data/app/controllers/lesli_security/descriptors_controller.rb +129 -0
- data/app/controllers/lesli_security/role/activities_controller.rb +76 -0
- data/app/controllers/lesli_security/role/descriptors_controller.rb +97 -0
- data/app/controllers/lesli_security/role/privileges_controller.rb +47 -0
- data/app/controllers/lesli_security/roles_controller.rb +185 -0
- data/app/controllers/lesli_security/user/roles_controller.rb +98 -0
- data/app/controllers/lesli_security/user/sessions_controller.rb +71 -0
- data/app/controllers/lesli_security/users_controller.rb +206 -0
- data/app/helpers/lesli_security/accounts_helper.rb +4 -0
- data/app/helpers/lesli_security/application_helper.rb +4 -0
- data/app/helpers/lesli_security/dashboards_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptor/activities_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptor/privileges_helper.rb +4 -0
- data/app/helpers/lesli_security/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_security/role/activities_helper.rb +4 -0
- data/app/helpers/lesli_security/role/descriptors_helper.rb +4 -0
- data/app/helpers/lesli_security/role/privileges_helper.rb +4 -0
- data/app/helpers/lesli_security/roles_helper.rb +4 -0
- data/app/jobs/lesli_security/application_job.rb +37 -0
- data/app/mailers/lesli_security/application_mailer.rb +39 -0
- data/app/models/lesli_security/account.rb +43 -0
- data/app/models/lesli_security/application_record.rb +37 -0
- data/app/models/lesli_security/dashboard/component.rb +42 -0
- data/app/models/lesli_security/dashboard.rb +58 -0
- data/app/models/lesli_security/descriptor/activity.rb +40 -0
- data/app/models/lesli_security/descriptor/privilege.rb +40 -0
- data/app/models/lesli_security/descriptor.rb +41 -0
- data/app/models/lesli_security/role/activity.rb +40 -0
- data/app/services/lesli_security/descriptor_privilege_service.rb +74 -0
- data/app/services/lesli_security/descriptor_service.rb +152 -0
- data/app/services/lesli_security/role_descriptor_service.rb +61 -0
- data/app/services/lesli_security/role_service.rb +215 -0
- data/app/services/lesli_security/user_service.rb +305 -0
- data/app/views/lesli_security/accounts/_account.html.erb +2 -0
- data/app/views/lesli_security/accounts/_form.html.erb +17 -0
- data/app/views/lesli_security/accounts/edit.html.erb +10 -0
- data/app/views/lesli_security/accounts/index.html.erb +14 -0
- data/app/views/lesli_security/accounts/new.html.erb +9 -0
- data/app/views/lesli_security/accounts/show.html.erb +10 -0
- data/app/views/lesli_security/dashboards/show.html.erb +1 -0
- data/app/views/lesli_security/descriptor/activities/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptor/activities/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/index.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/new.html.erb +34 -0
- data/app/views/lesli_security/descriptor/activities/show.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptor/privileges/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/index.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/new.html.erb +34 -0
- data/app/views/lesli_security/descriptor/privileges/show.html.erb +34 -0
- data/app/views/lesli_security/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_security/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_security/descriptors/index.html.erb +34 -0
- data/app/views/lesli_security/descriptors/new.html.erb +34 -0
- data/app/views/lesli_security/descriptors/show.html.erb +34 -0
- data/app/views/lesli_security/partials/_engine-navigation.html.erb +38 -0
- data/app/views/lesli_security/role/activities/_form.html.erb +32 -0
- data/app/views/lesli_security/role/activities/edit.html.erb +34 -0
- data/app/views/lesli_security/role/activities/index.html.erb +34 -0
- data/app/views/lesli_security/role/activities/new.html.erb +34 -0
- data/app/views/lesli_security/role/activities/show.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/_form.html.erb +32 -0
- data/app/views/lesli_security/role/descriptors/edit.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/index.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/new.html.erb +34 -0
- data/app/views/lesli_security/role/descriptors/show.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/_form.html.erb +32 -0
- data/app/views/lesli_security/role/privileges/edit.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/index.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/new.html.erb +34 -0
- data/app/views/lesli_security/role/privileges/show.html.erb +34 -0
- data/app/views/lesli_security/roles/edit.html.erb +34 -0
- data/app/views/lesli_security/roles/index.html.erb +34 -0
- data/app/views/lesli_security/roles/new.html.erb +34 -0
- data/app/views/lesli_security/roles/show.html.erb +34 -0
- data/app/views/lesli_security/users/edit.html.erb +10 -0
- data/app/views/lesli_security/users/index.html.erb +34 -0
- data/app/views/lesli_security/users/new.html.erb +34 -0
- data/app/views/lesli_security/users/show.html.erb +1 -0
- data/config/locales/translations.en.yml +44 -0
- data/config/locales/translations.es.yml +44 -0
- data/config/locales/translations.fr.yml +44 -0
- data/config/locales/translations.it.yml +44 -0
- data/config/locales/translations.pt.yml +44 -0
- data/config/routes.rb +90 -0
- data/db/migrate/v1/0010000210_create_lesli_roles.rb +60 -0
- data/db/migrate/v1/0010000310_create_lesli_users.rb +97 -0
- data/db/migrate/v1/0010003010_create_lesli_user_details.rb +49 -0
- data/db/migrate/v1/0010003110_create_lesli_user_settings.rb +44 -0
- data/db/migrate/v1/0010003210_create_lesli_user_sessions.rb +55 -0
- data/db/migrate/v1/0010003410_create_lesli_user_powers.rb +43 -0
- data/db/migrate/v1/0010004010_create_lesli_user_logs.rb +45 -0
- data/db/migrate/v1/0010005010_create_lesli_descriptors.rb +44 -0
- data/db/migrate/v1/0010005110_create_lesli_descriptor_privileges.rb +45 -0
- data/db/migrate/v1/0010005210_create_lesli_descriptor_activities.rb +49 -0
- data/db/migrate/v1/0010005510_create_lesli_role_powers.rb +51 -0
- data/db/migrate/v1/0010005710_create_lesli_role_privileges.rb +45 -0
- data/db/migrate/v1/0802000110_create_lesli_security_accounts.rb +42 -0
- data/db/migrate/v1/0802050110_create_lesli_security_dashboards.rb +51 -0
- data/db/migrate/v1/0802050210_create_lesli_security_dashboard_components.rb +53 -0
- data/lib/lesli_security/engine.rb +18 -0
- data/lib/lesli_security/version.rb +4 -0
- data/lib/lesli_security.rb +6 -0
- data/lib/scss/application.scss +38 -0
- data/lib/scss/users.scss +67 -0
- data/lib/tasks/lesli_security_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 +104 -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 +277 -0
- data/lib/vue/stores/user.js +331 -0
- data/lib/vue/stores/users.js +166 -0
- data/license +674 -0
- data/readme.md +76 -0
- metadata +225 -0
@@ -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 "LesliSecurity/vue/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.security('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.security('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 "LesliSecurity/vue/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>
|
@@ -0,0 +1,233 @@
|
|
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, ref } from "vue"
|
38
|
+
|
39
|
+
|
40
|
+
// · import lesli stores
|
41
|
+
import { useDescriptor } from "LesliSecurity/vue/stores/descriptor"
|
42
|
+
import { useSystemController } from "Lesli/vue/shared/stores/systemController"
|
43
|
+
|
44
|
+
|
45
|
+
// · import vue router composable
|
46
|
+
import { useRouter, useRoute } from "vue-router"
|
47
|
+
|
48
|
+
|
49
|
+
// · initialize/inject plugins
|
50
|
+
const route = useRoute()
|
51
|
+
const url = inject("url")
|
52
|
+
|
53
|
+
|
54
|
+
// · implement stores
|
55
|
+
const storeDescriptor = useDescriptor()
|
56
|
+
const storeSystemController = useSystemController()
|
57
|
+
|
58
|
+
|
59
|
+
// · translations
|
60
|
+
const translations = {
|
61
|
+
core: {
|
62
|
+
roles: I18n.t("core.roles"),
|
63
|
+
shared: I18n.t("core.shared"),
|
64
|
+
descriptors: I18n.t('core.role_descriptors')
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
//
|
70
|
+
const tab = ref(0)
|
71
|
+
|
72
|
+
|
73
|
+
//
|
74
|
+
const columns = [{
|
75
|
+
field: 'controller',
|
76
|
+
label: 'Controller'
|
77
|
+
},{
|
78
|
+
field: 'list_action',
|
79
|
+
label: 'List',
|
80
|
+
align: 'center'
|
81
|
+
},{
|
82
|
+
field: 'index_action',
|
83
|
+
label: 'Index',
|
84
|
+
align: 'center'
|
85
|
+
},{
|
86
|
+
field: 'show_action',
|
87
|
+
label: 'Show',
|
88
|
+
align: 'center'
|
89
|
+
},{
|
90
|
+
field: 'create_action',
|
91
|
+
label: 'Create',
|
92
|
+
align: 'center'
|
93
|
+
},{
|
94
|
+
field: 'update_action',
|
95
|
+
label: 'Update',
|
96
|
+
align: 'center'
|
97
|
+
},{
|
98
|
+
field: 'destroy_action',
|
99
|
+
label: 'Delete',
|
100
|
+
align: 'center'
|
101
|
+
}]
|
102
|
+
|
103
|
+
|
104
|
+
//
|
105
|
+
onMounted(() => {
|
106
|
+
storeDescriptor.getDescriptor(route.params.id)
|
107
|
+
})
|
108
|
+
|
109
|
+
|
110
|
+
//
|
111
|
+
function addPrivilege(active, action) {
|
112
|
+
if (active) {
|
113
|
+
storeDescriptor.postDescriptorPrivilege(action)
|
114
|
+
} else {
|
115
|
+
storeDescriptor.deleteDescriptorPrivilege(action)
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
</script>
|
120
|
+
<template>
|
121
|
+
<lesli-application-container>
|
122
|
+
<lesli-header :title="'Descriptor: '+storeDescriptor.descriptor.name">
|
123
|
+
</lesli-header>
|
124
|
+
|
125
|
+
<lesli-table
|
126
|
+
:columns="columns"
|
127
|
+
:records="storeDescriptor.privileges"
|
128
|
+
:loading="storeDescriptor.privilegesLoading">
|
129
|
+
|
130
|
+
|
131
|
+
<!-- table header -->
|
132
|
+
|
133
|
+
<template #head(list_action)="{ column }">
|
134
|
+
<span class="icon-text">
|
135
|
+
<span class="icon">
|
136
|
+
<span class="material-icons">
|
137
|
+
format_list_bulleted
|
138
|
+
</span>
|
139
|
+
</span>
|
140
|
+
<span>{{ column.label }}</span>
|
141
|
+
</span>
|
142
|
+
</template>
|
143
|
+
|
144
|
+
<template #head(index_action)="{ column }">
|
145
|
+
<span class="icon-text">
|
146
|
+
<span class="icon">
|
147
|
+
<span class="material-icons">
|
148
|
+
format_list_numbered
|
149
|
+
</span>
|
150
|
+
</span>
|
151
|
+
<span>{{ column.label }}</span>
|
152
|
+
</span>
|
153
|
+
</template>
|
154
|
+
|
155
|
+
<template #head(show_action)="{ column }">
|
156
|
+
<span class="icon-text">
|
157
|
+
<span class="icon">
|
158
|
+
<span class="material-icons">
|
159
|
+
visibility
|
160
|
+
</span>
|
161
|
+
</span>
|
162
|
+
<span>{{ column.label }}</span>
|
163
|
+
</span>
|
164
|
+
</template>
|
165
|
+
|
166
|
+
<template #head(create_action)="{ column }">
|
167
|
+
<span class="icon-text">
|
168
|
+
<span class="icon">
|
169
|
+
<span class="material-icons">
|
170
|
+
add
|
171
|
+
</span>
|
172
|
+
</span>
|
173
|
+
<span>{{ column.label }}</span>
|
174
|
+
</span>
|
175
|
+
</template>
|
176
|
+
|
177
|
+
<template #head(update_action)="{ column }">
|
178
|
+
<span class="icon-text">
|
179
|
+
<span class="icon">
|
180
|
+
<span class="material-icons">
|
181
|
+
edit
|
182
|
+
</span>
|
183
|
+
</span>
|
184
|
+
<span>{{ column.label }}</span>
|
185
|
+
</span>
|
186
|
+
</template>
|
187
|
+
|
188
|
+
<template #head(destroy_action)="{ column }">
|
189
|
+
<span class="icon-text">
|
190
|
+
<span class="icon">
|
191
|
+
<span class="material-icons">
|
192
|
+
delete
|
193
|
+
</span>
|
194
|
+
</span>
|
195
|
+
<span>{{ column.label }}</span>
|
196
|
+
</span>
|
197
|
+
</template>
|
198
|
+
|
199
|
+
|
200
|
+
<!-- table content -->
|
201
|
+
|
202
|
+
<template #list_action="{ record, value }">
|
203
|
+
<lesli-toggle v-if="value" v-model="record.list_active" @update:modelValue="addPrivilege(record.list_active, record.list_action)">
|
204
|
+
</lesli-toggle>
|
205
|
+
</template>
|
206
|
+
|
207
|
+
<template #index_action="{ record, value }">
|
208
|
+
<lesli-toggle v-if="value" v-model="record.index_active" @update:modelValue="addPrivilege(record.index_active, record.index_action)">
|
209
|
+
</lesli-toggle>
|
210
|
+
</template>
|
211
|
+
|
212
|
+
<template #show_action="{ record, value }">
|
213
|
+
<lesli-toggle v-if="value" v-model="record.show_active" @update:modelValue="addPrivilege(record.show_active, record.show_action)">
|
214
|
+
</lesli-toggle>
|
215
|
+
</template>
|
216
|
+
|
217
|
+
<template #create_action="{ record, value }">
|
218
|
+
<lesli-toggle v-if="value" v-model="record.create_active" @update:modelValue="addPrivilege(record.create_active, record.create_action)">
|
219
|
+
</lesli-toggle>
|
220
|
+
</template>
|
221
|
+
|
222
|
+
<template #update_action="{ record, value }">
|
223
|
+
<lesli-toggle v-if="value" v-model="record.update_active" @update:modelValue="addPrivilege(record.update_active, record.update_action)">
|
224
|
+
</lesli-toggle>
|
225
|
+
</template>
|
226
|
+
|
227
|
+
<template #destroy_action="{ record, value }">
|
228
|
+
<lesli-toggle v-if="value" v-model="record.destroy_active" @update:modelValue="addPrivilege(record.destroy_active, record.destroy_action)">
|
229
|
+
</lesli-toggle>
|
230
|
+
</template>
|
231
|
+
</lesli-table>
|
232
|
+
</lesli-application-container>
|
233
|
+
</template>
|
@@ -0,0 +1,81 @@
|
|
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 { ref, reactive, onMounted, watch, computed } from "vue"
|
38
|
+
|
39
|
+
|
40
|
+
// · import lesli stores
|
41
|
+
import { useRole } from "LesliSecurity/vue/stores/role"
|
42
|
+
|
43
|
+
|
44
|
+
// · implement stores
|
45
|
+
const storeRole = useRole()
|
46
|
+
|
47
|
+
|
48
|
+
// ·
|
49
|
+
const translations = {
|
50
|
+
shared: I18n.t("core.shared"),
|
51
|
+
passwords: I18n.t("core.users/passwords"),
|
52
|
+
users: I18n.t("core.users")
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
// ·
|
57
|
+
function updateRole(descriptor) {
|
58
|
+
|
59
|
+
if (descriptor.active) {
|
60
|
+
return storeRole.postDescriptor(descriptor)
|
61
|
+
}
|
62
|
+
|
63
|
+
return storeRole.deleteDescriptor(descriptor)
|
64
|
+
}
|
65
|
+
|
66
|
+
</script>
|
67
|
+
<template>
|
68
|
+
<lesli-empty v-if="storeRole.descriptors.length == 0"></lesli-empty>
|
69
|
+
<div class="media px-6" v-for="descriptor in storeRole.descriptors">
|
70
|
+
<div class="media-content pt-4">
|
71
|
+
<h4>{{ descriptor.name }}</h4>
|
72
|
+
<p style="color:#aaa;">
|
73
|
+
{{ descriptor.description }}
|
74
|
+
</p>
|
75
|
+
</div>
|
76
|
+
<div class="media-right pt-4">
|
77
|
+
<lesli-toggle v-model="descriptor.active" @change="updateRole(descriptor)">
|
78
|
+
</lesli-toggle>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
</template>
|