mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-07 17:40:57 +00:00
Applied styleci patches
This commit is contained in:
parent
eda9e89c55
commit
7d9de23a25
4 changed files with 9 additions and 9 deletions
app/Http
database/migrations
tests/Entity
|
@ -48,7 +48,7 @@ class Kernel extends HttpKernel
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [
|
protected $routeMiddleware = [
|
||||||
'auth' => \BookStack\Http\Middleware\Authenticate::class,
|
'auth' => \BookStack\Http\Middleware\Authenticate::class,
|
||||||
'can' => \BookStack\Http\Middleware\CheckUserHasPermission::class,
|
'can' => \BookStack\Http\Middleware\CheckUserHasPermission::class,
|
||||||
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,
|
'guest' => \BookStack\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
'guard' => \BookStack\Http\Middleware\CheckGuard::class,
|
'guard' => \BookStack\Http\Middleware\CheckGuard::class,
|
||||||
|
|
|
@ -25,7 +25,6 @@ class CheckUserHasPermission
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function errorResponse(Request $request)
|
protected function errorResponse(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->wantsJson()) {
|
if ($request->wantsJson()) {
|
||||||
|
@ -33,6 +32,7 @@ class CheckUserHasPermission
|
||||||
}
|
}
|
||||||
|
|
||||||
session()->flash('error', trans('errors.permission'));
|
session()->flash('error', trans('errors.permission'));
|
||||||
|
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,15 @@ class AddExportRolePermission extends Migration
|
||||||
// Create new templates-manage permission and assign to admin role
|
// Create new templates-manage permission and assign to admin role
|
||||||
$roles = \Illuminate\Support\Facades\DB::table('roles')->get('id');
|
$roles = \Illuminate\Support\Facades\DB::table('roles')->get('id');
|
||||||
$permissionId = DB::table('role_permissions')->insertGetId([
|
$permissionId = DB::table('role_permissions')->insertGetId([
|
||||||
'name' => 'content-export',
|
'name' => 'content-export',
|
||||||
'display_name' => 'Export Content',
|
'display_name' => 'Export Content',
|
||||||
'created_at' => Carbon::now()->toDateTimeString(),
|
'created_at' => Carbon::now()->toDateTimeString(),
|
||||||
'updated_at' => Carbon::now()->toDateTimeString(),
|
'updated_at' => Carbon::now()->toDateTimeString(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$permissionRoles = $roles->map(function ($role) use ($permissionId) {
|
$permissionRoles = $roles->map(function ($role) use ($permissionId) {
|
||||||
return [
|
return [
|
||||||
'role_id' => $role->id,
|
'role_id' => $role->id,
|
||||||
'permission_id' => $permissionId,
|
'permission_id' => $permissionId,
|
||||||
];
|
];
|
||||||
})->values()->toArray();
|
})->values()->toArray();
|
||||||
|
|
|
@ -353,7 +353,7 @@ class ExportTest extends TestCase
|
||||||
|
|
||||||
foreach ($entities as $entity) {
|
foreach ($entities as $entity) {
|
||||||
$resp = $this->get($entity->getUrl());
|
$resp = $this->get($entity->getUrl());
|
||||||
$resp->assertSee("/export/pdf");
|
$resp->assertSee('/export/pdf');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Role $role */
|
/** @var Role $role */
|
||||||
|
@ -361,8 +361,8 @@ class ExportTest extends TestCase
|
||||||
|
|
||||||
foreach ($entities as $entity) {
|
foreach ($entities as $entity) {
|
||||||
$resp = $this->get($entity->getUrl());
|
$resp = $this->get($entity->getUrl());
|
||||||
$resp->assertDontSee("/export/pdf");
|
$resp->assertDontSee('/export/pdf');
|
||||||
$resp = $this->get($entity->getUrl("/export/pdf"));
|
$resp = $this->get($entity->getUrl('/export/pdf'));
|
||||||
$this->assertPermissionError($resp);
|
$this->assertPermissionError($resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue