lesli 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/lesli_manifest.js +7 -4
  3. data/app/assets/fonts/lesli/Domine/Domine-VariableFont_wght.ttf +0 -0
  4. data/app/assets/fonts/lesli/Domine/OFL.txt +2 -0
  5. data/app/assets/javascripts/lesli/users/passwords.js +776 -0
  6. data/app/assets/javascripts/lesli/users/registrations.js +776 -0
  7. data/app/assets/javascripts/lesli/users/sessions.js +776 -1
  8. data/app/assets/stylesheets/lesli/users/passwords.scss +5 -6
  9. data/app/assets/stylesheets/lesli/users/registrations.scss +5 -6
  10. data/app/assets/stylesheets/lesli/users/sessions.scss +5 -10
  11. data/app/controllers/lesli/application_lesli_controller.rb +0 -1
  12. data/app/controllers/lesli/interfaces/application/logger.rb +9 -9
  13. data/app/controllers/lesli/roles_controller.rb +43 -0
  14. data/{lib/sass/lesli/devise/registrations.scss.erb → app/controllers/lesli/users_controller.rb} +18 -23
  15. data/app/controllers/users/registrations_controller.rb +137 -58
  16. data/app/helpers/lesli/assets_helper.rb +2 -2
  17. data/app/helpers/lesli/general_helper.rb +1 -1
  18. data/app/helpers/lesli/navigation_helper.rb +7 -10
  19. data/app/helpers/lesli/system_helper.rb +1 -1
  20. data/app/lib/lesli/system.rb +7 -3
  21. data/app/mailers/lesli/application_lesli_mailer.rb +199 -0
  22. data/app/mailers/lesli/application_mailer.rb +7 -0
  23. data/app/mailers/lesli/devise_mailer.rb +33 -0
  24. data/app/models/concerns/user_guard.rb +3 -4
  25. data/app/models/lesli/account.rb +29 -0
  26. data/{lib/sass/lesli/pages/passes.scss → app/models/lesli/descriptor.rb} +14 -8
  27. data/app/models/lesli/role.rb +90 -0
  28. data/app/models/lesli/system_controller.rb +1 -0
  29. data/app/models/lesli/user/detail.rb +55 -0
  30. data/{lib/sass/lesli/pages/otps.scss → app/models/lesli/user/role.rb} +13 -9
  31. data/app/models/lesli/user.rb +4 -3
  32. data/app/services/lesli/role_service.rb +45 -0
  33. data/app/services/lesli/user_service.rb +69 -0
  34. data/app/views/devise/passwords/new.html.erb +72 -12
  35. data/app/views/devise/registrations/new.html.erb +146 -28
  36. data/app/views/devise/sessions/new.html.erb +11 -78
  37. data/app/views/devise/shared/_links.html.erb +96 -25
  38. data/app/views/lesli/emails/devise_mailer/confirmation_instructions.html.erb +23 -0
  39. data/app/views/lesli/emails/user_mailer/invitation.html.erb +23 -0
  40. data/app/views/lesli/layouts/application-devise.html.erb +1 -1
  41. data/app/views/lesli/layouts/application-public.html.erb +2 -2
  42. data/app/views/lesli/layouts/mailer.html.erb +13 -0
  43. data/app/views/lesli/layouts/mailer.text.erb +1 -0
  44. data/app/views/lesli/partials/_application-lesli-header.html.erb +27 -41
  45. data/app/views/lesli/partials/_application-lesli-javascript.html.erb +10 -6
  46. data/app/views/lesli/partials/_application-public-javascript.html.erb +12 -8
  47. data/{lib/sass/lesli/devise/confirmations.scss.erb → app/views/lesli/wrappers/_application-devise-simple.erb} +30 -46
  48. data/app/views/lesli/wrappers/{_application-auth.html.erb → _application-devise.html.erb} +15 -0
  49. data/config/initializers/{lesli_defaults.rb → lesli.rb} +4 -2
  50. data/config/locales/translations.en.yml +7 -0
  51. data/config/locales/translations.es.yml +7 -0
  52. data/config/routes.rb +22 -17
  53. data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +1 -1
  54. data/db/{tables/0010003010_create_user_details.rb → migrate/v1.0/0010003010_create_lesli_user_details.rb} +6 -6
  55. data/db/{tables/0010003510_create_user_roles.rb → migrate/v1.0/0010003410_create_lesli_user_roles.rb} +4 -4
  56. data/db/{tables/0010005010_create_descriptors.rb → migrate/v1.0/0010005010_create_lesli_descriptors.rb} +5 -6
  57. data/db/{tables/0010005110_create_descriptor_privileges.rb → migrate/v1.0/0010005110_create_lesli_descriptor_privileges.rb} +8 -7
  58. data/db/{tables/0010005210_create_descriptor_activities.rb → migrate/v1.0/0010005210_create_lesli_descriptor_activities.rb} +6 -8
  59. data/db/seeds.rb +0 -2
  60. data/lib/lesli/engine.rb +25 -2
  61. data/lib/lesli/routing.rb +26 -0
  62. data/lib/lesli/version.rb +2 -2
  63. data/lib/lesli.rb +1 -0
  64. data/lib/{sass/lesli/pages/mfas.scss → mailer_previews/devise_mailer_preview.rb} +12 -6
  65. data/lib/sass/lesli/bulma/loader.scss +3 -0
  66. data/lib/sass/lesli/elements/header.scss +1 -1
  67. data/lib/sass/lesli/fonts/families.scss +3 -3
  68. data/lib/sass/lesli/layouts/application-container.scss +4 -0
  69. data/lib/sass/lesli/{devise/passwords.scss.erb → pages/devise-simple.scss} +38 -38
  70. data/lib/sass/lesli/{templates → pages}/devise.scss +4 -26
  71. data/lib/sass/lesli/settings/variables.scss +1 -1
  72. data/lib/sass/lesli/templates/application.scss +8 -4
  73. data/lib/sass/lesli/templates/dashboards.scss +8 -0
  74. data/lib/sass/lesli/templates/public.scss +2 -3
  75. data/lib/tasks/lesli/controllers.rake +33 -0
  76. data/lib/tasks/lesli/db.rake +88 -0
  77. data/lib/tasks/lesli/git.rake +74 -0
  78. data/lib/tasks/lesli_tasks.rake +70 -20
  79. data/lib/vue/devise/registrations.js +10 -15
  80. data/lib/vue/layouts/application-container.vue +10 -2
  81. data/lib/vue/layouts/application-header.vue +10 -3
  82. data/lib/vue/stores/account.js +113 -0
  83. data/lib/vue/stores/role.js +243 -0
  84. data/lib/vue/stores/translations.json +86 -0
  85. data/lib/vue/stores/user.js +102 -0
  86. data/lib/{sass/lesli/devise/sessions.scss → vue/translation.js} +14 -5
  87. data/lib/webpack/base.js +2 -2
  88. data/lib/webpack/core.js +2 -0
  89. data/readme.md +74 -55
  90. metadata +196 -51
  91. data/app/assets/fonts/lesli/Domine/Domine-Bold.ttf +0 -0
  92. data/app/assets/fonts/lesli/Domine/Domine-Regular.ttf +0 -0
  93. data/app/assets/stylesheets/lesli/users/devise.scss +0 -32
  94. data/app/controllers/lesli/profiles_controller.rb +0 -60
  95. data/app/helpers/lesli/profiles_helper.rb +0 -4
  96. data/app/models/lesli/profile.rb +0 -4
  97. data/app/views/lesli/devise/sessions/_form.html.erb +0 -17
  98. data/app/views/lesli/devise/sessions/_session.html.erb +0 -2
  99. data/app/views/lesli/devise/sessions/edit.html.erb +0 -10
  100. data/app/views/lesli/devise/sessions/index.html.erb +0 -14
  101. data/app/views/lesli/devise/sessions/new.html.erb +0 -9
  102. data/app/views/lesli/devise/sessions/show.html.erb +0 -10
  103. data/app/views/lesli/profiles/_form.html.erb +0 -17
  104. data/app/views/lesli/profiles/_profile.html.erb +0 -2
  105. data/app/views/lesli/profiles/edit.html.erb +0 -10
  106. data/app/views/lesli/profiles/index.html.erb +0 -14
  107. data/app/views/lesli/profiles/new.html.erb +0 -9
  108. data/app/views/lesli/profiles/show.html.erb +0 -10
  109. data/lib/sass/lesli/pages/dashboards.scss +0 -57
  110. data/lib/tasks/db.rb +0 -76
  111. data/lib/vue/stores/profile.js +0 -90
  112. data/lib/vue/stores/workflow2.js +0 -345
  113. data/lib/vue/stores/workflows/actions.js +0 -327
  114. data/lib/vue/stores/workflows/associations.js +0 -130
  115. data/lib/vue/stores/workflows/checks.js +0 -210
  116. /data/lib/vue/stores/{announcements.js → entities/announcements.js} +0 -0
  117. /data/lib/vue/stores/{dashboard.js → entities/dashboard.js} +0 -0
  118. /data/lib/vue/stores/{workflow.js → entities/workflow.js} +0 -0
  119. /data/lib/vue/stores/{cloud-bell → panels}/notification.js +0 -0
  120. /data/lib/vue/stores/{firebase.js → services/firebase.js} +0 -0
@@ -1,29 +1,79 @@
1
+ =begin
1
2
 
2
- require "L2"
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:scan'].invoke
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 · Your Smart Business Assistant.
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: null,
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="/administration/profile" class="dropdown-item">
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
+ }