1
|
|
|
<?php namespace Arcanesoft\Foundation\Seeds; |
2
|
|
|
|
3
|
|
|
use Arcanesoft\Auth\Seeds\PermissionsSeeder; |
4
|
|
|
use Arcanesoft\Foundation\Policies\LogViewerPolicy; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class PermissionTableSeeder |
8
|
|
|
* |
9
|
|
|
* @package Arcanesoft\Foundation\Seeds |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class PermissionsTableSeeder extends PermissionsSeeder |
13
|
|
|
{ |
14
|
|
|
/* ----------------------------------------------------------------- |
15
|
|
|
| Main Methods |
16
|
|
|
| ----------------------------------------------------------------- |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Run the database seeds. |
21
|
|
|
*/ |
22
|
|
|
public function run() |
23
|
|
|
{ |
24
|
|
|
$this->seed([ |
25
|
|
|
[ |
26
|
|
|
'group' => [ |
27
|
|
|
'name' => 'Foundation', |
28
|
|
|
'slug' => 'foundation', |
29
|
|
|
'description' => 'Foundation permissions group', |
30
|
|
|
], |
31
|
|
|
'permissions' => array_merge( |
32
|
|
|
$this->getSettingsPermissions(), |
33
|
|
|
$this->getLogViewerPermissions() |
34
|
|
|
), |
35
|
|
|
], |
36
|
|
|
]); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/* ----------------------------------------------------------------- |
40
|
|
|
| Permissions |
41
|
|
|
| ----------------------------------------------------------------- |
42
|
|
|
*/ |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Get the Settings permissions. |
46
|
|
|
* |
47
|
|
|
* @return array |
48
|
|
|
*/ |
49
|
|
|
private function getSettingsPermissions() |
50
|
|
|
{ |
51
|
|
|
return [ |
52
|
|
|
[ |
53
|
|
|
'name' => 'Settings - View the general settings', |
54
|
|
|
'description' => 'Allow to view the general settings.', |
55
|
|
|
'slug' => 'foundation.settings.general', // TODO: Create Settings Policies |
56
|
|
|
], |
57
|
|
|
]; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Get the LogViewer permissions. |
62
|
|
|
* |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
private function getLogViewerPermissions() |
66
|
|
|
{ |
67
|
|
|
return [ |
68
|
|
|
[ |
69
|
|
|
'name' => 'LogViewer - View dashboard', |
70
|
|
|
'description' => 'Allow to view the LogViewer dashboard.', |
71
|
|
|
'slug' => LogViewerPolicy::PERMISSION_DASHBOARD, |
72
|
|
|
], |
73
|
|
|
[ |
74
|
|
|
'name' => 'LogViewer - List all logs', |
75
|
|
|
'description' => 'Allow to list all the logs.', |
76
|
|
|
'slug' => LogViewerPolicy::PERMISSION_LIST, |
77
|
|
|
], |
78
|
|
|
[ |
79
|
|
|
'name' => 'LogViewer - View a log', |
80
|
|
|
'description' => 'Allow to display a log.', |
81
|
|
|
'slug' => LogViewerPolicy::PERMISSION_SHOW, |
82
|
|
|
], |
83
|
|
|
[ |
84
|
|
|
'name' => 'LogViewer - Download a log', |
85
|
|
|
'description' => 'Allow to download a log.', |
86
|
|
|
'slug' => LogViewerPolicy::PERMISSION_DOWNLOAD, |
87
|
|
|
], |
88
|
|
|
[ |
89
|
|
|
'name' => 'LogViewer - Delete a log', |
90
|
|
|
'description' => 'Allow to delete a log.', |
91
|
|
|
'slug' => LogViewerPolicy::PERMISSION_DELETE, |
92
|
|
|
], |
93
|
|
|
]; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|