1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Epesi\FileStorage; |
4
|
|
|
|
5
|
|
|
use Epesi\Core\System\Integration\Modules\ModuleView; |
6
|
|
|
use Epesi\Core\Data\Persistence\SQL; |
|
|
|
|
7
|
|
|
use Epesi\FileStorage\Seeds\FileView; |
8
|
|
|
use Epesi\Core\Layout\Seeds\ActionBar; |
9
|
|
|
|
10
|
|
|
class FileAccessHistory extends ModuleView |
11
|
|
|
{ |
12
|
|
|
protected $label = 'File Access History'; |
13
|
|
|
|
14
|
|
|
public function body() |
15
|
|
|
{ |
16
|
|
|
ActionBar::addButton('back')->link(url()->previous()); |
17
|
|
|
|
18
|
|
|
$this->displayFileDetails(); |
19
|
|
|
|
20
|
|
|
$this->displayAccessHistoryGrid(); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function displayFileDetails() |
24
|
|
|
{ |
25
|
|
|
$this->add(['View', ['ui' => 'segment']])->add([new FileView($this->stickyGet('id')), 'disableActions' => 'history']); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function displayAccessHistoryGrid() |
29
|
|
|
{ |
30
|
|
|
$grid = $this->add([ |
31
|
|
|
'CRUD', |
32
|
|
|
'canCreate' => false, |
33
|
|
|
'canUpdate' => false, |
34
|
|
|
'canDelete' => false, |
35
|
|
|
'quickSearch' => [ |
36
|
|
|
'accessed_by_user', 'action', 'ip_address', 'host_name' |
37
|
|
|
] |
38
|
|
|
]); |
39
|
|
|
|
40
|
|
|
$grid->addItemsPerPageSelector([10, 25, 50, 100], __('Items per page') . ':'); |
|
|
|
|
41
|
|
|
|
42
|
|
|
$grid->setModel($this->getModel($this->stickyGet('id'))); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getModel($fileId) |
46
|
|
|
{ |
47
|
|
|
$atkDb = app()->make(SQL::class); |
48
|
|
|
|
49
|
|
|
$user = new \atk4\data\Model($atkDb, 'users'); |
50
|
|
|
|
51
|
|
|
$user->addField('name'); |
52
|
|
|
|
53
|
|
|
$model = new \atk4\data\Model($atkDb, 'filestorage_access_log'); |
54
|
|
|
|
55
|
|
|
$model->hasOne('accessed_by', $user)->addTitle(['field' => 'accessed_by_user', 'caption' => __('Accessed By')]); |
|
|
|
|
56
|
|
|
|
57
|
|
|
$model->addFields([ |
58
|
|
|
'file_id', |
59
|
|
|
['accessed_at', 'caption' => __('Accessed At')], |
60
|
|
|
['action', 'caption' => __('Action')], |
61
|
|
|
['ip_address', 'caption' => __('IP Address')], |
62
|
|
|
['host_name', 'caption' => __('Host Name')] |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
$model->addCondition('file_id', $fileId); |
66
|
|
|
|
67
|
|
|
$model->setOrder('accessed_at desc'); |
68
|
|
|
|
69
|
|
|
return $model; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths