mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-07 13:10:51 +00:00
1. 添加RBAC的权限&角色控制件; 2. 将用户‘is_admin’转换为角色; 3. 针对RBAC对管理页面进行定制化处理; 4. 加深layout分层处理; 5. 修改部分路由名称; 6. 分解路由文件至多文件;
70 lines
1.6 KiB
PHP
70 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Laravel\Telescope\IncomingEntry;
|
|
use Laravel\Telescope\Telescope;
|
|
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
|
|
|
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
// Telescope::night();
|
|
|
|
$this->hideSensitiveRequestDetails();
|
|
|
|
Telescope::filter(function (IncomingEntry $entry) {
|
|
if ($this->app->environment('local')) {
|
|
return true;
|
|
}
|
|
|
|
return $entry->isReportableException() ||
|
|
$entry->isFailedRequest() ||
|
|
$entry->isFailedJob() ||
|
|
$entry->isScheduledTask() ||
|
|
$entry->hasMonitoredTag();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Prevent sensitive request details from being logged by Telescope.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function hideSensitiveRequestDetails()
|
|
{
|
|
if ($this->app->environment('local')) {
|
|
return;
|
|
}
|
|
|
|
Telescope::hideRequestParameters(['_token']);
|
|
|
|
Telescope::hideRequestHeaders([
|
|
'cookie',
|
|
'x-csrf-token',
|
|
'x-xsrf-token',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Register the Telescope gate.
|
|
*
|
|
* This gate determines who can access Telescope in non-local environments.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function gate()
|
|
{
|
|
Gate::define('viewTelescope', function ($user) {
|
|
return $user->hasRole('Super Admin');
|
|
});
|
|
}
|
|
}
|