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