lesli_vault 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +38 -0
  3. data/app/assets/config/lesli_vault_manifest.js +38 -0
  4. data/app/assets/images/lesli_vault/vault-logo.svg +160 -0
  5. data/app/assets/javascripts/lesli_vault/application.js +2848 -0
  6. data/app/assets/stylesheets/lesli_vault/application.scss +15 -0
  7. data/app/assets/stylesheets/lesli_vault/dashboards.scss +32 -0
  8. data/app/assets/stylesheets/lesli_vault/descriptors.scss +32 -0
  9. data/app/assets/stylesheets/lesli_vault/roles.scss +32 -0
  10. data/app/assets/stylesheets/lesli_vault/system_controller.scss +32 -0
  11. data/app/controllers/lesli_vault/application_controller.rb +37 -0
  12. data/app/controllers/lesli_vault/dashboards_controller.rb +6 -0
  13. data/app/controllers/lesli_vault/descriptor/activities_controller.rb +122 -0
  14. data/app/controllers/lesli_vault/descriptor/privileges_controller.rb +104 -0
  15. data/app/controllers/lesli_vault/descriptors_controller.rb +130 -0
  16. data/app/controllers/lesli_vault/role/activities_controller.rb +76 -0
  17. data/app/controllers/lesli_vault/role/descriptors_controller.rb +95 -0
  18. data/app/controllers/lesli_vault/role/privileges_controller.rb +48 -0
  19. data/app/controllers/lesli_vault/roles_controller.rb +226 -0
  20. data/app/controllers/lesli_vault/system_controller/actions_controller.rb +112 -0
  21. data/app/controllers/lesli_vault/system_controllers_controller.rb +64 -0
  22. data/app/helpers/lesli_vault/application_helper.rb +4 -0
  23. data/app/helpers/lesli_vault/dashboards_helper.rb +4 -0
  24. data/app/helpers/lesli_vault/descriptor/activities_helper.rb +4 -0
  25. data/app/helpers/lesli_vault/descriptor/privileges_helper.rb +4 -0
  26. data/app/helpers/lesli_vault/descriptors_helper.rb +4 -0
  27. data/app/helpers/lesli_vault/role/activities_helper.rb +4 -0
  28. data/app/helpers/lesli_vault/role/descriptors_helper.rb +4 -0
  29. data/app/helpers/lesli_vault/role/privileges_helper.rb +4 -0
  30. data/app/helpers/lesli_vault/roles_helper.rb +4 -0
  31. data/app/helpers/lesli_vault/system_controller/actions_helper.rb +4 -0
  32. data/app/helpers/lesli_vault/system_controllers_helper.rb +4 -0
  33. data/app/jobs/lesli_vault/application_job.rb +37 -0
  34. data/app/mailers/lesli_vault/application_mailer.rb +39 -0
  35. data/app/models/lesli_vault/application_record.rb +39 -0
  36. data/app/models/lesli_vault/descriptor/activity.rb +40 -0
  37. data/app/models/lesli_vault/descriptor/privilege.rb +40 -0
  38. data/app/models/lesli_vault/descriptor.rb +41 -0
  39. data/app/models/lesli_vault/role/activity.rb +40 -0
  40. data/app/models/lesli_vault/role/descriptor.rb +40 -0
  41. data/app/models/lesli_vault/role/privilege.rb +40 -0
  42. data/app/models/lesli_vault/role.rb +39 -0
  43. data/app/models/lesli_vault/system_controller/action.rb +39 -0
  44. data/app/models/lesli_vault/system_controller.rb +40 -0
  45. data/app/services/application_lesli_services.rb +168 -0
  46. data/app/services/descriptor_services.rb +197 -0
  47. data/app/services/role_services.rb +218 -0
  48. data/app/services/system_controller_services.rb +99 -0
  49. data/app/views/layouts/lesli_vault/application.html.erb +15 -0
  50. data/app/views/lesli_vault/dashboards/show.html.erb +1 -0
  51. data/app/views/lesli_vault/descriptor/activities/_form.html.erb +32 -0
  52. data/app/views/lesli_vault/descriptor/activities/edit.html.erb +34 -0
  53. data/app/views/lesli_vault/descriptor/activities/index.html.erb +34 -0
  54. data/app/views/lesli_vault/descriptor/activities/new.html.erb +34 -0
  55. data/app/views/lesli_vault/descriptor/activities/show.html.erb +34 -0
  56. data/app/views/lesli_vault/descriptor/privileges/_form.html.erb +32 -0
  57. data/app/views/lesli_vault/descriptor/privileges/edit.html.erb +34 -0
  58. data/app/views/lesli_vault/descriptor/privileges/index.html.erb +34 -0
  59. data/app/views/lesli_vault/descriptor/privileges/new.html.erb +34 -0
  60. data/app/views/lesli_vault/descriptor/privileges/show.html.erb +34 -0
  61. data/app/views/lesli_vault/descriptors/_form.html.erb +32 -0
  62. data/app/views/lesli_vault/descriptors/edit.html.erb +34 -0
  63. data/app/views/lesli_vault/descriptors/index.html.erb +34 -0
  64. data/app/views/lesli_vault/descriptors/new.html.erb +34 -0
  65. data/app/views/lesli_vault/descriptors/show.html.erb +34 -0
  66. data/app/views/lesli_vault/role/activities/_form.html.erb +32 -0
  67. data/app/views/lesli_vault/role/activities/edit.html.erb +34 -0
  68. data/app/views/lesli_vault/role/activities/index.html.erb +34 -0
  69. data/app/views/lesli_vault/role/activities/new.html.erb +34 -0
  70. data/app/views/lesli_vault/role/activities/show.html.erb +34 -0
  71. data/app/views/lesli_vault/role/descriptors/_form.html.erb +32 -0
  72. data/app/views/lesli_vault/role/descriptors/edit.html.erb +34 -0
  73. data/app/views/lesli_vault/role/descriptors/index.html.erb +34 -0
  74. data/app/views/lesli_vault/role/descriptors/new.html.erb +34 -0
  75. data/app/views/lesli_vault/role/descriptors/show.html.erb +34 -0
  76. data/app/views/lesli_vault/role/privileges/_form.html.erb +32 -0
  77. data/app/views/lesli_vault/role/privileges/edit.html.erb +34 -0
  78. data/app/views/lesli_vault/role/privileges/index.html.erb +34 -0
  79. data/app/views/lesli_vault/role/privileges/new.html.erb +34 -0
  80. data/app/views/lesli_vault/role/privileges/show.html.erb +34 -0
  81. data/app/views/lesli_vault/roles/edit.html.erb +34 -0
  82. data/app/views/lesli_vault/roles/index.html.erb +34 -0
  83. data/app/views/lesli_vault/roles/new.html.erb +34 -0
  84. data/app/views/lesli_vault/roles/show.html.erb +34 -0
  85. data/app/views/lesli_vault/system_controller/actions/_form.html.erb +32 -0
  86. data/app/views/lesli_vault/system_controller/actions/edit.html.erb +34 -0
  87. data/app/views/lesli_vault/system_controller/actions/index.html.erb +34 -0
  88. data/app/views/lesli_vault/system_controller/actions/new.html.erb +34 -0
  89. data/app/views/lesli_vault/system_controller/actions/show.html.erb +34 -0
  90. data/app/views/lesli_vault/system_controllers/_form.html.erb +32 -0
  91. data/app/views/lesli_vault/system_controllers/edit.html.erb +34 -0
  92. data/app/views/lesli_vault/system_controllers/index.html.erb +34 -0
  93. data/app/views/lesli_vault/system_controllers/new.html.erb +34 -0
  94. data/app/views/lesli_vault/system_controllers/show.html.erb +34 -0
  95. data/app/vue/lesli_vault/application.js +38 -0
  96. data/app/vue/lesli_vault/apps/descriptors/components/form.vue +147 -0
  97. data/app/vue/lesli_vault/apps/descriptors/edit.vue +83 -0
  98. data/app/vue/lesli_vault/apps/descriptors/index.vue +116 -0
  99. data/app/vue/lesli_vault/apps/descriptors/new.vue +76 -0
  100. data/app/vue/lesli_vault/apps/descriptors/privileges.vue +179 -0
  101. data/app/vue/lesli_vault/apps/descriptors/show.vue +240 -0
  102. data/app/vue/lesli_vault/apps/roles/componentForm.vue +231 -0
  103. data/app/vue/lesli_vault/apps/roles/componentPrivilegeCustom.vue +86 -0
  104. data/app/vue/lesli_vault/apps/roles/componentPrivilegeStandard.vue +173 -0
  105. data/app/vue/lesli_vault/apps/roles/edit.vue +93 -0
  106. data/app/vue/lesli_vault/apps/roles/index.vue +169 -0
  107. data/app/vue/lesli_vault/apps/roles/logs.vue +110 -0
  108. data/app/vue/lesli_vault/apps/roles/new.vue +89 -0
  109. data/app/vue/lesli_vault/apps/roles/show.vue +111 -0
  110. data/app/vue/lesli_vault/apps/security/index.vue +208 -0
  111. data/app/vue/lesli_vault/stores/descriptor.js +116 -0
  112. data/app/vue/lesli_vault/stores/descriptors.js +167 -0
  113. data/app/vue/lesli_vault/stores/role.js +243 -0
  114. data/app/vue/lesli_vault/stores/roles.js +89 -0
  115. data/app/vue/lesli_vault/stores/systemController.js +67 -0
  116. data/config/routes.rb +52 -0
  117. data/lib/lesli_vault/engine.rb +18 -0
  118. data/lib/lesli_vault/version.rb +3 -0
  119. data/lib/lesli_vault.rb +6 -0
  120. data/lib/tasks/lesli_vault_tasks.rake +4 -0
  121. data/lib/tasks/system/controllers.rake +112 -0
  122. data/lib/vue/application.js +7 -0
  123. data/readme.md +19 -0
  124. metadata +181 -0
@@ -0,0 +1,86 @@
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 · Your Smart Business Assistant.
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://lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+
33
+ */
34
+
35
+
36
+
37
+ // · import vue tools
38
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
+
40
+
41
+ // · import lesli stores
42
+ import { useRole } from "../../stores/role"
43
+ import { useDescriptor } from "../../stores/descriptor"
44
+
45
+
46
+ // · initialize/inject plugins
47
+ const msg = inject("msg")
48
+ const url = inject("url")
49
+
50
+
51
+ // ·
52
+ const storeRole = useRole()
53
+ const storeDescriptor = useDescriptor()
54
+
55
+
56
+ // ·
57
+ const columnDescriptors = [{
58
+ field: 'name',
59
+ label: 'Name'
60
+ },{
61
+ field: 'action',
62
+ label: 'Status',
63
+ align: 'center'
64
+ }]
65
+
66
+
67
+ // ·
68
+ function updateDescriptor(descriptor) {
69
+ storeRole.updateDescriptor(descriptor)
70
+ }
71
+
72
+ </script>
73
+ <template>
74
+ <lesli-table
75
+ :columns="columnDescriptors"
76
+ :records="storeRole.descriptorsCustom">
77
+ <template #name="{ record }">
78
+ <p>{{ record.name }}</p>
79
+ <p><small>/{{ record.controller }}</small></p>
80
+ </template>
81
+ <template #action="{ record, value }">
82
+ <lesli-toggle v-if="value != null" v-model="record.active" @change="updateDescriptor(record)">
83
+ </lesli-toggle>
84
+ </template>
85
+ </lesli-table>
86
+ </template>
@@ -0,0 +1,173 @@
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 · Your Smart Business Assistant.
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://lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+
33
+ */
34
+
35
+
36
+
37
+ // · import vue tools
38
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
+
40
+
41
+ // · import lesli stores
42
+ import { useRole } from "../../stores/role"
43
+ import { useDescriptor } from "../../stores/descriptor"
44
+
45
+
46
+ // · initialize/inject plugins
47
+ const msg = inject("msg")
48
+ const url = inject("url")
49
+
50
+
51
+ // ·
52
+ const storeRole = useRole()
53
+ const storeDescriptor = useDescriptor()
54
+
55
+
56
+ // · list, index, show, create, edit, delete
57
+ const columnDescriptors = [{
58
+ field: 'name',
59
+ label: 'Name'
60
+ },{
61
+ field: 'index',
62
+ label: 'Index',
63
+ align: 'center'
64
+ },{
65
+ field: 'show',
66
+ label: 'Show',
67
+ align: 'center'
68
+ },{
69
+ field: 'create',
70
+ label: 'Create',
71
+ align: 'center'
72
+ },{
73
+ field: 'update',
74
+ label: 'Update',
75
+ align: 'center'
76
+ },{
77
+ field: 'destroy',
78
+ label: 'Delete',
79
+ align: 'center'
80
+ }]
81
+
82
+
83
+ // ·
84
+ function updateDescriptor(descriptor) {
85
+ storeRole.updateDescriptor(descriptor)
86
+ }
87
+
88
+ </script>
89
+ <template>
90
+ <lesli-table
91
+ :columns="columnDescriptors"
92
+ :records="storeRole.descriptors">
93
+ <template #head(index)="{ column }">
94
+ <span class="icon-text">
95
+ <span class="icon">
96
+ <span class="material-icons">
97
+ format_list_numbered
98
+ </span>
99
+ </span>
100
+ <span>{{ column.label }}</span>
101
+ </span>
102
+ </template>
103
+ <template #head(show)="{ column }">
104
+ <span class="icon-text">
105
+ <span class="icon">
106
+ <span class="material-icons">
107
+ visibility
108
+ </span>
109
+ </span>
110
+ <span>{{ column.label }}</span>
111
+ </span>
112
+ </template>
113
+ <template #head(create)="{ column }">
114
+ <span class="icon-text">
115
+ <span class="icon">
116
+ <span class="material-icons">
117
+ add
118
+ </span>
119
+ </span>
120
+ <span>{{ column.label }}</span>
121
+ </span>
122
+ </template>
123
+ <template #head(update)="{ column }">
124
+ <span class="icon-text">
125
+ <span class="icon">
126
+ <span class="material-icons">
127
+ edit
128
+ </span>
129
+ </span>
130
+ <span>{{ column.label }}</span>
131
+ </span>
132
+ </template>
133
+ <template #head(destroy)="{ column }">
134
+ <span class="icon-text">
135
+ <span class="icon">
136
+ <span class="material-icons">
137
+ delete
138
+ </span>
139
+ </span>
140
+ <span>{{ column.label }}</span>
141
+ </span>
142
+ </template>
143
+
144
+ <template #name="{ record }">
145
+ <p>{{ record.name }}</p>
146
+ <p><small>/{{ record.controller }}</small></p>
147
+ </template>
148
+ <template #list="{ record, value }">
149
+ <lesli-toggle v-if="value != null" v-model="record.list.active" @change="updateDescriptor(record.list)">
150
+ </lesli-toggle>
151
+ </template>
152
+ <template #index="{ record, value }">
153
+ <lesli-toggle v-if="value != null" v-model="record.index.active" @change="updateDescriptor(record.index)">
154
+ </lesli-toggle>
155
+ </template>
156
+ <template #show="{ record, value }">
157
+ <lesli-toggle v-if="value != null" v-model="record.show.active" @change="updateDescriptor(record.show)">
158
+ </lesli-toggle>
159
+ </template>
160
+ <template #create="{ record, value }">
161
+ <lesli-toggle v-if="value != null" v-model="record.create.active" @change="updateDescriptor(record.create)">
162
+ </lesli-toggle>
163
+ </template>
164
+ <template #update="{ record, value }">
165
+ <lesli-toggle v-if="value != null" v-model="record.update.active" @change="updateDescriptor(record.update)">
166
+ </lesli-toggle>
167
+ </template>
168
+ <template #destroy="{ record, value }">
169
+ <lesli-toggle v-if="value != null" v-model="record.destroy.active" @change="updateDescriptor(record.destroy)">
170
+ </lesli-toggle>
171
+ </template>
172
+ </lesli-table>
173
+ </template>
@@ -0,0 +1,93 @@
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 · Your Smart Business Assistant.
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://lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+
33
+ */
34
+
35
+
36
+
37
+ // · import vue tools
38
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
+ import { useRouter, useRoute } from "vue-router"
40
+ import componentFormRole from "./componentForm.vue"
41
+
42
+
43
+ // · import lesli stores
44
+ import { useRole } from "../../stores/role"
45
+
46
+
47
+ // · initialize/inject plugins
48
+ const router = useRouter()
49
+ const route = useRoute()
50
+ const msg = inject("msg")
51
+ const url = inject("url")
52
+
53
+
54
+ // ·
55
+ const storeRole = useRole()
56
+
57
+
58
+ // ·
59
+ const translations = {
60
+ core: {
61
+ shared: I18n.t('core.shared'),
62
+ roles: I18n.t('core.roles')
63
+ }
64
+ }
65
+
66
+ // · defining props
67
+ const props = defineProps({
68
+ appMountPath: {
69
+ type: String,
70
+ required: false,
71
+ default: "administration/roles",
72
+ }
73
+ })
74
+
75
+ // ·
76
+ onMounted(() => {
77
+ storeRole.fetchRole(route.params.id)
78
+ })
79
+
80
+ </script>
81
+ <template>
82
+ <section class="application-component">
83
+ <lesli-header :title="'Edit: ' + storeRole.role.name + ' role '">
84
+ <lesli-button icon="list" :to="url.root(props.appMountPath)">
85
+ {{ translations.core.roles.view_btn_roles_list }}
86
+ </lesli-button>
87
+ <lesli-button icon="settings" :to="url.root(props.appMountPath+`/${storeRole.role.id}`)">
88
+ {{ translations.core.roles.view_btn_edit_privilege_actions }}
89
+ </lesli-button>
90
+ </lesli-header>
91
+ <componentFormRole></componentFormRole>
92
+ </section>
93
+ </template>
@@ -0,0 +1,169 @@
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 · Your Smart Business Assistant.
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://lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+
33
+ */
34
+
35
+
36
+
37
+ // · import vue tools
38
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
+ import { useRouter, useRoute } from 'vue-router'
40
+
41
+
42
+ // · import lesli stores
43
+ import { useRole } from "../../stores/role"
44
+
45
+
46
+ // · initialize/inject plugins
47
+ const router = useRouter()
48
+ const route = useRoute()
49
+ const msg = inject("msg")
50
+ const url = inject("url")
51
+
52
+
53
+ // ·
54
+ const storeRole = useRole()
55
+
56
+
57
+ // ·
58
+ const translations = {
59
+ core: {
60
+ roles: I18n.t("core.roles"),
61
+ users: I18n.t("core.users"),
62
+ shared: I18n.t("core.shared")
63
+ }
64
+ }
65
+
66
+
67
+ // ·
68
+ const columns = [{
69
+ field: "name",
70
+ label: translations.core.shared.view_text_name,
71
+ sort: true
72
+ }, {
73
+ field: "users",
74
+ label: translations.core.roles.view_text_users || 'Users',
75
+ sort: true
76
+ }, {
77
+ field: "isolated",
78
+ label: translations.core.roles.view_text_isolated || 'Isolated',
79
+ sort: true
80
+ }, {
81
+ field: "active",
82
+ label: translations.core.users.view_table_header_status,
83
+ sort: true
84
+ }]
85
+
86
+
87
+ // · defining props
88
+ const props = defineProps({
89
+ appMountPath: {
90
+ type: String,
91
+ required: false,
92
+ default: "administration/roles",
93
+ }
94
+ })
95
+
96
+
97
+ // ·
98
+ onMounted(() => {
99
+ storeRole.fetch()
100
+ })
101
+
102
+
103
+ </script>
104
+ <template>
105
+ <section class="application-component">
106
+ <lesli-header title="Roles & privileges">
107
+ <lesli-button
108
+ outlined
109
+ icon="refresh"
110
+ :loading="storeRole.loading"
111
+ @click="storeRole.fetch()"
112
+ >
113
+ {{ translations.core.shared.view_text_btn_reload }}
114
+ </lesli-button>
115
+ <lesli-button icon="add" :to="url.root(props.appMountPath+`/new`)">
116
+ {{ translations.core.roles.view_btn_new_role }}
117
+ </lesli-button>
118
+ </lesli-header>
119
+ <lesli-toolbar @search="storeRole.search"></lesli-toolbar>
120
+ <lesli-table
121
+ :link="(role) => url.root(props.appMountPath+`/${role.id}`).s"
122
+ :columns="columns"
123
+ :records="storeRole.records"
124
+ :pagination="storeRole.index.pagination"
125
+ @paginate="storeRole.paginateIndex"
126
+ @sort="storeRole.sortIndex"
127
+ >
128
+ <template #active="{ value }">
129
+ <span class="tag is-success is-light" v-if="value">active</span>
130
+ </template>
131
+
132
+ <template #options="{ record, value }">
133
+ <a class="dropdown-item" :href="url.root(props.appMountPath+`/${record.id}`)">
134
+ <span class="material-icons">
135
+ settings
136
+ </span>
137
+ <span>
138
+ {{ translations.core.roles.view_btn_edit_privilege_actions }}
139
+ </span>
140
+ </a>
141
+ <a class="dropdown-item" :href="url.root(props.appMountPath+`/${record.id}/edit`)">
142
+ <span class="material-icons">
143
+ edit
144
+ </span>
145
+ <span>
146
+ {{ translations.core.roles.view_btn_edit_role_information }}
147
+ </span>
148
+ </a>
149
+ <a class="dropdown-item" :href="url.admin(`users`).filter({ role: [record.id] })">
150
+ <span class="material-icons">
151
+ groups
152
+ </span>
153
+ <span>
154
+ {{ translations.core.roles.view_btn_users_list }}
155
+ </span>
156
+ </a>
157
+ <a class="dropdown-item" @click="storeRole.deleteRole(record.id)">
158
+ <span class="material-icons">
159
+ delete
160
+ </span>
161
+ <span>
162
+ {{ translations.core.users.view_btn_revoke_access }}
163
+ </span>
164
+ </a>
165
+ </template>
166
+
167
+ </lesli-table>
168
+ </section>
169
+ </template>
@@ -0,0 +1,110 @@
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 · Your Smart Business Assistant.
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://lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+
33
+ */
34
+
35
+
36
+
37
+ // · import vue tools
38
+ import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
+ import { useRouter, useRoute } from 'vue-router'
40
+
41
+
42
+ // · import lesli stores
43
+ import { useRole } from "../../stores/role"
44
+
45
+
46
+ // · initialize/inject plugins
47
+ const router = useRouter()
48
+ const route = useRoute()
49
+ const msg = inject("msg")
50
+ const url = inject("url")
51
+
52
+
53
+ // ·
54
+ const storeRole = useRole()
55
+
56
+ const translations = {
57
+ core: {
58
+ roles: I18n.t("core.roles"),
59
+ users: I18n.t("core.users"),
60
+ shared: I18n.t("core.shared"),
61
+ role_activities: I18n.t('core.role/activities')
62
+ }
63
+ }
64
+
65
+ // ·
66
+ const columns = [{
67
+ field: "created_at_raw",
68
+ label: translations.core.role_activities.column_created_at,
69
+ sort: true
70
+ }, {
71
+ field: "user_creator_name",
72
+ label: translations.core.role_activities.column_users_id,
73
+ sort: true
74
+ }, {
75
+ field: "category",
76
+ label: translations.core.role_activities.column_category,
77
+ sort: true
78
+ }, {
79
+ field: "description",
80
+ label: translations.core.role_activities.column_description,
81
+ sort: true
82
+ }, {
83
+ field: "field_name",
84
+ label: translations.core.role_activities.column_field,
85
+ sort: true
86
+ }, {
87
+ field: "value_from",
88
+ label: translations.core.role_activities.column_value_from,
89
+ sort: true
90
+ }, {
91
+ field: "value_to",
92
+ label: translations.core.role_activities.column_value_to,
93
+ sort: true
94
+ }]
95
+
96
+
97
+ // ·
98
+ onMounted(() => {
99
+ storeRole.fetchLogs()
100
+ })
101
+
102
+
103
+ </script>
104
+ <template>
105
+ <lesli-table
106
+ :columns="columns"
107
+ :records="storeRole.role_activities"
108
+ >
109
+ </lesli-table>
110
+ </template>