lesli_guard 0.2.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.
- 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,196 @@
|
|
|
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 } from "vue-router"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// · import lesli stores
|
|
43
|
+
import { useRole } from "LesliGuard/stores/role"
|
|
44
|
+
import { useDescriptor } from "LesliGuard/stores/descriptor"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// · initialize/inject plugins
|
|
48
|
+
const msg = inject("msg")
|
|
49
|
+
const url = inject("url")
|
|
50
|
+
const router = useRouter()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// ·
|
|
54
|
+
const storeRole = useRole()
|
|
55
|
+
const storeDescriptor = useDescriptor()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// · list, index, show, create, edit, delete
|
|
59
|
+
const columnDescriptors = [{
|
|
60
|
+
field: 'name',
|
|
61
|
+
label: 'Name'
|
|
62
|
+
},{
|
|
63
|
+
field: 'plist',
|
|
64
|
+
label: 'List',
|
|
65
|
+
align: 'center'
|
|
66
|
+
},{
|
|
67
|
+
field: 'pindex',
|
|
68
|
+
label: 'Index',
|
|
69
|
+
align: 'center'
|
|
70
|
+
},{
|
|
71
|
+
field: 'pshow',
|
|
72
|
+
label: 'Show',
|
|
73
|
+
align: 'center'
|
|
74
|
+
},{
|
|
75
|
+
field: 'pcreate',
|
|
76
|
+
label: 'Create',
|
|
77
|
+
align: 'center'
|
|
78
|
+
},{
|
|
79
|
+
field: 'pupdate',
|
|
80
|
+
label: 'Update',
|
|
81
|
+
align: 'center'
|
|
82
|
+
},{
|
|
83
|
+
field: 'pdestroy',
|
|
84
|
+
label: 'Delete',
|
|
85
|
+
align: 'center'
|
|
86
|
+
}]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
// ·
|
|
90
|
+
function updatePrivilege(descriptor) {
|
|
91
|
+
storeRole.updatePrivilege(descriptor)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
// ·
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
storeRole.getPrivileges()
|
|
98
|
+
})
|
|
99
|
+
</script>
|
|
100
|
+
<template>
|
|
101
|
+
<lesli-table
|
|
102
|
+
:columns="columnDescriptors"
|
|
103
|
+
:records="storeRole.privileges">
|
|
104
|
+
<template #head(plist)="{ column }">
|
|
105
|
+
<span class="icon-text">
|
|
106
|
+
<span class="icon">
|
|
107
|
+
<span class="material-icons">
|
|
108
|
+
format_list_numbered
|
|
109
|
+
</span>
|
|
110
|
+
</span>
|
|
111
|
+
<span>{{ column.label }}</span>
|
|
112
|
+
</span>
|
|
113
|
+
</template>
|
|
114
|
+
<template #head(pindex)="{ column }">
|
|
115
|
+
<span class="icon-text">
|
|
116
|
+
<span class="icon">
|
|
117
|
+
<span class="material-icons">
|
|
118
|
+
format_list_bulleted
|
|
119
|
+
</span>
|
|
120
|
+
</span>
|
|
121
|
+
<span>{{ column.label }}</span>
|
|
122
|
+
</span>
|
|
123
|
+
</template>
|
|
124
|
+
<template #head(pshow)="{ column }">
|
|
125
|
+
<span class="icon-text">
|
|
126
|
+
<span class="icon">
|
|
127
|
+
<span class="material-icons">
|
|
128
|
+
visibility
|
|
129
|
+
</span>
|
|
130
|
+
</span>
|
|
131
|
+
<span>{{ column.label }}</span>
|
|
132
|
+
</span>
|
|
133
|
+
</template>
|
|
134
|
+
<template #head(pcreate)="{ column }">
|
|
135
|
+
<span class="icon-text">
|
|
136
|
+
<span class="icon">
|
|
137
|
+
<span class="material-icons">
|
|
138
|
+
add
|
|
139
|
+
</span>
|
|
140
|
+
</span>
|
|
141
|
+
<span>{{ column.label }}</span>
|
|
142
|
+
</span>
|
|
143
|
+
</template>
|
|
144
|
+
<template #head(pupdate)="{ column }">
|
|
145
|
+
<span class="icon-text">
|
|
146
|
+
<span class="icon">
|
|
147
|
+
<span class="material-icons">
|
|
148
|
+
edit
|
|
149
|
+
</span>
|
|
150
|
+
</span>
|
|
151
|
+
<span>{{ column.label }}</span>
|
|
152
|
+
</span>
|
|
153
|
+
</template>
|
|
154
|
+
<template #head(pdestroy)="{ column }">
|
|
155
|
+
<span class="icon-text">
|
|
156
|
+
<span class="icon">
|
|
157
|
+
<span class="material-icons">
|
|
158
|
+
delete
|
|
159
|
+
</span>
|
|
160
|
+
</span>
|
|
161
|
+
<span>{{ column.label }}</span>
|
|
162
|
+
</span>
|
|
163
|
+
</template>
|
|
164
|
+
|
|
165
|
+
<template #name="{ record }">
|
|
166
|
+
<router-link :to="url.guard('descriptors/:id', record.id).toString()">
|
|
167
|
+
{{ record.name }}
|
|
168
|
+
</router-link>
|
|
169
|
+
</template>
|
|
170
|
+
|
|
171
|
+
<template #plist="{ record }">
|
|
172
|
+
<lesli-toggle v-if="record.has_list" v-model="record.plist" @change="updatePrivilege(record)">
|
|
173
|
+
</lesli-toggle>
|
|
174
|
+
</template>
|
|
175
|
+
<template #pindex="{ record }">
|
|
176
|
+
<lesli-toggle v-if="record.has_index" v-model="record.pindex" @change="updatePrivilege(record)">
|
|
177
|
+
</lesli-toggle>
|
|
178
|
+
</template>
|
|
179
|
+
<template #pshow="{ record }">
|
|
180
|
+
<lesli-toggle v-if="record.has_show" v-model="record.pshow" @change="updatePrivilege(record)">
|
|
181
|
+
</lesli-toggle>
|
|
182
|
+
</template>
|
|
183
|
+
<template #pcreate="{ record }">
|
|
184
|
+
<lesli-toggle v-if="record.has_create" v-model="record.pcreate" @change="updatePrivilege(record)">
|
|
185
|
+
</lesli-toggle>
|
|
186
|
+
</template>
|
|
187
|
+
<template #pupdate="{ record }">
|
|
188
|
+
<lesli-toggle v-if="record.has_update" v-model="record.pupdate" @change="updatePrivilege(record)">
|
|
189
|
+
</lesli-toggle>
|
|
190
|
+
</template>
|
|
191
|
+
<template #pdestroy="{ record }">
|
|
192
|
+
<lesli-toggle v-if="record.has_destroy" v-model="record.pdestroy" @change="updatePrivilege(record)">
|
|
193
|
+
</lesli-toggle>
|
|
194
|
+
</template>
|
|
195
|
+
</lesli-table>
|
|
196
|
+
</template>
|
|
@@ -0,0 +1,118 @@
|
|
|
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, inject } from "vue"
|
|
38
|
+
import { useRouter, useRoute } from "vue-router"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// · import components
|
|
42
|
+
import componentFormRole from "./components/form.vue"
|
|
43
|
+
import componentDescriptors from "./components/descriptors.vue"
|
|
44
|
+
import componentPrivilegeCustom from "./components/privilegeCustom.vue"
|
|
45
|
+
import componentPrivilegeStandard from "./components/privilegeStandard.vue"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// · import lesli stores
|
|
49
|
+
import { useRole } from "LesliGuard/stores/role"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// · initialize/inject plugins
|
|
53
|
+
const router = useRouter()
|
|
54
|
+
const route = useRoute()
|
|
55
|
+
const msg = inject("msg")
|
|
56
|
+
const url = inject("url")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// ·
|
|
60
|
+
const storeRole = useRole()
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
// ·
|
|
64
|
+
const translations = {
|
|
65
|
+
lesli: {
|
|
66
|
+
shared: i18n.t("lesli.shared"),
|
|
67
|
+
},
|
|
68
|
+
core: {
|
|
69
|
+
shared: I18n.t('core.shared'),
|
|
70
|
+
roles: I18n.t('core.roles')
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// · defining props
|
|
75
|
+
const props = defineProps({
|
|
76
|
+
appMountPath: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: false,
|
|
79
|
+
default: "guard/roles",
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// ·
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
storeRole.getRole(route.params.id)
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
</script>
|
|
89
|
+
<template>
|
|
90
|
+
<lesli-application-container>
|
|
91
|
+
<lesli-header :title="'Edit role: ' + storeRole.role.name">
|
|
92
|
+
<lesli-link icon="list" :to="url.guard('roles')">
|
|
93
|
+
{{ translations.lesli.shared.button_list }}
|
|
94
|
+
</lesli-link>
|
|
95
|
+
<lesli-link main icon="visibility" :to="url.guard('roles/:id', storeRole.role.id)">
|
|
96
|
+
{{ translations.lesli.shared.button_show }}
|
|
97
|
+
</lesli-link>
|
|
98
|
+
</lesli-header>
|
|
99
|
+
<lesli-tabs>
|
|
100
|
+
<lesli-tab-item paddingless icon="info" title="Information">
|
|
101
|
+
<componentFormRole :editable="true"></componentFormRole>
|
|
102
|
+
</lesli-tab-item>
|
|
103
|
+
<lesli-tab-item icon="add_moderator" title="Descriptors">
|
|
104
|
+
<componentDescriptors></componentDescriptors>
|
|
105
|
+
</lesli-tab-item>
|
|
106
|
+
<lesli-tab-item icon="verified_user" title="Privileges">
|
|
107
|
+
<componentPrivilegeStandard></componentPrivilegeStandard>
|
|
108
|
+
</lesli-tab-item>
|
|
109
|
+
</lesli-tabs>
|
|
110
|
+
|
|
111
|
+
<!--
|
|
112
|
+
<lesli-tab-item icon="local_police" title="Custom privileges">
|
|
113
|
+
<componentPrivilegeCustom></componentPrivilegeCustom>
|
|
114
|
+
</lesli-tab-item>
|
|
115
|
+
-->
|
|
116
|
+
|
|
117
|
+
</lesli-application-container>
|
|
118
|
+
</template>
|
|
@@ -0,0 +1,168 @@
|
|
|
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, inject } from "vue"
|
|
38
|
+
import { useRouter, useRoute } from "vue-router"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// · import lesli stores
|
|
42
|
+
import { useRoles } from "LesliGuard/stores/roles"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// · initialize/inject plugins
|
|
46
|
+
const router = useRouter()
|
|
47
|
+
const route = useRoute()
|
|
48
|
+
const msg = inject("msg")
|
|
49
|
+
const url = inject("url")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// ·
|
|
53
|
+
const storeRoles = useRoles()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// ·
|
|
57
|
+
const translations = {
|
|
58
|
+
core: {
|
|
59
|
+
roles: I18n.t("core.roles"),
|
|
60
|
+
users: I18n.t("core.users"),
|
|
61
|
+
shared: I18n.t("core.shared")
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// ·
|
|
67
|
+
const columns = [{
|
|
68
|
+
field: "name",
|
|
69
|
+
label: translations.core.shared.view_text_name,
|
|
70
|
+
sort: true
|
|
71
|
+
}, {
|
|
72
|
+
field: "users",
|
|
73
|
+
label: translations.core.roles.view_text_users || 'Users',
|
|
74
|
+
align: "center",
|
|
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: "guard/roles",
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// ·
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
storeRoles.get()
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
</script>
|
|
104
|
+
<template>
|
|
105
|
+
<lesli-application-container>
|
|
106
|
+
<lesli-header title="Roles & privileges">
|
|
107
|
+
<lesli-link solid icon="add" :to="url.guard('roles/new')">
|
|
108
|
+
Add role
|
|
109
|
+
</lesli-link>
|
|
110
|
+
<lesli-button icon="refresh"
|
|
111
|
+
:loading="storeRoles.loading"
|
|
112
|
+
@click="storeRoles.fetch()">
|
|
113
|
+
Reload
|
|
114
|
+
</lesli-button>
|
|
115
|
+
</lesli-header>
|
|
116
|
+
|
|
117
|
+
<lesli-toolbar @search="storeRoles.search"></lesli-toolbar>
|
|
118
|
+
|
|
119
|
+
<lesli-table
|
|
120
|
+
:link="(role) => url.root(props.appMountPath+`/${role.id}`).s"
|
|
121
|
+
:columns="columns"
|
|
122
|
+
:records="storeRoles.records"
|
|
123
|
+
:loading="storeRoles.loading"
|
|
124
|
+
:pagination="storeRoles.pagination"
|
|
125
|
+
@paginate="storeRoles.paginateIndex"
|
|
126
|
+
@sort="storeRoles.sortIndex">
|
|
127
|
+
<template #active="{ value }">
|
|
128
|
+
<span class="tag is-success is-light" v-if="value">active</span>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<template #options="{ record, value }">
|
|
132
|
+
<a class="dropdown-item" :href="url.root(props.appMountPath+`/${record.id}`)">
|
|
133
|
+
<span class="material-icons">
|
|
134
|
+
settings
|
|
135
|
+
</span>
|
|
136
|
+
<span>
|
|
137
|
+
{{ translations.core.roles.view_btn_edit_privilege_actions }}
|
|
138
|
+
</span>
|
|
139
|
+
</a>
|
|
140
|
+
<a class="dropdown-item" :href="url.root(props.appMountPath+`/${record.id}/edit`)">
|
|
141
|
+
<span class="material-icons">
|
|
142
|
+
edit
|
|
143
|
+
</span>
|
|
144
|
+
<span>
|
|
145
|
+
{{ translations.core.roles.view_btn_edit_role_information }}
|
|
146
|
+
</span>
|
|
147
|
+
</a>
|
|
148
|
+
<a class="dropdown-item" :href="url.admin(`users`).filter({ role: [record.id] })">
|
|
149
|
+
<span class="material-icons">
|
|
150
|
+
groups
|
|
151
|
+
</span>
|
|
152
|
+
<span>
|
|
153
|
+
{{ translations.core.roles.view_btn_users_list }}
|
|
154
|
+
</span>
|
|
155
|
+
</a>
|
|
156
|
+
<a class="dropdown-item" @click="storeRole.deleteRole(record.id)">
|
|
157
|
+
<span class="material-icons">
|
|
158
|
+
delete
|
|
159
|
+
</span>
|
|
160
|
+
<span>
|
|
161
|
+
{{ translations.core.users.view_btn_revoke_access }}
|
|
162
|
+
</span>
|
|
163
|
+
</a>
|
|
164
|
+
</template>
|
|
165
|
+
|
|
166
|
+
</lesli-table>
|
|
167
|
+
</lesli-application-container>
|
|
168
|
+
</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>
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { ref, reactive, onMounted, watch, computed, inject } from "vue"
|
|
36
|
+
import { useRouter, useRoute } from "vue-router"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// ·
|
|
40
|
+
import componentFormRole from "./components/form.vue"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// · import lesli stores
|
|
44
|
+
import { useRole } from "LesliGuard/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
|
+
|
|
67
|
+
// · defining props
|
|
68
|
+
const props = defineProps({
|
|
69
|
+
appMountPath: {
|
|
70
|
+
type: String,
|
|
71
|
+
required: false,
|
|
72
|
+
default: "administration/roles",
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
</script>
|
|
77
|
+
<template>
|
|
78
|
+
<lesli-application-container>
|
|
79
|
+
<lesli-header title="Create a new role">
|
|
80
|
+
<lesli-button icon="list" :to="url.root(props.appMountPath)">
|
|
81
|
+
All roles
|
|
82
|
+
</lesli-button>
|
|
83
|
+
</lesli-header>
|
|
84
|
+
<componentFormRole :editable="true"></componentFormRole>
|
|
85
|
+
</lesli-application-container>
|
|
86
|
+
</template>
|