lesli_audit 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lesli_audit/application.js +33 -98
- data/app/assets/javascripts/lesli_audit/application.js.LICENSE.txt +327 -0
- data/app/controllers/lesli_audit/accounts_controller.rb +60 -0
- data/app/controllers/lesli_audit/analytics_controller.rb +0 -4
- data/app/controllers/lesli_audit/requests_controller.rb +60 -0
- data/app/controllers/lesli_audit/users_controller.rb +60 -0
- data/app/helpers/lesli_audit/accounts_helper.rb +4 -0
- data/app/helpers/lesli_audit/requests_helper.rb +4 -0
- data/app/helpers/lesli_audit/users_helper.rb +4 -0
- data/app/models/lesli_audit/account.rb +6 -0
- data/app/models/lesli_audit/account_request.rb +5 -0
- data/app/models/lesli_audit/analytic.rb +2 -2
- data/app/models/lesli_audit/request.rb +4 -0
- data/app/models/lesli_audit/user.rb +4 -0
- data/app/models/lesli_audit/user_request.rb +7 -0
- data/app/services/lesli_audit/analytic_service.rb +13 -48
- data/app/views/lesli_audit/accounts/_account.html.erb +2 -0
- data/app/views/lesli_audit/accounts/_form.html.erb +17 -0
- data/app/views/lesli_audit/accounts/edit.html.erb +10 -0
- data/app/views/lesli_audit/accounts/index.html.erb +14 -0
- data/app/views/lesli_audit/accounts/new.html.erb +9 -0
- data/app/views/lesli_audit/accounts/show.html.erb +10 -0
- data/app/views/lesli_audit/requests/_form.html.erb +17 -0
- data/app/views/lesli_audit/requests/_request.html.erb +2 -0
- data/app/views/lesli_audit/requests/edit.html.erb +10 -0
- data/app/views/lesli_audit/requests/index.html.erb +14 -0
- data/app/views/lesli_audit/requests/new.html.erb +9 -0
- data/app/views/lesli_audit/requests/show.html.erb +10 -0
- data/app/views/lesli_audit/users/_form.html.erb +17 -0
- data/app/views/lesli_audit/users/_user.html.erb +2 -0
- data/app/views/lesli_audit/users/edit.html.erb +10 -0
- data/app/views/lesli_audit/users/index.html.erb +14 -0
- data/app/views/lesli_audit/users/new.html.erb +9 -0
- data/app/views/lesli_audit/users/show.html.erb +10 -0
- data/config/locales/translations.en.yml +7 -0
- data/config/locales/translations.es.yml +7 -0
- data/config/routes.rb +17 -11
- data/db/migrate/v1.0/0803100010_create_lesli_audit_account_requests.rb +44 -0
- data/db/migrate/v1.0/0803110010_create_lesli_audit_user_requests.rb +46 -0
- data/db/seed/development.rb +31 -24
- data/lib/lesli_audit/version.rb +2 -2
- data/lib/vue/apps/analytics/index.vue +3 -7
- data/lib/vue/components/requests.vue +0 -6
- data/lib/vue/components/visitors.vue +3 -0
- data/lib/vue/stores/analytics.js +0 -35
- data/lib/vue/stores/translations.json +38 -0
- data/readme.md +44 -93
- metadata +37 -3
- data/lib/vue/components/resources.vue +0 -73
@@ -0,0 +1,327 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Lesli
|
4
|
+
|
5
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
6
|
+
|
7
|
+
This program is free software: you can redistribute it and/or modify
|
8
|
+
it under the terms of the GNU General Public License as published by
|
9
|
+
the Free Software Foundation, either version 3 of the License, or
|
10
|
+
(at your option) any later version.
|
11
|
+
|
12
|
+
This program is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
GNU General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU General Public License
|
18
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
19
|
+
|
20
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
21
|
+
|
22
|
+
Made with ♥ by https://www.lesli.tech
|
23
|
+
Building a better future, one line of code at a time.
|
24
|
+
|
25
|
+
@contact hello@lesli.tech
|
26
|
+
@website https://www.lesli.tech
|
27
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
28
|
+
|
29
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
30
|
+
// ·
|
31
|
+
*/
|
32
|
+
|
33
|
+
/*
|
34
|
+
|
35
|
+
Lesli
|
36
|
+
|
37
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
38
|
+
|
39
|
+
This program is free software: you can redistribute it and/or modify
|
40
|
+
it under the terms of the GNU General Public License as published by
|
41
|
+
the Free Software Foundation, either version 3 of the License, or
|
42
|
+
(at your option) any later version.
|
43
|
+
|
44
|
+
This program is distributed in the hope that it will be useful,
|
45
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
46
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
47
|
+
GNU General Public License for more details.
|
48
|
+
|
49
|
+
You should have received a copy of the GNU General Public License
|
50
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
51
|
+
|
52
|
+
Lesli · Your Smart Business Assistant.
|
53
|
+
|
54
|
+
Made with ♥ by https://www.lesli.tech
|
55
|
+
Building a better future, one line of code at a time.
|
56
|
+
|
57
|
+
@contact hello@lesli.tech
|
58
|
+
@website https://lesli.tech
|
59
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
60
|
+
|
61
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
62
|
+
// ·
|
63
|
+
|
64
|
+
*/
|
65
|
+
|
66
|
+
/*
|
67
|
+
|
68
|
+
Lesli
|
69
|
+
|
70
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
71
|
+
|
72
|
+
This program is free software: you can redistribute it and/or modify
|
73
|
+
it under the terms of the GNU General Public License as published by
|
74
|
+
the Free Software Foundation, either version 3 of the License, or
|
75
|
+
(at your option) any later version.
|
76
|
+
|
77
|
+
This program is distributed in the hope that it will be useful,
|
78
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
79
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
80
|
+
GNU General Public License for more details.
|
81
|
+
|
82
|
+
You should have received a copy of the GNU General Public License
|
83
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
84
|
+
|
85
|
+
Lesli · Your Smart Business Assistant.
|
86
|
+
|
87
|
+
Made with ♥ by https://www.lesli.tech
|
88
|
+
Building a better future, one line of code at a time.
|
89
|
+
|
90
|
+
@contact hello@lesli.tech
|
91
|
+
@website https://lesli.tech
|
92
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
93
|
+
|
94
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
95
|
+
// ·
|
96
|
+
*/
|
97
|
+
|
98
|
+
/*
|
99
|
+
Lesli
|
100
|
+
|
101
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
102
|
+
|
103
|
+
This program is free software: you can redistribute it and/or modify
|
104
|
+
it under the terms of the GNU General Public License as published by
|
105
|
+
the Free Software Foundation, either version 3 of the License, or
|
106
|
+
(at your option) any later version.
|
107
|
+
|
108
|
+
This program is distributed in the hope that it will be useful,
|
109
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
110
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
111
|
+
GNU General Public License for more details.
|
112
|
+
|
113
|
+
You should have received a copy of the GNU General Public License
|
114
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
115
|
+
|
116
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
117
|
+
|
118
|
+
Made with ♥ by https://www.lesli.tech
|
119
|
+
Building a better future, one line of code at a time.
|
120
|
+
|
121
|
+
@contact hello@lesli.tech
|
122
|
+
@website https://www.lesli.dev
|
123
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
124
|
+
|
125
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
126
|
+
// ·
|
127
|
+
*/
|
128
|
+
|
129
|
+
/*
|
130
|
+
Lesli
|
131
|
+
|
132
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
133
|
+
|
134
|
+
This program is free software: you can redistribute it and/or modify
|
135
|
+
it under the terms of the GNU General Public License as published by
|
136
|
+
the Free Software Foundation, either version 3 of the License, or
|
137
|
+
(at your option) any later version.
|
138
|
+
|
139
|
+
This program is distributed in the hope that it will be useful,
|
140
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
141
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
142
|
+
GNU General Public License for more details.
|
143
|
+
|
144
|
+
You should have received a copy of the GNU General Public License
|
145
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
146
|
+
|
147
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
148
|
+
|
149
|
+
Made with ♥ by https://www.lesli.tech
|
150
|
+
Building a better future, one line of code at a time.
|
151
|
+
|
152
|
+
@contact hello@lesli.tech
|
153
|
+
@website https://www.lesli.tech
|
154
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
155
|
+
|
156
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
157
|
+
// ·
|
158
|
+
*/
|
159
|
+
|
160
|
+
/*
|
161
|
+
Lesli
|
162
|
+
|
163
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
164
|
+
|
165
|
+
This program is free software: you can redistribute it and/or modify
|
166
|
+
it under the terms of the GNU General Public License as published by
|
167
|
+
the Free Software Foundation, either version 3 of the License, or
|
168
|
+
(at your option) any later version.
|
169
|
+
|
170
|
+
This program is distributed in the hope that it will be useful,
|
171
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
172
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
173
|
+
GNU General Public License for more details.
|
174
|
+
|
175
|
+
You should have received a copy of the GNU General Public License
|
176
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
177
|
+
|
178
|
+
Lesli · Ruby on Rails SaaS development platform.
|
179
|
+
|
180
|
+
Made with ♥ by https://www.lesli.tech
|
181
|
+
Building a better future, one line of code at a time.
|
182
|
+
|
183
|
+
@contact hello@lesli.tech
|
184
|
+
@website https://www.lesli.tech
|
185
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
186
|
+
|
187
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
188
|
+
// ·
|
189
|
+
*/
|
190
|
+
|
191
|
+
/*
|
192
|
+
Lesli
|
193
|
+
|
194
|
+
Copyright (c) 2020, Lesli Technologies, S. A.
|
195
|
+
|
196
|
+
This program is free software: you can redistribute it and/or modify
|
197
|
+
it under the terms of the GNU General Public License as published by
|
198
|
+
the Free Software Foundation, either version 3 of the License, or
|
199
|
+
(at your option) any later version.
|
200
|
+
|
201
|
+
This program is distributed in the hope that it will be useful,
|
202
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
203
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
204
|
+
GNU General Public License for more details.
|
205
|
+
|
206
|
+
You should have received a copy of the GNU General Public License
|
207
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
208
|
+
|
209
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
210
|
+
|
211
|
+
Powered by LesliTech
|
212
|
+
Building a better future, one line of code at a time.
|
213
|
+
|
214
|
+
@contact <hello@lesli.tech>
|
215
|
+
@website <https://lesli.tech>
|
216
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
217
|
+
|
218
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
219
|
+
// ·
|
220
|
+
*/
|
221
|
+
|
222
|
+
/*
|
223
|
+
Lesli
|
224
|
+
|
225
|
+
Copyright (c) 2021, Lesli Technologies, S. A.
|
226
|
+
|
227
|
+
This program is free software: you can redistribute it and/or modify
|
228
|
+
it under the terms of the GNU General Public License as published by
|
229
|
+
the Free Software Foundation, either version 3 of the License, or
|
230
|
+
(at your option) any later version.
|
231
|
+
|
232
|
+
This program is distributed in the hope that it will be useful,
|
233
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
234
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
235
|
+
GNU General Public License for more details.
|
236
|
+
|
237
|
+
You should have received a copy of the GNU General Public License
|
238
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
239
|
+
|
240
|
+
Lesli JS - JavaScript utilities for JavaScript applications
|
241
|
+
|
242
|
+
Powered by LesliTech
|
243
|
+
Building a better future, one line of code at a time.
|
244
|
+
|
245
|
+
@contact <hello@lesli.tech>
|
246
|
+
@website <https://lesli.tech>
|
247
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
248
|
+
|
249
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
250
|
+
// ·
|
251
|
+
*/
|
252
|
+
|
253
|
+
/*
|
254
|
+
Lesli
|
255
|
+
|
256
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
257
|
+
|
258
|
+
This program is free software: you can redistribute it and/or modify
|
259
|
+
it under the terms of the GNU General Public License as published by
|
260
|
+
the Free Software Foundation, either version 3 of the License, or
|
261
|
+
(at your option) any later version.
|
262
|
+
|
263
|
+
This program is distributed in the hope that it will be useful,
|
264
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
265
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
266
|
+
GNU General Public License for more details.
|
267
|
+
|
268
|
+
You should have received a copy of the GNU General Public License
|
269
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
270
|
+
|
271
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
272
|
+
|
273
|
+
Made with ♥ by https://www.lesli.tech
|
274
|
+
Building a better future, one line of code at a time.
|
275
|
+
|
276
|
+
@contact hello@lesli.tech
|
277
|
+
@website https://www.lesli.dev
|
278
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
279
|
+
|
280
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
281
|
+
// ·
|
282
|
+
*/
|
283
|
+
|
284
|
+
/*
|
285
|
+
Lesli
|
286
|
+
|
287
|
+
Copyright (c) 2023, Lesli Technologies, S. A.
|
288
|
+
|
289
|
+
This program is free software: you can redistribute it and/or modify
|
290
|
+
it under the terms of the GNU General Public License as published by
|
291
|
+
the Free Software Foundation, either version 3 of the License, or
|
292
|
+
(at your option) any later version.
|
293
|
+
|
294
|
+
This program is distributed in the hope that it will be useful,
|
295
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
296
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
297
|
+
GNU General Public License for more details.
|
298
|
+
|
299
|
+
You should have received a copy of the GNU General Public License
|
300
|
+
along with this program. If not, see http://www.gnu.org/licenses/.
|
301
|
+
|
302
|
+
Lesli · Ruby on Rails SaaS Development Framework.
|
303
|
+
|
304
|
+
Made with ♥ by https://www.lesli.tech
|
305
|
+
Building a better future, one line of code at a time.
|
306
|
+
|
307
|
+
@contact hello@lesli.tech
|
308
|
+
@website https://www.lesli.tech
|
309
|
+
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
310
|
+
|
311
|
+
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
312
|
+
// ·
|
313
|
+
*/
|
314
|
+
|
315
|
+
/*!
|
316
|
+
* ApexCharts v3.41.1
|
317
|
+
* (c) 2018-2023 ApexCharts
|
318
|
+
* Released under the MIT License.
|
319
|
+
*/
|
320
|
+
|
321
|
+
/*! svg.draggable.js - v2.2.2 - 2019-01-08
|
322
|
+
* https://github.com/svgdotjs/svg.draggable.js
|
323
|
+
* Copyright (c) 2019 Wout Fierens; Licensed MIT */
|
324
|
+
|
325
|
+
/*! svg.filter.js - v2.0.2 - 2016-02-24
|
326
|
+
* https://github.com/wout/svg.filter.js
|
327
|
+
* Copyright (c) 2016 Wout Fierens; Licensed MIT */
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module LesliAudit
|
2
|
+
class AccountsController < ApplicationController
|
3
|
+
before_action :set_account, only: %i[ show edit update destroy ]
|
4
|
+
|
5
|
+
# GET /accounts
|
6
|
+
def index
|
7
|
+
@accounts = Account.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /accounts/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /accounts/new
|
15
|
+
def new
|
16
|
+
@account = Account.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /accounts/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /accounts
|
24
|
+
def create
|
25
|
+
@account = Account.new(account_params)
|
26
|
+
|
27
|
+
if @account.save
|
28
|
+
redirect_to @account, notice: "Account was successfully created."
|
29
|
+
else
|
30
|
+
render :new, status: :unprocessable_entity
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /accounts/1
|
35
|
+
def update
|
36
|
+
if @account.update(account_params)
|
37
|
+
redirect_to @account, notice: "Account was successfully updated.", status: :see_other
|
38
|
+
else
|
39
|
+
render :edit, status: :unprocessable_entity
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE /accounts/1
|
44
|
+
def destroy
|
45
|
+
@account.destroy
|
46
|
+
redirect_to accounts_url, notice: "Account was successfully destroyed.", status: :see_other
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
51
|
+
def set_account
|
52
|
+
@account = Account.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Only allow a list of trusted parameters through.
|
56
|
+
def account_params
|
57
|
+
params.fetch(:account, {})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -9,10 +9,6 @@ module LesliAudit
|
|
9
9
|
respond_with_successful(AnalyticService.new(current_user, query).visitors)
|
10
10
|
end
|
11
11
|
|
12
|
-
def resourcess
|
13
|
-
respond_with_successful(AnalyticService.new(current_user, query).resourcess)
|
14
|
-
end
|
15
|
-
|
16
12
|
def users
|
17
13
|
respond_with_successful(AnalyticService.new(current_user, query).users)
|
18
14
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module LesliAudit
|
2
|
+
class RequestsController < ApplicationController
|
3
|
+
before_action :set_request, only: %i[ show edit update destroy ]
|
4
|
+
|
5
|
+
# GET /requests
|
6
|
+
def index
|
7
|
+
@requests = Request.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /requests/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /requests/new
|
15
|
+
def new
|
16
|
+
@request = Request.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /requests/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /requests
|
24
|
+
def create
|
25
|
+
@request = Request.new(request_params)
|
26
|
+
|
27
|
+
if @request.save
|
28
|
+
redirect_to @request, notice: "Request was successfully created."
|
29
|
+
else
|
30
|
+
render :new, status: :unprocessable_entity
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /requests/1
|
35
|
+
def update
|
36
|
+
if @request.update(request_params)
|
37
|
+
redirect_to @request, notice: "Request was successfully updated.", status: :see_other
|
38
|
+
else
|
39
|
+
render :edit, status: :unprocessable_entity
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE /requests/1
|
44
|
+
def destroy
|
45
|
+
@request.destroy
|
46
|
+
redirect_to requests_url, notice: "Request was successfully destroyed.", status: :see_other
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
51
|
+
def set_request
|
52
|
+
@request = Request.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Only allow a list of trusted parameters through.
|
56
|
+
def request_params
|
57
|
+
params.fetch(:request, {})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module LesliAudit
|
2
|
+
class UsersController < ApplicationController
|
3
|
+
before_action :set_user, only: %i[ show edit update destroy ]
|
4
|
+
|
5
|
+
# GET /users
|
6
|
+
def index
|
7
|
+
@users = User.all
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /users/1
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /users/new
|
15
|
+
def new
|
16
|
+
@user = User.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# GET /users/1/edit
|
20
|
+
def edit
|
21
|
+
end
|
22
|
+
|
23
|
+
# POST /users
|
24
|
+
def create
|
25
|
+
@user = User.new(user_params)
|
26
|
+
|
27
|
+
if @user.save
|
28
|
+
redirect_to @user, notice: "User was successfully created."
|
29
|
+
else
|
30
|
+
render :new, status: :unprocessable_entity
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# PATCH/PUT /users/1
|
35
|
+
def update
|
36
|
+
if @user.update(user_params)
|
37
|
+
redirect_to @user, notice: "User was successfully updated.", status: :see_other
|
38
|
+
else
|
39
|
+
render :edit, status: :unprocessable_entity
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# DELETE /users/1
|
44
|
+
def destroy
|
45
|
+
@user.destroy
|
46
|
+
redirect_to users_url, notice: "User was successfully destroyed.", status: :see_other
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
# Use callbacks to share common setup or constraints between actions.
|
51
|
+
def set_user
|
52
|
+
@user = User.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Only allow a list of trusted parameters through.
|
56
|
+
def user_params
|
57
|
+
params.fetch(:user, {})
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -35,14 +35,6 @@ module LesliAudit
|
|
35
35
|
|
36
36
|
LIMIT=5
|
37
37
|
|
38
|
-
def resourcess
|
39
|
-
return current_user.account.requests.group(:created_at).limit(30)
|
40
|
-
.select(
|
41
|
-
"count(id) resources",
|
42
|
-
"created_at date"
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
38
|
# @overwrite
|
47
39
|
# @return {Hash} Paginated list of the records
|
48
40
|
# @param {query} Has of the formated queries/filters that will be applied to filter data
|
@@ -56,62 +48,35 @@ module LesliAudit
|
|
56
48
|
# only the users of the account
|
57
49
|
usrs = current_user.account.users
|
58
50
|
|
59
|
-
|
60
|
-
requests =
|
61
|
-
requests =
|
51
|
+
|
52
|
+
requests = current_user.account.audit.account_requests
|
53
|
+
requests = requests.group("DATE_TRUNC('month', created_at)") if group == 'month'
|
54
|
+
requests = requests.group("DATE_TRUNC('week', created_at)") if group == 'week'
|
55
|
+
requests = requests.group("DATE_TRUNC('day', created_at)") if group == 'day'
|
62
56
|
|
63
57
|
requests = apply_filters(requests, query)
|
64
58
|
|
65
59
|
requests.limit(30).order("date DESC").select(
|
66
|
-
|
60
|
+
"count(id) resources",
|
67
61
|
"sum(request_count) requests",
|
68
62
|
"DATE_TRUNC('day', created_at) date"
|
69
|
-
)
|
70
|
-
{
|
71
|
-
:requests => request[:requests],
|
72
|
-
#:resources => request[:resources],
|
73
|
-
:date => Date2.new(request[:date]).date.to_s
|
74
|
-
}
|
75
|
-
end
|
63
|
+
)
|
76
64
|
end
|
77
65
|
|
78
66
|
def users
|
79
67
|
|
80
|
-
|
68
|
+
current_user.account.audit.user_requests
|
81
69
|
.joins(:user)
|
82
|
-
.where(user: current_user.account.users)
|
83
70
|
.group(:email)
|
84
|
-
|
85
|
-
requests = apply_filters(requests, query)
|
86
|
-
|
87
|
-
requests = requests.limit(LIMIT).order("requests DESC").select(
|
71
|
+
.limit(LIMIT).order("requests DESC").select(
|
88
72
|
:email,
|
89
|
-
"count(
|
90
|
-
"sum(
|
91
|
-
)
|
92
|
-
{
|
93
|
-
:requests => request[:requests],
|
94
|
-
:resources => request[:resources],
|
95
|
-
:email => request[:email]
|
96
|
-
}
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def devices
|
101
|
-
agents = Lesli::User::Agent.where(user: current_user.account.users)
|
102
|
-
agents = agents.group("platform", "browser")
|
103
|
-
agents = agents.limit(LIMIT).order(sum_count: :desc).sum(:count).map do |req|
|
104
|
-
{
|
105
|
-
:device => req[0].join("/"),
|
106
|
-
:visits => req[1]
|
107
|
-
}
|
108
|
-
end
|
109
|
-
|
110
|
-
return agents
|
73
|
+
"count(lesli_audit_user_requests.id) resources",
|
74
|
+
"sum(lesli_audit_user_requests.request_count) requests"
|
75
|
+
)
|
111
76
|
end
|
112
77
|
|
113
78
|
def controllers
|
114
|
-
requests =
|
79
|
+
requests = current_user.account.audit.account_requests
|
115
80
|
.group("request_controller").limit(30)
|
116
81
|
|
117
82
|
requests = apply_filters(requests, query)
|