lesli_audit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_audit_manifest.js +38 -0
  4. data/app/assets/images/lesli_audit/audit-logo.svg +72 -0
  5. data/app/assets/javascripts/lesli_audit/application.js +3592 -0
  6. data/app/assets/stylesheets/lesli_audit/application.scss +35 -0
  7. data/app/assets/stylesheets/lesli_audit/dashboard.scss +0 -0
  8. data/app/controllers/lesli_audit/analytics_controller.rb +36 -0
  9. data/app/controllers/lesli_audit/application_controller.rb +4 -0
  10. data/app/controllers/lesli_audit/dashboards_controller.rb +59 -0
  11. data/app/helpers/lesli_audit/analytics_helper.rb +4 -0
  12. data/app/helpers/lesli_audit/application_helper.rb +4 -0
  13. data/app/helpers/lesli_audit/dashboards_helper.rb +4 -0
  14. data/app/jobs/lesli_audit/application_job.rb +4 -0
  15. data/app/mailers/lesli_audit/application_mailer.rb +6 -0
  16. data/app/models/lesli_audit/analytic.rb +4 -0
  17. data/app/models/lesli_audit/application_record.rb +5 -0
  18. data/app/models/lesli_audit/dashboard.rb +4 -0
  19. data/app/services/lesli_audit/account/activity_services.rb +69 -0
  20. data/app/services/lesli_audit/analytic_service.rb +151 -0
  21. data/app/services/lesli_audit/analytics/trend_services.rb +84 -0
  22. data/app/services/lesli_audit/analytics/visitor_service.rb +166 -0
  23. data/app/services/lesli_audit/request_services.rb +71 -0
  24. data/app/services/lesli_audit/users/activity_services.rb +61 -0
  25. data/app/services/lesli_audit/users/log_services.rb +62 -0
  26. data/app/services/lesli_audit/users/registration_services.rb +62 -0
  27. data/app/services/lesli_audit/users/role_services.rb +61 -0
  28. data/app/services/lesli_audit/users/working_hour_services.rb +78 -0
  29. data/app/views/lesli_audit/analytics/_analytic.html.erb +2 -0
  30. data/app/views/lesli_audit/analytics/_form.html.erb +17 -0
  31. data/app/views/lesli_audit/analytics/edit.html.erb +10 -0
  32. data/app/views/lesli_audit/analytics/index.html.erb +1 -0
  33. data/app/views/lesli_audit/analytics/new.html.erb +9 -0
  34. data/app/views/lesli_audit/analytics/show.html.erb +10 -0
  35. data/app/views/lesli_audit/dashboards/_dashboard.html.erb +2 -0
  36. data/app/views/lesli_audit/dashboards/_form.html.erb +17 -0
  37. data/app/views/lesli_audit/dashboards/edit.html.erb +10 -0
  38. data/app/views/lesli_audit/dashboards/index.html.erb +14 -0
  39. data/app/views/lesli_audit/dashboards/new.html.erb +9 -0
  40. data/app/views/lesli_audit/dashboards/show.html.erb +1 -0
  41. data/app/views/lesli_audit/partials/_engine-navigation.html.erb +39 -0
  42. data/config/routes.rb +45 -0
  43. data/db/migrate/v1.0/0803000110_create_lesli_audit_accounts.rb +42 -0
  44. data/db/migrate/v1.0/0803050110_create_lesli_audit_dashboards.rb +51 -0
  45. data/db/migrate/v1.0/0803050210_create_lesli_audit_dashboard_components.rb +53 -0
  46. data/lib/lesli_audit/engine.rb +18 -0
  47. data/lib/lesli_audit/version.rb +3 -0
  48. data/lib/lesli_audit.rb +6 -0
  49. data/lib/tasks/lesli_audit_tasks.rake +4 -0
  50. data/lib/vue/application.js +102 -0
  51. data/lib/vue/apps/accounts/activities.vue +48 -0
  52. data/lib/vue/apps/analytics/index.vue +18 -0
  53. data/lib/vue/apps/analytics/requests.vue +67 -0
  54. data/lib/vue/apps/analytics/trends.vue +149 -0
  55. data/lib/vue/apps/analytics/visitors.vue +91 -0
  56. data/lib/vue/apps/requests/index.vue +123 -0
  57. data/lib/vue/apps/security/passwords.vue +52 -0
  58. data/lib/vue/apps/security/sessions.vue +63 -0
  59. data/lib/vue/apps/users/activities.vue +49 -0
  60. data/lib/vue/apps/users/logs.vue +49 -0
  61. data/lib/vue/apps/users/registrations.vue +98 -0
  62. data/lib/vue/apps/users/roles.vue +70 -0
  63. data/lib/vue/apps/users/workingHours.vue +52 -0
  64. data/lib/vue/stores/accounts/activities.js +87 -0
  65. data/lib/vue/stores/analytics/visitors.js +130 -0
  66. data/lib/vue/stores/request.js +70 -0
  67. data/lib/vue/stores/security/password.js +75 -0
  68. data/lib/vue/stores/security/session.js +78 -0
  69. data/lib/vue/stores/users/activities.js +76 -0
  70. data/lib/vue/stores/users/logs.js +74 -0
  71. data/lib/vue/stores/users/registrations.js +61 -0
  72. data/lib/vue/stores/users/roles.js +52 -0
  73. data/lib/vue/stores/users/working_hours.js +92 -0
  74. data/license +674 -0
  75. data/readme.md +120 -0
  76. metadata +134 -0
@@ -0,0 +1,130 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useAnalytics = defineStore("analytics", {
25
+ state: () => {
26
+ return {
27
+ users: {
28
+ loading: false,
29
+ pagination: {},
30
+ records: [],
31
+ columns: [{
32
+ field: 'email',
33
+ label: 'User'
34
+ }, {
35
+ field: 'resources',
36
+ label: 'Resources'
37
+ }, {
38
+ field: 'requests',
39
+ label: 'Requests'
40
+ }]
41
+ },
42
+ devices: {
43
+ loading: false,
44
+ pagination: {},
45
+ records: [],
46
+ columns: [{
47
+ field: 'device',
48
+ label: 'Device'
49
+ }, {
50
+ field: 'visits',
51
+ label: 'Visits'
52
+ }]
53
+ },
54
+ visitors: {
55
+ loading: false,
56
+ pagination: {},
57
+ records: []
58
+ },
59
+ controllers: {
60
+ loading: false,
61
+ pagination: {},
62
+ records: [],
63
+ columns: [{
64
+ field: 'request_controller',
65
+ label: 'Controller'
66
+ }, {
67
+ field: 'requests',
68
+ label: 'Requests'
69
+ }]
70
+ },
71
+ trends: {
72
+ loading: false,
73
+ recordsDays: [],
74
+ recordsHours: []
75
+ }
76
+ }
77
+ },
78
+ actions: {
79
+
80
+ fetchVisits() {
81
+ this.visitors.loading = true
82
+ this.http.get(this.url.audit("analytics/visitors")).then(result => {
83
+ this.visitors.records = result.reverse()
84
+ }).finally(() => {
85
+ this.visitors.loading = false
86
+ })
87
+ },
88
+
89
+ fetchUsers() {
90
+ this.users.loading = true
91
+ this.http.get(this.url.audit("analytics/users")).then(result => {
92
+ this.users.records = result
93
+ }).finally(() => {
94
+ this.users.loading = false
95
+ })
96
+ },
97
+
98
+ fetchDevices() {
99
+ this.devices.loading = true
100
+ this.http.get(this.url.audit("analytics/devices")).then(result => {
101
+ this.devices.records = result
102
+ }).finally(() => {
103
+ this.devices.loading = false
104
+ })
105
+ },
106
+
107
+ fetchControllers() {
108
+ this.controllers.loading = true
109
+ this.http.get(this.url.audit("analytics/controllers")).then(result => {
110
+ this.controllers.records = result
111
+ }).finally(() => {
112
+ this.controllers.loading = false
113
+ })
114
+ },
115
+
116
+ time(period,initalDate, endDate){
117
+ this.http.get(this.url.audit("analytics/trends")
118
+ .filter({ groupBy: [period], startDate: [initalDate], finalDate: [endDate] }))
119
+ .then(result => {
120
+ if (period ==='day'){
121
+ this.trends.recordsDays = result
122
+ } else if (period ==='hour'){
123
+ this.trends.recordsHours = result
124
+ }
125
+ }).finally(() => {
126
+ this.loading = false
127
+ })
128
+ }
129
+ }
130
+ })
@@ -0,0 +1,70 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useLogRequest = defineStore("logRequest", {
25
+ state: () => {
26
+ return {
27
+ date: "",
28
+ loading: false,
29
+ pagination: {},
30
+ records: []
31
+ }
32
+ },
33
+ actions: {
34
+
35
+ search(string) {
36
+ console.log(string)
37
+ this.fetchLogs(this.url.audit("requests").search(string), false)
38
+ },
39
+
40
+ sort(column, direction) {
41
+ this.fetchLogs(this.url.audit("requests").order(column, direction), false)
42
+ },
43
+
44
+ paginate(page) {
45
+ this.fetchLogs(this.url.audit("requests").paginate(page), false)
46
+ },
47
+
48
+ fetchLogsIfEmpty() {
49
+ if (this.records.length <= 0) {
50
+ this.fetchLogs()
51
+ }
52
+ },
53
+
54
+ fetchLogs(url=this.url.audit("requests"), loading=true) {
55
+
56
+ this.loading = loading
57
+
58
+ this.http.get(url).then(result => {
59
+ this.records = result.records
60
+ this.pagination = result.pagination
61
+ }).catch(error => {
62
+
63
+ }).finally(() => {
64
+ this.loading = false
65
+ })
66
+
67
+ }
68
+
69
+ }
70
+ })
@@ -0,0 +1,75 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useSecurityPassword = defineStore("securityPassword", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: [],
30
+ columns: [{
31
+ field: "id",
32
+ label: "ID"
33
+ }, {
34
+ field: "name",
35
+ label: "Name"
36
+ }, {
37
+ field: "email",
38
+ label: "Email"
39
+ }, {
40
+ field: "title",
41
+ label: "Title"
42
+ }, {
43
+ field: "description",
44
+ label: "Description"
45
+ }, {
46
+ field: "created_at_date",
47
+ label: "Date"
48
+ }]
49
+ }
50
+ },
51
+ actions: {
52
+
53
+ fetchIfEmpty() {
54
+ if (this.records.length <= 0) {
55
+ this.fetch()
56
+ }
57
+ },
58
+ search(string) {
59
+ this.fetch(this.url.audit("security/passwords").filter({ cat: ["user_password_reset"]}).search(string))
60
+ },
61
+
62
+ fetch(url = this.url.audit("security/passwords").filter({ cat: ["user_password_reset"]})) {
63
+ this.loading = true
64
+ this.http.get(url).then(result => {
65
+ this.records = result.records
66
+ this.pagination = result.pagination
67
+ }).catch(error => {
68
+ this.msg.danger("Error while trying to fetch data")
69
+ }).finally(() => {
70
+ this.loading = false
71
+ })
72
+ }
73
+
74
+ }
75
+ })
@@ -0,0 +1,78 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useSecuritySession = defineStore("securitySession", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: [],
30
+ columns: [ {
31
+ field: "log_id",
32
+ label: "ID"
33
+ },{
34
+ field: "id",
35
+ label: "User ID"
36
+ }, {
37
+ field: "name",
38
+ label: "Name"
39
+ }, {
40
+ field: "email",
41
+ label: "Email"
42
+ }, {
43
+ field: "title",
44
+ label: "Title"
45
+ }, {
46
+ field: "description",
47
+ label: "Description"
48
+ }, {
49
+ field: "created_at_date",
50
+ label: "Date"
51
+ }]
52
+ }
53
+ },
54
+ actions: {
55
+
56
+ fetchIfEmpty() {
57
+ if (this.records.length <= 0) {
58
+ this.fetch()
59
+ }
60
+ },
61
+ search(string) {
62
+ fetch(this.url.audit("security/sessions").search(string))
63
+ },
64
+
65
+ fetch(url=this.url.audit("security/sessions")) {
66
+ this.loading = true
67
+ this.http.get(url).then(result => {
68
+ this.records = result.records
69
+ this.pagination = result.pagination
70
+ }).catch(error => {
71
+ this.msg.danger("Error while trying to fetch data")
72
+ }).finally(() => {
73
+ this.loading = false
74
+ })
75
+ }
76
+
77
+ }
78
+ })
@@ -0,0 +1,76 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useUsersActivities = defineStore("usersActivities", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: [],
30
+ columns: [{
31
+ field: "id",
32
+ label: "User Id"
33
+ }, {
34
+ field: "email",
35
+ label: "Email"
36
+ }, {
37
+ field: "field_name",
38
+ label: "Column"
39
+ }, {
40
+ field: "value_from",
41
+ label: "From"
42
+ }, {
43
+ field: "value_to",
44
+ label: "To"
45
+ }, {
46
+ field: "category",
47
+ label: "Category"
48
+ }, {
49
+ field: "created_at_date",
50
+ label: "Date"
51
+ }]
52
+ }
53
+ },
54
+ actions: {
55
+
56
+ fetchIfEmpty() {
57
+ if (this.records.length <= 0) {
58
+ this.fetch()
59
+ }
60
+ },
61
+
62
+ fetch() {
63
+ this.$reset()
64
+ this.loading = true
65
+ this.http.get(this.url.audit("users/activities")).then(result => {
66
+ this.records = result.records
67
+ this.pagination = result.pagination
68
+ }).catch(error => {
69
+
70
+ }).finally(() => {
71
+ this.loading = false
72
+ })
73
+ }
74
+
75
+ }
76
+ })
@@ -0,0 +1,74 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useUsersLogs = defineStore("userLogs", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: [],
30
+ columns: [{
31
+ field: "id",
32
+ label: "ID"
33
+ }, {
34
+ field: "email",
35
+ label: "Email",
36
+ defaultSort: true,
37
+ defaultOrder: 'asc',
38
+ sort: true
39
+ }, {
40
+ field: "title",
41
+ label: "Title"
42
+ }, {
43
+ field: "description",
44
+ label: "Description"
45
+ }, {
46
+ field: "created_at_date",
47
+ label: "Date"
48
+ }]
49
+ }
50
+ },
51
+ actions: {
52
+
53
+ sort(column, order= 'desc | asc'){},
54
+
55
+ fetchIfEmpty() {
56
+ if (this.records.length <= 0) {
57
+ this.fetchLogs()
58
+ }
59
+ },
60
+
61
+ fetchLogs() {
62
+ this.loading = true
63
+ this.http.get(this.url.audit("users/logs")).then(result => {
64
+ this.records = result.records
65
+ this.pagination = result.pagination
66
+ }).catch(error => {
67
+
68
+ }).finally(() => {
69
+ this.loading = false
70
+ })
71
+ }
72
+
73
+ }
74
+ })
@@ -0,0 +1,61 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+ All the information provided by this platform is protected by international laws related to
4
+ industrial property, intellectual property, copyright and relative international laws.
5
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
6
+ pictures and any other information belongs to the owner of this platform.
7
+ Without the written permission of the owner, any replication, modification,
8
+ transmission, publication is strictly forbidden.
9
+ For more information read the license file including with this software.
10
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
11
+ // ·
12
+ */
13
+
14
+
15
+ // ·
16
+ import { defineStore } from "pinia"
17
+
18
+
19
+ // ·
20
+ export const useUsersRegistrations = defineStore("userRegistrations", {
21
+ state: () => {
22
+ return {
23
+ loading: false,
24
+ pagination: {},
25
+ records: [],
26
+ periods : []
27
+ }
28
+ },
29
+ actions: {
30
+
31
+ fetchIfEmpty() {
32
+ if (this.records.length <= 0) {
33
+ this.fetch('month')
34
+ }
35
+ },
36
+
37
+ getOptions(){
38
+ this.loading = true
39
+ this.http.get(this.url.audit("users/options")).then(result => {
40
+ this.periods = result.periods
41
+ }).catch(error => {
42
+ this.msg.danger("Error while trying to fetch data")
43
+ }).finally(() => {
44
+ this.loading = false
45
+ })
46
+
47
+ },
48
+
49
+ fetch(period) {
50
+ this.loading = true
51
+ this.http.get(this.url.audit("users/registrations").group(period)).then(result => {
52
+ this.records = result.reverse()
53
+ }).catch(error => {
54
+ this.msg.danger("Error while trying to fetch data")
55
+ }).finally(() => {
56
+ this.loading = false
57
+ })
58
+ }
59
+
60
+ }
61
+ })
@@ -0,0 +1,52 @@
1
+ /*
2
+ Copyright (c) 2022, all rights reserved.
3
+
4
+ All the information provided by this platform is protected by international laws related to
5
+ industrial property, intellectual property, copyright and relative international laws.
6
+ All intellectual or industrial property rights of the code, texts, trade mark, design,
7
+ pictures and any other information belongs to the owner of this platform.
8
+
9
+ Without the written permission of the owner, any replication, modification,
10
+ transmission, publication is strictly forbidden.
11
+
12
+ For more information read the license file including with this software.
13
+
14
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
15
+ // ·
16
+ */
17
+
18
+
19
+ // ·
20
+ import { defineStore } from "pinia"
21
+
22
+
23
+ // ·
24
+ export const useUsersRoles = defineStore("usersRoles", {
25
+ state: () => {
26
+ return {
27
+ loading: false,
28
+ pagination: {},
29
+ records: []
30
+ }
31
+ },
32
+ actions: {
33
+
34
+ fetchIfEmpty() {
35
+ if (this.records.length <= 0) {
36
+ this.fetch()
37
+ }
38
+ },
39
+
40
+ fetch() {
41
+ this.loading = true
42
+ this.http.get(this.url.audit("users/roles")).then(result => {
43
+ this.records = result
44
+ }).catch(error => {
45
+
46
+ }).finally(() => {
47
+ this.loading = false
48
+ })
49
+ }
50
+
51
+ }
52
+ })