lesli 5.0.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/lesli_manifest.js +7 -4
- data/app/assets/fonts/lesli/Domine/Domine-VariableFont_wght.ttf +0 -0
- data/app/assets/fonts/lesli/Domine/OFL.txt +2 -0
- data/app/assets/javascripts/lesli/users/passwords.js +776 -0
- data/app/assets/javascripts/lesli/users/registrations.js +776 -0
- data/app/assets/javascripts/lesli/users/sessions.js +776 -1
- data/app/assets/stylesheets/lesli/users/passwords.scss +5 -6
- data/app/assets/stylesheets/lesli/users/registrations.scss +5 -6
- data/app/assets/stylesheets/lesli/users/sessions.scss +5 -10
- data/app/controllers/lesli/application_lesli_controller.rb +0 -1
- data/app/controllers/lesli/interfaces/application/logger.rb +9 -9
- data/app/controllers/lesli/roles_controller.rb +43 -0
- data/{lib/sass/lesli/devise/registrations.scss.erb → app/controllers/lesli/users_controller.rb} +18 -23
- data/app/controllers/users/registrations_controller.rb +137 -58
- data/app/helpers/lesli/assets_helper.rb +2 -2
- data/app/helpers/lesli/general_helper.rb +1 -1
- data/app/helpers/lesli/navigation_helper.rb +7 -10
- data/app/helpers/lesli/system_helper.rb +1 -1
- data/app/lib/lesli/system.rb +7 -3
- data/app/mailers/lesli/application_lesli_mailer.rb +199 -0
- data/app/mailers/lesli/application_mailer.rb +7 -0
- data/app/mailers/lesli/devise_mailer.rb +33 -0
- data/app/models/concerns/user_guard.rb +3 -4
- data/app/models/lesli/account.rb +29 -0
- data/{lib/sass/lesli/pages/passes.scss → app/models/lesli/descriptor.rb} +14 -8
- data/app/models/lesli/role.rb +90 -0
- data/app/models/lesli/system_controller.rb +1 -0
- data/app/models/lesli/user/detail.rb +55 -0
- data/{lib/sass/lesli/pages/otps.scss → app/models/lesli/user/role.rb} +13 -9
- data/app/models/lesli/user.rb +4 -3
- data/app/services/lesli/role_service.rb +45 -0
- data/app/services/lesli/user_service.rb +69 -0
- data/app/views/devise/passwords/new.html.erb +72 -12
- data/app/views/devise/registrations/new.html.erb +146 -28
- data/app/views/devise/sessions/new.html.erb +11 -78
- data/app/views/devise/shared/_links.html.erb +96 -25
- data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +23 -0
- data/app/views/lesli/emails/user_mailer/invitation.html.erb +23 -0
- data/app/views/lesli/layouts/application-devise.html.erb +1 -1
- data/app/views/lesli/layouts/application-public.html.erb +2 -2
- data/app/views/lesli/layouts/mailer.html.erb +13 -0
- data/app/views/lesli/layouts/mailer.text.erb +1 -0
- data/app/views/lesli/partials/_application-lesli-header.html.erb +27 -41
- data/app/views/lesli/partials/_application-lesli-javascript.html.erb +10 -6
- data/app/views/lesli/partials/_application-public-javascript.html.erb +12 -8
- data/{lib/sass/lesli/devise/confirmations.scss.erb → app/views/lesli/wrappers/_application-devise-simple.erb} +30 -46
- data/app/views/lesli/wrappers/{_application-auth.html.erb → _application-devise.html.erb} +15 -0
- data/config/initializers/{lesli_defaults.rb → lesli.rb} +4 -2
- data/config/locales/translations.en.yml +7 -0
- data/config/locales/translations.es.yml +7 -0
- data/config/routes.rb +22 -17
- data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +1 -1
- data/db/{tables/0010003010_create_user_details.rb → migrate/v1.0/0010003010_create_lesli_user_details.rb} +6 -6
- data/db/{tables/0010003510_create_user_roles.rb → migrate/v1.0/0010003410_create_lesli_user_roles.rb} +4 -4
- data/db/{tables/0010005010_create_descriptors.rb → migrate/v1.0/0010005010_create_lesli_descriptors.rb} +5 -6
- data/db/{tables/0010005110_create_descriptor_privileges.rb → migrate/v1.0/0010005110_create_lesli_descriptor_privileges.rb} +8 -7
- data/db/{tables/0010005210_create_descriptor_activities.rb → migrate/v1.0/0010005210_create_lesli_descriptor_activities.rb} +6 -8
- data/db/seeds.rb +0 -2
- data/lib/lesli/engine.rb +25 -2
- data/lib/lesli/routing.rb +26 -0
- data/lib/lesli/version.rb +2 -2
- data/lib/lesli.rb +1 -0
- data/lib/{sass/lesli/pages/mfas.scss → mailer_previews/devise_mailer_preview.rb} +12 -6
- data/lib/sass/lesli/bulma/loader.scss +3 -0
- data/lib/sass/lesli/elements/header.scss +1 -1
- data/lib/sass/lesli/fonts/families.scss +3 -3
- data/lib/sass/lesli/layouts/application-container.scss +4 -0
- data/lib/sass/lesli/{devise/passwords.scss.erb → pages/devise-simple.scss} +38 -38
- data/lib/sass/lesli/{templates → pages}/devise.scss +4 -26
- data/lib/sass/lesli/settings/variables.scss +1 -1
- data/lib/sass/lesli/templates/application.scss +8 -4
- data/lib/sass/lesli/templates/dashboards.scss +8 -0
- data/lib/sass/lesli/templates/public.scss +2 -3
- data/lib/tasks/lesli/controllers.rake +33 -0
- data/lib/tasks/lesli/db.rake +88 -0
- data/lib/tasks/lesli/git.rake +74 -0
- data/lib/tasks/lesli_tasks.rake +70 -20
- data/lib/vue/devise/registrations.js +10 -15
- data/lib/vue/layouts/application-container.vue +10 -2
- data/lib/vue/layouts/application-header.vue +10 -3
- data/lib/vue/stores/account.js +113 -0
- data/lib/vue/stores/role.js +243 -0
- data/lib/vue/stores/translations.json +86 -0
- data/lib/vue/stores/user.js +102 -0
- data/lib/{sass/lesli/devise/sessions.scss → vue/translation.js} +14 -5
- data/lib/webpack/base.js +2 -2
- data/lib/webpack/core.js +2 -0
- data/readme.md +74 -55
- metadata +196 -51
- data/app/assets/fonts/lesli/Domine/Domine-Bold.ttf +0 -0
- data/app/assets/fonts/lesli/Domine/Domine-Regular.ttf +0 -0
- data/app/assets/stylesheets/lesli/users/devise.scss +0 -32
- data/app/controllers/lesli/profiles_controller.rb +0 -60
- data/app/helpers/lesli/profiles_helper.rb +0 -4
- data/app/models/lesli/profile.rb +0 -4
- data/app/views/lesli/devise/sessions/_form.html.erb +0 -17
- data/app/views/lesli/devise/sessions/_session.html.erb +0 -2
- data/app/views/lesli/devise/sessions/edit.html.erb +0 -10
- data/app/views/lesli/devise/sessions/index.html.erb +0 -14
- data/app/views/lesli/devise/sessions/new.html.erb +0 -9
- data/app/views/lesli/devise/sessions/show.html.erb +0 -10
- data/app/views/lesli/profiles/_form.html.erb +0 -17
- data/app/views/lesli/profiles/_profile.html.erb +0 -2
- data/app/views/lesli/profiles/edit.html.erb +0 -10
- data/app/views/lesli/profiles/index.html.erb +0 -14
- data/app/views/lesli/profiles/new.html.erb +0 -9
- data/app/views/lesli/profiles/show.html.erb +0 -10
- data/lib/sass/lesli/pages/dashboards.scss +0 -57
- data/lib/tasks/db.rb +0 -76
- data/lib/vue/stores/profile.js +0 -90
- data/lib/vue/stores/workflow2.js +0 -345
- data/lib/vue/stores/workflows/actions.js +0 -327
- data/lib/vue/stores/workflows/associations.js +0 -130
- data/lib/vue/stores/workflows/checks.js +0 -210
- /data/lib/vue/stores/{announcements.js → entities/announcements.js} +0 -0
- /data/lib/vue/stores/{dashboard.js → entities/dashboard.js} +0 -0
- /data/lib/vue/stores/{workflow.js → entities/workflow.js} +0 -0
- /data/lib/vue/stores/{cloud-bell → panels}/notification.js +0 -0
- /data/lib/vue/stores/{firebase.js → services/firebase.js} +0 -0
data/lib/tasks/lesli_tasks.rake
CHANGED
@@ -1,29 +1,79 @@
|
|
1
|
+
=begin
|
1
2
|
|
2
|
-
|
3
|
-
require_relative "db"
|
3
|
+
Lesli
|
4
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
|
+
require "i18n-js"
|
34
|
+
|
35
|
+
# ·
|
5
36
|
namespace :lesli do
|
6
|
-
namespace :db do
|
7
|
-
|
8
|
-
desc "Drop, build, migrate & seed Lesli database (development only)"
|
9
|
-
task :reset => :environment do |task, args|
|
10
|
-
reset()
|
11
|
-
end
|
12
|
-
|
13
|
-
desc "Build, migrate & seed Lesli database"
|
14
|
-
task :setup => :environment do |task, args|
|
15
|
-
setup()
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Build, migrate & seed Lesli database"
|
19
|
-
task :seed => :environment do |task, args|
|
20
|
-
seed()
|
21
|
-
end
|
22
|
-
end
|
23
37
|
namespace :babel do
|
38
|
+
|
24
39
|
desc "Scan and register labels"
|
25
40
|
task :build => :environment do |task, args|
|
26
|
-
Rake::Task['lesli_babel:
|
41
|
+
Rake::Task['lesli_babel:build'].invoke
|
27
42
|
end
|
43
|
+
|
44
|
+
desc "Export translations to json files"
|
45
|
+
task :export => :environment do |task, args|
|
46
|
+
Rake::Task['lesli_babel:export'].invoke
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Lesli module status"
|
51
|
+
task :status => :environment do |task, args|
|
52
|
+
|
53
|
+
# instance name from builder
|
54
|
+
instance = Lesli.config.instance
|
55
|
+
|
56
|
+
# get installed engines
|
57
|
+
engines = Lesli::System.engines.map { |engine, engine_info|
|
58
|
+
{
|
59
|
+
:name => engine_info[:name],
|
60
|
+
:code => engine_info[:code],
|
61
|
+
:path => engine_info[:path],
|
62
|
+
:version => engine_info[:version],
|
63
|
+
:build => engine_info[:build]
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
# print pretty instance information
|
68
|
+
L2.br(2)
|
69
|
+
|
70
|
+
# core information
|
71
|
+
L2.msg(instance)
|
72
|
+
L2.br()
|
73
|
+
|
74
|
+
# print list of engines
|
75
|
+
L2.table(engines)
|
76
|
+
L2.br(2)
|
77
|
+
|
28
78
|
end
|
29
79
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
/*
|
2
|
+
|
2
3
|
Lesli
|
3
4
|
|
4
5
|
Copyright (c) 2023, Lesli Technologies, S. A.
|
@@ -16,23 +17,20 @@ GNU General Public License for more details.
|
|
16
17
|
You should have received a copy of the GNU General Public License
|
17
18
|
along with this program. If not, see http://www.gnu.org/licenses/.
|
18
19
|
|
19
|
-
Lesli ·
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
20
21
|
|
21
22
|
Made with ♥ by https://www.lesli.tech
|
22
23
|
Building a better future, one line of code at a time.
|
23
24
|
|
24
25
|
@contact hello@lesli.tech
|
25
|
-
@website https://lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
26
27
|
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
27
28
|
|
28
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
29
30
|
// ·
|
30
31
|
*/
|
31
32
|
|
32
33
|
|
33
|
-
// ·
|
34
|
-
import componentLesliSelect from "Lesli/lesli/components/select/Select.vue"
|
35
|
-
|
36
34
|
// ·
|
37
35
|
import application from "Lesli/public"
|
38
36
|
|
@@ -49,12 +47,12 @@ application({
|
|
49
47
|
telephone_code: "+49",
|
50
48
|
telephone_codes: null,
|
51
49
|
sign_up: {
|
52
|
-
email:
|
53
|
-
password: '',
|
50
|
+
email: "test@lesli.tech",
|
51
|
+
password: 'Tardis2023$',
|
54
52
|
password_confirmation: '',
|
55
|
-
first_name: null,
|
56
|
-
last_name: null,
|
57
|
-
telephone: null,
|
53
|
+
// first_name: null,
|
54
|
+
// last_name: null,
|
55
|
+
// telephone: null,
|
58
56
|
},
|
59
57
|
progress_bar_active: false,
|
60
58
|
notification: {
|
@@ -65,9 +63,6 @@ application({
|
|
65
63
|
|
66
64
|
}
|
67
65
|
},
|
68
|
-
components: {
|
69
|
-
lesliSelect: componentLesliSelect
|
70
|
-
},
|
71
66
|
mounted() {
|
72
67
|
this.$refs.email.focus()
|
73
68
|
},
|
@@ -87,7 +82,7 @@ application({
|
|
87
82
|
|
88
83
|
this.http.post(this.url.to(), user).then(response => {
|
89
84
|
|
90
|
-
setTimeout(() => { this.url.go("/login") }, 5000)
|
85
|
+
//setTimeout(() => { this.url.go("/login") }, 5000)
|
91
86
|
|
92
87
|
}).catch((err)=>{
|
93
88
|
this.showNotification(err.message)
|
@@ -29,12 +29,20 @@ Building a better future, one line of code at a time.
|
|
29
29
|
|
30
30
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
31
|
// ·
|
32
|
-
|
33
32
|
*/
|
34
33
|
|
34
|
+
// · defining props
|
35
|
+
const props = defineProps({
|
36
|
+
dashboard: {
|
37
|
+
type: Boolean,
|
38
|
+
default: false,
|
39
|
+
required: false
|
40
|
+
}
|
41
|
+
})
|
42
|
+
|
35
43
|
</script>
|
36
44
|
<template>
|
37
|
-
<section class="lesli-application-container container">
|
45
|
+
<section class="lesli-application-container container" :class="{ 'is-fluid':dashboard }">
|
38
46
|
<slot></slot>
|
39
47
|
</section>
|
40
48
|
</template>
|
@@ -29,7 +29,6 @@ Building a better future, one line of code at a time.
|
|
29
29
|
|
30
30
|
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
31
31
|
// ·
|
32
|
-
|
33
32
|
*/
|
34
33
|
|
35
34
|
|
@@ -48,6 +47,10 @@ const storeLayout = useLayout()
|
|
48
47
|
const storeSearch = useSearch()
|
49
48
|
|
50
49
|
|
50
|
+
// ·
|
51
|
+
const url = inject("url")
|
52
|
+
|
53
|
+
|
51
54
|
// · defining props
|
52
55
|
const props = defineProps({
|
53
56
|
showEngines: {
|
@@ -135,6 +138,10 @@ function toggleEngines() {
|
|
135
138
|
</div>
|
136
139
|
<div class="lesli-application-header-right">
|
137
140
|
|
141
|
+
<!-- funciona -->
|
142
|
+
<slot></slot>
|
143
|
+
|
144
|
+
|
138
145
|
<!-- engines selector -->
|
139
146
|
<a v-if="props.showEngines || true"
|
140
147
|
class="header-indicator"
|
@@ -187,7 +194,7 @@ function toggleEngines() {
|
|
187
194
|
</div>
|
188
195
|
<div class="dropdown-menu" id="dropdown-menu" role="menu">
|
189
196
|
<div class="dropdown-content">
|
190
|
-
<a href="
|
197
|
+
<a :href="url.admin('profile')" class="dropdown-item py-3">
|
191
198
|
<span class="icon-text">
|
192
199
|
<span class="icon has-text-grey-dark">
|
193
200
|
<span class="ri-user-line"></span>
|
@@ -196,7 +203,7 @@ function toggleEngines() {
|
|
196
203
|
</span>
|
197
204
|
</a>
|
198
205
|
<hr class="dropdown-divider">
|
199
|
-
<a href="/logout" class="dropdown-item">
|
206
|
+
<a href="/logout" class="dropdown-item py-3">
|
200
207
|
<span class="icon-text">
|
201
208
|
<span class="icon has-text-grey-dark">
|
202
209
|
<span class="ri-logout-box-r-line"></span>
|
@@ -0,0 +1,113 @@
|
|
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
|
+
// ·
|
34
|
+
import { defineStore } from "pinia";
|
35
|
+
|
36
|
+
|
37
|
+
// ·
|
38
|
+
export const useAccount = defineStore("account", {
|
39
|
+
state: () => {
|
40
|
+
return {
|
41
|
+
accountInfo: {},
|
42
|
+
options: {
|
43
|
+
countries: [],
|
44
|
+
regions: [],
|
45
|
+
time_zones: []
|
46
|
+
}
|
47
|
+
}
|
48
|
+
},
|
49
|
+
actions: {
|
50
|
+
|
51
|
+
fetch (){
|
52
|
+
this.loading = true
|
53
|
+
this.http.get(this.url.admin("account")).then(result => {
|
54
|
+
this.accountInfo = result
|
55
|
+
delete this.accountInfo.created_at
|
56
|
+
delete this.accountInfo.updated_at
|
57
|
+
delete this.accountInfo.phone_number_2
|
58
|
+
delete this.accountInfo.phone_number_3
|
59
|
+
delete this.accountInfo.phone_number_4
|
60
|
+
}).catch(error => {
|
61
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
62
|
+
}).finally(() => {
|
63
|
+
this.loading = false
|
64
|
+
})
|
65
|
+
},
|
66
|
+
|
67
|
+
update() {
|
68
|
+
this.submitting_form = true
|
69
|
+
this.http.patch(this.url.admin("account"), {
|
70
|
+
account: this.accountInfo
|
71
|
+
}).then(result => {
|
72
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
73
|
+
}).catch(error => {
|
74
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
75
|
+
}).finally(() => {
|
76
|
+
this.fetch()
|
77
|
+
})
|
78
|
+
},
|
79
|
+
getOptions (){
|
80
|
+
this.loading = true
|
81
|
+
this.http.get(this.url.admin("account/options")).then(result => {
|
82
|
+
this.options.countries = result.countries.map((country)=> {
|
83
|
+
return {
|
84
|
+
label: country.name,
|
85
|
+
value: country.id
|
86
|
+
}
|
87
|
+
} )
|
88
|
+
this.options.regions = result.regions.map((region)=> {
|
89
|
+
return {
|
90
|
+
label: region.value,
|
91
|
+
value: region.key
|
92
|
+
}
|
93
|
+
} )
|
94
|
+
}).catch(error => {
|
95
|
+
this.msg.danger(this.translations.core.shared.messages_danger_internal_error)
|
96
|
+
}).finally(() => {
|
97
|
+
this.loading = false
|
98
|
+
})
|
99
|
+
// Get options for time zone selection
|
100
|
+
this.http.get(this.url.admin("account/settings/options")).then(result => {
|
101
|
+
this.options.time_zones = result.time_zones.map((time_zone)=> {
|
102
|
+
return {
|
103
|
+
label: time_zone.text,
|
104
|
+
value: time_zone.value
|
105
|
+
}
|
106
|
+
} )
|
107
|
+
}).catch(error => {
|
108
|
+
this.msg.danger(this.translations.core.shared.messages_danger_internal_error)
|
109
|
+
})
|
110
|
+
}
|
111
|
+
|
112
|
+
},
|
113
|
+
});
|
@@ -0,0 +1,243 @@
|
|
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 Development Platform.
|
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
|
+
// ·
|
34
|
+
import { defineStore } from "pinia"
|
35
|
+
|
36
|
+
|
37
|
+
// ·
|
38
|
+
export const useRole = defineStore("administration.role", {
|
39
|
+
state: () => {
|
40
|
+
return {
|
41
|
+
options: {},
|
42
|
+
records: [],
|
43
|
+
descriptors: [],
|
44
|
+
descriptorsCustom: [],
|
45
|
+
descriptorSearchString: '',
|
46
|
+
role: {
|
47
|
+
name: "",
|
48
|
+
descriptors: []
|
49
|
+
},
|
50
|
+
pagination: {
|
51
|
+
page: 1
|
52
|
+
},
|
53
|
+
index: {
|
54
|
+
pagination: {},
|
55
|
+
records: []
|
56
|
+
},
|
57
|
+
loading: false,
|
58
|
+
order: {
|
59
|
+
column: "id",
|
60
|
+
direction: "desc"
|
61
|
+
},
|
62
|
+
search_string: "",
|
63
|
+
role_activities: {}
|
64
|
+
}
|
65
|
+
},
|
66
|
+
actions: {
|
67
|
+
|
68
|
+
fetch() {
|
69
|
+
this.loading = true
|
70
|
+
this.http.get(this.url.admin("roles")
|
71
|
+
.paginate(this.pagination.page)
|
72
|
+
.order(this.order.column, this.order.direction)
|
73
|
+
.search(this.search_string))
|
74
|
+
.then(result => {
|
75
|
+
this.index = result
|
76
|
+
this.records = result.records.map(integrations => {
|
77
|
+
integrations.created_at = this.date.dateTime(integrations.created_at)
|
78
|
+
return integrations
|
79
|
+
})
|
80
|
+
this.loading = false
|
81
|
+
})
|
82
|
+
},
|
83
|
+
|
84
|
+
paginateIndex(page) {
|
85
|
+
this.pagination.page = page
|
86
|
+
this.fetch()
|
87
|
+
},
|
88
|
+
|
89
|
+
fetchRole(id) {
|
90
|
+
this.loading = true
|
91
|
+
this.http.get(this.url.admin("roles/:id", id)).then(result => {
|
92
|
+
this.role = result
|
93
|
+
this.getDescriptors()
|
94
|
+
this.loading = false
|
95
|
+
})
|
96
|
+
},
|
97
|
+
|
98
|
+
postRole() {
|
99
|
+
return this.http.post(this.url.admin("roles"), this.role)
|
100
|
+
},
|
101
|
+
|
102
|
+
putRole() {
|
103
|
+
this.http.put(this.url.admin("roles/:id", this.role.id), this.role).then(result => {
|
104
|
+
this.msg.success(I18n.t('core.roles.messages_success_role_successfully_updated'))
|
105
|
+
})
|
106
|
+
},
|
107
|
+
|
108
|
+
searchDescriptors(string) {
|
109
|
+
this.descriptorSearchString = string
|
110
|
+
this.getDescriptors()
|
111
|
+
},
|
112
|
+
|
113
|
+
getDescriptors() {
|
114
|
+
|
115
|
+
let url = this.url.admin("roles/:id/descriptors", this.role.id)
|
116
|
+
|
117
|
+
if (this.descriptorSearchString != '') {
|
118
|
+
url = url.search(this.descriptorSearchString)
|
119
|
+
}
|
120
|
+
|
121
|
+
this.http.get(url).then(descriptors => {
|
122
|
+
|
123
|
+
// reset the list of descriptors
|
124
|
+
this.descriptors = []
|
125
|
+
this.descriptorsCustom = []
|
126
|
+
|
127
|
+
// temporary container for the descriptor matrix
|
128
|
+
let descriptorgrid = {}
|
129
|
+
|
130
|
+
// convert list of descriptors from: controller/action to controller/actions (like a matrix)
|
131
|
+
descriptors.forEach(descriptor => {
|
132
|
+
|
133
|
+
if (["list", "index", "show", "create", "update", "destroy"].includes(descriptor.action)) {
|
134
|
+
|
135
|
+
if (!descriptorgrid[descriptor.reference]) {
|
136
|
+
descriptorgrid[descriptor.reference] = {
|
137
|
+
id: descriptor.id,
|
138
|
+
name: descriptor.name,
|
139
|
+
reference: descriptor.reference,
|
140
|
+
controller: descriptor.controller,
|
141
|
+
index: null,
|
142
|
+
show: null,
|
143
|
+
create: null,
|
144
|
+
update: null,
|
145
|
+
destroy: null
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
// add the id of the descriptor that the action belongs to
|
150
|
+
descriptorgrid[descriptor.reference][descriptor.action] = {
|
151
|
+
id: descriptor.id,
|
152
|
+
active: descriptor.active
|
153
|
+
}
|
154
|
+
|
155
|
+
return;
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
this.descriptorsCustom.push(descriptor)
|
160
|
+
|
161
|
+
})
|
162
|
+
|
163
|
+
// return the arrys only
|
164
|
+
this.descriptors = Object.values(descriptorgrid)
|
165
|
+
|
166
|
+
})
|
167
|
+
},
|
168
|
+
|
169
|
+
updateDescriptor(descriptor) {
|
170
|
+
|
171
|
+
// enable descriptor
|
172
|
+
if (descriptor.active) {
|
173
|
+
return this.postDescriptor(descriptor)
|
174
|
+
}
|
175
|
+
|
176
|
+
// disable descriptor
|
177
|
+
this.deleteDescriptor(descriptor)
|
178
|
+
|
179
|
+
},
|
180
|
+
|
181
|
+
postDescriptor(descriptor) {
|
182
|
+
this.http.post(this.url.admin("roles/:id/descriptors", this.role.id), {
|
183
|
+
role_descriptor: {
|
184
|
+
id: descriptor.id
|
185
|
+
}
|
186
|
+
})
|
187
|
+
},
|
188
|
+
|
189
|
+
deleteDescriptor(descriptor) {
|
190
|
+
this.http.delete(this.url.admin("roles/:id/descriptors/:descriptor_id", {
|
191
|
+
id: this.role.id,
|
192
|
+
descriptor_id: descriptor.id
|
193
|
+
}))
|
194
|
+
},
|
195
|
+
|
196
|
+
getOptions() {
|
197
|
+
this.http.get(this.url.admin("roles/options")).then(result => {
|
198
|
+
|
199
|
+
this.options = result
|
200
|
+
})
|
201
|
+
},
|
202
|
+
/**
|
203
|
+
* @description This action is used to sort the results
|
204
|
+
*/
|
205
|
+
sortIndex(column, direction) {
|
206
|
+
this.order.column = column
|
207
|
+
this.order.direction = direction
|
208
|
+
this.fetch()
|
209
|
+
},
|
210
|
+
/**
|
211
|
+
* @description This action is used to search
|
212
|
+
* @param {string} search_string
|
213
|
+
*/
|
214
|
+
search(search_string) {
|
215
|
+
this.search_string = search_string
|
216
|
+
this.fetch()
|
217
|
+
},
|
218
|
+
/**
|
219
|
+
* @description This action is used to delete a role
|
220
|
+
* @param {Integer} role_id id of the role to be deleted
|
221
|
+
*/
|
222
|
+
deleteRole(role_id){
|
223
|
+
this.http.delete(this.url.admin('roles/:id', {id: role_id})).then(result => {
|
224
|
+
this.msg.success(I18n.t("core.users.messages_success_operation"))
|
225
|
+
this.fetch()
|
226
|
+
}).catch(error => {
|
227
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
228
|
+
})
|
229
|
+
},
|
230
|
+
/**
|
231
|
+
* @description This action is used to fetch activity logs from a role
|
232
|
+
*/
|
233
|
+
fetchLogs(){
|
234
|
+
this.loading = true
|
235
|
+
this.http.get(this.url.admin('roles/:id/activities', {id: this.role.id})).then(result => {
|
236
|
+
this.role_activities = result.activities
|
237
|
+
this.loading = false
|
238
|
+
}).catch(error => {
|
239
|
+
this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
|
240
|
+
})
|
241
|
+
}
|
242
|
+
}
|
243
|
+
})
|
@@ -0,0 +1,86 @@
|
|
1
|
+
{
|
2
|
+
"en": {
|
3
|
+
"lesli": {
|
4
|
+
"shared": {
|
5
|
+
"title_lesli": ":lesli.shared.title_lesli:"
|
6
|
+
},
|
7
|
+
"users": {
|
8
|
+
"title_users": "Users"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"lesli_admin": {
|
12
|
+
"shared": {
|
13
|
+
"title_lesli": ":lesli.shared.title_lesli:"
|
14
|
+
},
|
15
|
+
"users": {
|
16
|
+
"title_users": "Users"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"lesli_audit": {
|
20
|
+
"shared": {
|
21
|
+
"title_lesli": ":lesli.shared.title_lesli:"
|
22
|
+
},
|
23
|
+
"users": {
|
24
|
+
"title_users": "Users"
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"lesli_babel": {
|
28
|
+
"shared": {
|
29
|
+
"title_lesli": ":lesli.shared.title_lesli:"
|
30
|
+
},
|
31
|
+
"users": {
|
32
|
+
"title_users": "Users"
|
33
|
+
}
|
34
|
+
},
|
35
|
+
"lesli_driver": {
|
36
|
+
"shared": {
|
37
|
+
"title_lesli": ":lesli.shared.title_lesli:"
|
38
|
+
},
|
39
|
+
"users": {
|
40
|
+
"title_users": "Users"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"es": {
|
45
|
+
"lesli": {
|
46
|
+
"shared": {
|
47
|
+
"title_lesli": "Lesli en español "
|
48
|
+
},
|
49
|
+
"users": {
|
50
|
+
"title_users": "Usuarios"
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"lesli_admin": {
|
54
|
+
"shared": {
|
55
|
+
"title_lesli": "Lesli en español "
|
56
|
+
},
|
57
|
+
"users": {
|
58
|
+
"title_users": "Usuarios"
|
59
|
+
}
|
60
|
+
},
|
61
|
+
"lesli_audit": {
|
62
|
+
"shared": {
|
63
|
+
"title_lesli": "Lesli en español "
|
64
|
+
},
|
65
|
+
"users": {
|
66
|
+
"title_users": "Usuarios"
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"lesli_babel": {
|
70
|
+
"shared": {
|
71
|
+
"title_lesli": "Lesli en español "
|
72
|
+
},
|
73
|
+
"users": {
|
74
|
+
"title_users": "Usuarios"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"lesli_driver": {
|
78
|
+
"shared": {
|
79
|
+
"title_lesli": "Lesli en español "
|
80
|
+
},
|
81
|
+
"users": {
|
82
|
+
"title_users": "Usuarios"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|