lesli_vault 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lesli_vault/application.js +730 -300
  3. data/app/controllers/lesli_vault/descriptors_controller.rb +9 -10
  4. data/app/controllers/lesli_vault/roles_controller.rb +9 -27
  5. data/app/services/{descriptor_services.rb → lesli_vault/descriptor_service.rb} +17 -62
  6. data/app/services/{role_services.rb → lesli_vault/role_service.rb} +39 -39
  7. data/app/{models/lesli_vault/system_controller.rb → views/lesli_vault/partials/_engine-navigation.html.erb} +5 -8
  8. data/config/routes.rb +7 -3
  9. data/lib/lesli_vault/version.rb +2 -1
  10. data/lib/vue/application.js +48 -1
  11. data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/components/form.vue +14 -25
  12. data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/index.vue +18 -20
  13. data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/new.vue +12 -19
  14. data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentForm.vue +63 -59
  15. data/{app/vue/lesli_vault → lib/vue}/apps/roles/index.vue +25 -27
  16. data/{app/vue/lesli_vault → lib/vue}/apps/roles/new.vue +6 -7
  17. data/{app/vue/lesli_vault → lib/vue}/stores/descriptor.js +21 -5
  18. data/{app/vue/lesli_vault → lib/vue}/stores/descriptors.js +1 -12
  19. data/{app/vue/lesli_vault → lib/vue}/stores/role.js +17 -42
  20. data/{app/vue/lesli_vault/application.js → lib/vue/stores/roles.js} +30 -7
  21. data/license +674 -0
  22. data/readme.md +60 -9
  23. metadata +29 -49
  24. data/app/controllers/lesli_vault/system_controller/actions_controller.rb +0 -112
  25. data/app/controllers/lesli_vault/system_controllers_controller.rb +0 -64
  26. data/app/helpers/lesli_vault/system_controller/actions_helper.rb +0 -4
  27. data/app/helpers/lesli_vault/system_controllers_helper.rb +0 -4
  28. data/app/models/lesli_vault/system_controller/action.rb +0 -39
  29. data/app/services/application_lesli_services.rb +0 -168
  30. data/app/services/system_controller_services.rb +0 -99
  31. data/app/views/layouts/lesli_vault/application.html.erb +0 -15
  32. data/app/views/lesli_vault/system_controller/actions/_form.html.erb +0 -32
  33. data/app/views/lesli_vault/system_controller/actions/edit.html.erb +0 -34
  34. data/app/views/lesli_vault/system_controller/actions/index.html.erb +0 -34
  35. data/app/views/lesli_vault/system_controller/actions/new.html.erb +0 -34
  36. data/app/views/lesli_vault/system_controller/actions/show.html.erb +0 -34
  37. data/app/views/lesli_vault/system_controllers/_form.html.erb +0 -32
  38. data/app/views/lesli_vault/system_controllers/edit.html.erb +0 -34
  39. data/app/views/lesli_vault/system_controllers/index.html.erb +0 -34
  40. data/app/views/lesli_vault/system_controllers/new.html.erb +0 -34
  41. data/app/views/lesli_vault/system_controllers/show.html.erb +0 -34
  42. data/app/vue/lesli_vault/apps/security/index.vue +0 -208
  43. data/app/vue/lesli_vault/stores/roles.js +0 -89
  44. data/app/vue/lesli_vault/stores/systemController.js +0 -67
  45. data/lib/tasks/system/controllers.rake +0 -112
  46. /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/edit.vue +0 -0
  47. /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/privileges.vue +0 -0
  48. /data/{app/vue/lesli_vault → lib/vue}/apps/descriptors/show.vue +0 -0
  49. /data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentPrivilegeCustom.vue +0 -0
  50. /data/{app/vue/lesli_vault → lib/vue}/apps/roles/componentPrivilegeStandard.vue +0 -0
  51. /data/{app/vue/lesli_vault → lib/vue}/apps/roles/edit.vue +0 -0
  52. /data/{app/vue/lesli_vault → lib/vue}/apps/roles/logs.vue +0 -0
  53. /data/{app/vue/lesli_vault → lib/vue}/apps/roles/show.vue +0 -0
@@ -18,35 +18,33 @@ GNU General Public License for more details.
18
18
  You should have received a copy of the GNU General Public License
19
19
  along with this program. If not, see http://www.gnu.org/licenses/.
20
20
 
21
- Lesli · Your Smart Business Assistant.
21
+ Lesli · Ruby on Rails SaaS Development Framework.
22
22
 
23
23
  Made with ♥ by https://www.lesli.tech
24
24
  Building a better future, one line of code at a time.
25
25
 
26
26
  @contact hello@lesli.tech
27
- @website https://lesli.tech
27
+ @website https://www.lesli.tech
28
28
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
29
 
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
31
  // ·
32
-
33
32
  */
34
33
 
35
34
 
36
35
 
37
36
  // · import vue tools
38
- import { onMounted } from "vue"
39
- import { useRouter, useRoute } from 'vue-router'
37
+ import { onMounted, inject } from "vue"
38
+ import { useRouter, useRoute } from "vue-router"
39
+
40
40
 
41
+ // ·
42
+ const url = inject("url")
41
43
 
42
- // · import lesli stores
43
- import { useDescriptor } from "LesliApp/administration/stores/descriptor"
44
44
 
45
45
  // · import components
46
- import descriptorForm from "./components/form.vue"
46
+ import descriptorForm from "LesliVault/apps/descriptors/components/form.vue"
47
47
 
48
- // · implement stores
49
- const storeDescriptor = useDescriptor()
50
48
 
51
49
  // · translations
52
50
  const translations = {
@@ -57,20 +55,15 @@ const translations = {
57
55
  }
58
56
 
59
57
  }
60
-
61
- onMounted(() => {
62
- //storeDescriptor.getDescriptorsOptions()
63
- })
64
-
65
58
  </script>
66
59
 
67
60
  <template>
68
- <section class="application-component">
69
- <lesli-header :title="translations.core.role_descriptors.view_btn_new_role_descriptors">
61
+ <lesli-application-container>
62
+ <lesli-header title="Create a new descriptor">
70
63
  <lesli-button icon="list" :to="url.admin('descriptors')">
71
64
  {{ translations.core.view_btn_list }}
72
65
  </lesli-button>
73
66
  </lesli-header>
74
67
  <descriptor-form></descriptor-form>
75
- </section>
68
+ </lesli-application-container>
76
69
  </template>
@@ -77,17 +77,12 @@ onMounted(() => {
77
77
  // ·
78
78
  function submitRole() {
79
79
 
80
+ // role id exists, then just update the role
80
81
  if (storeRole.role.id) {
81
- storeRole.putRole()
82
- }
83
-
84
- if (!storeRole.role.id) {
85
- return storeRole.postRole().then(result => {
86
- msg.success(translations.core.roles.messages_success_role_created_successfully)
87
- router.push(url.admin("roles/:id/edit", result.id).s)
88
- })
82
+ return storeRole.putRole()
89
83
  }
90
84
 
85
+ return storeRole.postRole()
91
86
  }
92
87
 
93
88
 
@@ -98,37 +93,49 @@ function isObjectLevelPermissionSelected(olp) {
98
93
 
99
94
  </script>
100
95
  <template>
101
- <form @submit.prevent="submitRole" class="box">
96
+ <lesli-form @submit="submitRole">
102
97
 
103
98
  <!-- Role name -->
104
99
  <div class="field">
105
100
  <label class="label">
106
- {{ translations.core.roles.column_name }}
101
+ Name
107
102
  <sup class="has-text-danger">*</sup>
108
103
  </label>
109
104
  <div class="control">
110
- <input v-model="storeRole.role.name" class="input" type="text" required />
105
+ <input v-model="storeRole.role.payload.name" class="input" type="text" required />
111
106
  </div>
112
107
  </div>
113
108
 
114
- <!-- Default path -->
109
+ <!-- Role Description -->
115
110
  <div class="field">
116
- <label class="label">{{ translations.core.roles.column_default_path }}</label>
111
+ <label class="label">
112
+ Description
113
+ </label>
117
114
  <div class="control">
118
- <input v-model="storeRole.role.default_path" class="input" type="text" :placeholder="translations.core.roles.view_placeholder_default_path_at_login">
115
+ <input v-model="storeRole.role.payload.description" class="input" type="text" />
119
116
  </div>
120
- <p class="help"> {{ translations.core.roles.view_text_default_path_description }}</p>
121
117
  </div>
122
118
 
123
- <!-- Limit to default path -->
119
+ <!-- Role default path -->
120
+ <div class="field">
121
+ <label class="label">Default path</label>
122
+ <div class="control">
123
+ <input v-model="storeRole.role.payload.path_default" class="input" type="text" :placeholder="translations.core.roles.view_placeholder_default_path_at_login">
124
+ </div>
125
+ <p class="help">Default path to redirect after login.</p>
126
+ </div>
127
+
128
+ <hr />
129
+
130
+ <!-- Role limited to path -->
124
131
  <div class="field">
125
132
  <label class="label">
126
- {{ translations.core.roles.column_limit_to_path }}
133
+ Limited?
127
134
  </label>
128
135
  <div class="control">
129
136
  <div class="select">
130
137
  <lesli-select
131
- v-model="storeRole.role.limit_to_path"
138
+ v-model="storeRole.role.payload.path_limited"
132
139
  :options="[{
133
140
  label: translations.core.roles.view_text_limit_to_path,
134
141
  value: true
@@ -139,49 +146,19 @@ function isObjectLevelPermissionSelected(olp) {
139
146
  </lesli-select>
140
147
  </div>
141
148
  </div>
142
- <p class="help"> {{ translations.core.roles.view_text_default_path_description }}</p>
143
- </div>
144
-
145
- <hr>
146
-
147
- <!-- Object level permission -->
148
- <div class="field">
149
- <label class="label">
150
- {{ translations.core.roles.view_text_hierarchical_level }}
151
- <sup class="has-text-danger">*</sup>
152
- </label>
153
- <ul class="hierarchical_level_selector">
154
- <li :class="['hover', 'p-1', { 'has-background-info has-text-light' : isObjectLevelPermissionSelected(olp.level) }]"
155
- v-for="(olp, index) in storeRole.options.object_level_permissions" :key="index"
156
- v-on:click="storeRole.role.object_level_permission = olp.level">
157
- <p class="icon-text">
158
- <span class="icon">
159
- <span class="material-icons">
160
- {{ isObjectLevelPermissionSelected(olp.level) ? 'check_box' : 'check_box_outline_blank' }}
161
- </span>
162
- <i :class="['fas', isObjectLevelPermissionSelected(olp.level) ? 'fa-check' : 'fa-chevron-right']"></i>
163
- </span>
164
- <span>
165
- {{ `${translations.core.roles.view_text_level || 'Level' } ${ index + 1 }` }}
166
- <i v-if="olp.roles.length">- {{ olp.roles.map(role => role.name).join(', ') }}</i>
167
- </span>
168
- </p>
169
- </li>
170
- </ul>
149
+ <p class="help">Always redirect role to the default path</p>
171
150
  </div>
172
151
 
173
- <hr>
174
-
175
- <!-- Only own data -->
152
+ <!-- Role is isolated -->
176
153
  <div class="field">
177
154
  <label class="label">
178
- {{ translations.core.roles.column_only_my_data }}
155
+ Isolated?
179
156
  <sup class="has-text-danger">*</sup>
180
157
  </label>
181
158
  <div class="control">
182
159
  <div class="select">
183
160
  <lesli-select
184
- v-model="storeRole.role.only_my_data"
161
+ v-model="storeRole.role.payload.isolated"
185
162
  :options="[{
186
163
  label: translations.core.roles.view_text_restrict_data_access,
187
164
  value: true
@@ -192,20 +169,19 @@ function isObjectLevelPermissionSelected(olp) {
192
169
  </lesli-select>
193
170
  </div>
194
171
  </div>
172
+ <p class="help">Force the role to query only the data that belongs to the current user</p>
195
173
  </div>
196
174
 
197
- <hr>
198
-
199
175
  <!-- Enable/disable role -->
200
176
  <div class="field">
201
177
  <label class="label">
202
- {{ translations.core.roles.view_text_status }}
178
+ Status
203
179
  <sup class="has-text-danger">*</sup>
204
180
  </label>
205
181
  <div class="control">
206
182
  <div class="select">
207
183
  <lesli-select
208
- v-model="storeRole.role.active"
184
+ v-model="storeRole.role.payload.active"
209
185
  :options="[{
210
186
  label: translations.core.roles.view_text_active,
211
187
  value: true
@@ -220,12 +196,40 @@ function isObjectLevelPermissionSelected(olp) {
220
196
 
221
197
  <hr>
222
198
 
199
+ <!-- Object level permission -->
200
+ <div class="field">
201
+ <label class="label">
202
+ Hierarchical level
203
+ <sup class="has-text-danger">*</sup>
204
+ </label>
205
+ <ul class="hierarchical_level_selector">
206
+ <li :class="['hover', 'p-1', { 'has-background-info has-text-light' : isObjectLevelPermissionSelected(olp.level) }]"
207
+ v-for="(olp, index) in storeRole.options.object_level_permissions" :key="index"
208
+ v-on:click="storeRole.role.payload.object_level_permission = olp.level">
209
+ <p class="icon-text">
210
+ <span class="icon">
211
+ <span class="material-icons">
212
+ {{ isObjectLevelPermissionSelected(olp.level) ? 'check_box' : 'check_box_outline_blank' }}
213
+ </span>
214
+ <i :class="['fas', isObjectLevelPermissionSelected(olp.level) ? 'fa-check' : 'fa-chevron-right']"></i>
215
+ </span>
216
+ <span>
217
+ {{ `${translations.core.roles.view_text_level || 'Level' } ${ index + 1 }` }}
218
+ <i v-if="olp.roles.length">- {{ olp.roles.map(role => role.name).join(', ') }}</i>
219
+ </span>
220
+ </p>
221
+ </li>
222
+ </ul>
223
+ </div>
224
+
225
+ <hr>
226
+
223
227
  <div class="field is-grouped">
224
228
  <div class="control">
225
- <lesli-button icon="save">
226
- {{ translations.core.shared.view_btn_save }}
229
+ <lesli-button main icon="save" :loading="storeRole.role.loading">
230
+ Save
227
231
  </lesli-button>
228
232
  </div>
229
233
  </div>
230
- </form>
234
+ </lesli-form>
231
235
  </template>
@@ -18,29 +18,28 @@ GNU General Public License for more details.
18
18
  You should have received a copy of the GNU General Public License
19
19
  along with this program. If not, see http://www.gnu.org/licenses/.
20
20
 
21
- Lesli · Your Smart Business Assistant.
21
+ Lesli · Ruby on Rails SaaS Development Framework.
22
22
 
23
23
  Made with ♥ by https://www.lesli.tech
24
24
  Building a better future, one line of code at a time.
25
25
 
26
26
  @contact hello@lesli.tech
27
- @website https://lesli.tech
27
+ @website https://www.lesli.tech
28
28
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
29
 
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
31
  // ·
32
-
33
32
  */
34
33
 
35
34
 
36
35
 
37
36
  // · import vue tools
38
37
  import { ref, reactive, onMounted, watch, computed, inject } from "vue"
39
- import { useRouter, useRoute } from 'vue-router'
38
+ import { useRouter, useRoute } from "vue-router"
40
39
 
41
40
 
42
41
  // · import lesli stores
43
- import { useRole } from "../../stores/role"
42
+ import { useRoles } from "LesliVault/stores/roles"
44
43
 
45
44
 
46
45
  // · initialize/inject plugins
@@ -51,7 +50,7 @@ const url = inject("url")
51
50
 
52
51
 
53
52
  // ·
54
- const storeRole = useRole()
53
+ const storeRoles = useRoles()
55
54
 
56
55
 
57
56
  // ·
@@ -72,6 +71,7 @@ const columns = [{
72
71
  }, {
73
72
  field: "users",
74
73
  label: translations.core.roles.view_text_users || 'Users',
74
+ align: "center",
75
75
  sort: true
76
76
  }, {
77
77
  field: "isolated",
@@ -96,35 +96,33 @@ const props = defineProps({
96
96
 
97
97
  // ·
98
98
  onMounted(() => {
99
- storeRole.fetch()
99
+ storeRoles.fetch()
100
100
  })
101
101
 
102
102
 
103
103
  </script>
104
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 }}
105
+ <lesli-application-container>
106
+ <lesli-header title="Roles &amp; privileges">
107
+ <lesli-button icon="refresh"
108
+ :loading="storeRoles.loading"
109
+ @click="storeRoles.fetch()">
110
+ Reload
117
111
  </lesli-button>
112
+ <lesli-link main icon="add" :to="url.vault('roles/new')">
113
+ Add role
114
+ </lesli-link>
118
115
  </lesli-header>
119
- <lesli-toolbar @search="storeRole.search"></lesli-toolbar>
116
+
117
+ <lesli-toolbar @search="storeRoles.search"></lesli-toolbar>
118
+
120
119
  <lesli-table
121
120
  :link="(role) => url.root(props.appMountPath+`/${role.id}`).s"
122
121
  :columns="columns"
123
- :records="storeRole.records"
124
- :pagination="storeRole.index.pagination"
125
- @paginate="storeRole.paginateIndex"
126
- @sort="storeRole.sortIndex"
127
- >
122
+ :records="storeRoles.records"
123
+ :pagination="storeRoles.pagination"
124
+ @paginate="storeRoles.paginateIndex"
125
+ @sort="storeRoles.sortIndex">
128
126
  <template #active="{ value }">
129
127
  <span class="tag is-success is-light" v-if="value">active</span>
130
128
  </template>
@@ -165,5 +163,5 @@ onMounted(() => {
165
163
  </template>
166
164
 
167
165
  </lesli-table>
168
- </section>
166
+ </lesli-application-container>
169
167
  </template>
@@ -18,18 +18,17 @@ GNU General Public License for more details.
18
18
  You should have received a copy of the GNU General Public License
19
19
  along with this program. If not, see http://www.gnu.org/licenses/.
20
20
 
21
- Lesli · Your Smart Business Assistant.
21
+ Lesli · Ruby on Rails SaaS Development Framework.
22
22
 
23
23
  Made with ♥ by https://www.lesli.tech
24
24
  Building a better future, one line of code at a time.
25
25
 
26
26
  @contact hello@lesli.tech
27
- @website https://lesli.tech
27
+ @website https://www.lesli.tech
28
28
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
29
 
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
31
  // ·
32
-
33
32
  */
34
33
 
35
34
 
@@ -41,7 +40,7 @@ import componentFormRole from "./componentForm.vue"
41
40
 
42
41
 
43
42
  // · import lesli stores
44
- import { useRole } from "../../stores/role"
43
+ import { useRole } from "LesliVault/stores/role"
45
44
 
46
45
 
47
46
  // · initialize/inject plugins
@@ -78,12 +77,12 @@ onMounted(() => {
78
77
 
79
78
  </script>
80
79
  <template>
81
- <section class="application-component">
80
+ <lesli-application-container>
82
81
  <lesli-header title="Create a new role">
83
82
  <lesli-button icon="list" :to="url.root(props.appMountPath)">
84
83
  All roles
85
84
  </lesli-button>
86
85
  </lesli-header>
87
86
  <componentFormRole></componentFormRole>
88
- </section>
87
+ </lesli-application-container>
89
88
  </template>
@@ -38,11 +38,15 @@ import { defineStore } from "pinia"
38
38
 
39
39
 
40
40
  // ·
41
- export const useDescriptor = defineStore("administration.descriptor", {
41
+ export const useDescriptor = defineStore("vault.descriptor", {
42
42
  state: () => {
43
43
  return {
44
- list: [],
45
- descriptor: {},
44
+ descriptor: {
45
+ loading: false,
46
+ payload: {
47
+ name: ""
48
+ }
49
+ },
46
50
  privileges: [],
47
51
  privilegesLoading: false
48
52
  }
@@ -69,8 +73,20 @@ export const useDescriptor = defineStore("administration.descriptor", {
69
73
  },
70
74
 
71
75
  resetDescriptor() {
72
- this.descriptor = {}
73
- this.privileges = []
76
+ },
77
+
78
+ postDescriptor() {
79
+ this.loading = true
80
+ this.http.post(this.url.vault("descriptors"), {
81
+ descriptor: this.descriptor.payload
82
+ }).then(result => {
83
+ this.descriptor.payload.id = result.id
84
+ this.msg.success(I18n.t("core.users.messages_success_operation"))
85
+ }).catch(error => {
86
+ this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
87
+ }).finally(() => {
88
+ this.loading = false
89
+ })
74
90
  },
75
91
 
76
92
  getDescriptorPrivileges() {
@@ -59,7 +59,7 @@ export const useDescriptors = defineStore("administration.descriptors", {
59
59
 
60
60
  getDescriptors() {
61
61
  this.index.loading = true
62
- this.http.get(this.url.admin("descriptors")).then(result => {
62
+ this.http.get(this.url.vault("descriptors")).then(result => {
63
63
  this.index.pagination = result.pagination
64
64
  this.index.records = result.records
65
65
  }).catch(error => {
@@ -69,17 +69,6 @@ export const useDescriptors = defineStore("administration.descriptors", {
69
69
  })
70
70
  },
71
71
 
72
- postDescriptor() {
73
- this.loading = true
74
- this.http.post(this.url.admin("descriptors"), { descriptor: this.descriptor }).then(result => {
75
- this.descriptor.id = result.id
76
- this.msg.success(I18n.t("core.users.messages_success_operation"))
77
- this.loading = false
78
- }).catch(error => {
79
- this.msg.danger(I18n.t("core.shared.messages_danger_internal_error"))
80
- })
81
- },
82
-
83
72
  resetDescriptor() {
84
73
  this.descriptor = {}
85
74
  this.privileges = []
@@ -39,53 +39,20 @@ export const useRole = defineStore("administration.role", {
39
39
  state: () => {
40
40
  return {
41
41
  options: {},
42
- records: [],
43
42
  descriptors: [],
44
43
  descriptorsCustom: [],
45
44
  descriptorSearchString: '',
46
45
  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: {}
46
+ loading: false,
47
+ search_string: "",
48
+ payload: {
49
+ name: ""
50
+ }
51
+ }
64
52
  }
65
53
  },
66
54
  actions: {
67
55
 
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
56
  fetchRole(id) {
90
57
  this.loading = true
91
58
  this.http.get(this.url.admin("roles/:id", id)).then(result => {
@@ -96,12 +63,21 @@ export const useRole = defineStore("administration.role", {
96
63
  },
97
64
 
98
65
  postRole() {
99
- return this.http.post(this.url.admin("roles"), this.role)
66
+ this.role.loading = true
67
+ this.http.post(this.url.vault("roles"), this.role.payload).then(result => {
68
+ msg.success(translations.core.roles.messages_success_role_created_successfully)
69
+ router.push(url.admin("roles/:id/edit", result.id).s)
70
+ }).finally(() => {
71
+ this.role.loading = false
72
+ })
100
73
  },
101
74
 
102
75
  putRole() {
76
+ this.role.loading = true
103
77
  this.http.put(this.url.admin("roles/:id", this.role.id), this.role).then(result => {
104
78
  this.msg.success(I18n.t('core.roles.messages_success_role_successfully_updated'))
79
+ }).finally(() => {
80
+ this.role.loading = false
105
81
  })
106
82
  },
107
83
 
@@ -194,8 +170,7 @@ export const useRole = defineStore("administration.role", {
194
170
  },
195
171
 
196
172
  getOptions() {
197
- this.http.get(this.url.admin("roles/options")).then(result => {
198
-
173
+ this.http.get(this.url.vault("roles/options")).then(result => {
199
174
  this.options = result
200
175
  })
201
176
  },
@@ -1,5 +1,4 @@
1
1
  /*
2
-
3
2
  Lesli
4
3
 
5
4
  Copyright (c) 2023, Lesli Technologies, S. A.
@@ -17,7 +16,7 @@ GNU General Public License for more details.
17
16
  You should have received a copy of the GNU General Public License
18
17
  along with this program. If not, see http://www.gnu.org/licenses/.
19
18
 
20
- Lesli · Ruby on Rails SaaS development platform.
19
+ Lesli · Ruby on Rails Development Platform.
21
20
 
22
21
  Made with ♥ by https://www.lesli.tech
23
22
  Building a better future, one line of code at a time.
@@ -26,13 +25,37 @@ Building a better future, one line of code at a time.
26
25
  @website https://www.lesli.tech
27
26
  @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
27
 
29
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
28
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
29
  // ·
31
-
32
30
  */
33
31
 
34
- // · Import base for maunting the application
35
- import application from "Lesli/application"
36
32
 
37
33
  // ·
38
- application("LesliVault", [])
34
+ import { defineStore } from "pinia"
35
+
36
+
37
+ // ·
38
+ export const useRoles = defineStore("vault.roles", {
39
+ state: () => {
40
+ return {
41
+ pagination: {},
42
+ records: []
43
+ }
44
+ },
45
+ actions: {
46
+
47
+ fetch() {
48
+ //if (!this.list.length > 0) {
49
+ this.getRoles()
50
+ //}
51
+ },
52
+
53
+ // Get the list of role user is able to work with
54
+ // according to object level permissions
55
+ getRoles() {
56
+ this.http.get(this.url.vault("roles")).then(result => {
57
+ this.records = result
58
+ })
59
+ },
60
+ }
61
+ })