mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-05-04 18:08:46 +03:00
Permissions: Prevent export revision metadata view without permission
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<div class="entity-meta">
|
||||
@if ($entity->isA('page'))
|
||||
@if ($entity->isA('page') && userCan(\BookStack\Permissions\Permission::RevisionViewAll))
|
||||
@icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }} <br>
|
||||
@endif
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Tests\Exports;
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Chapter;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use BookStack\Permissions\Permission;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -229,6 +230,20 @@ class HtmlExportTest extends TestCase
|
||||
$resp->assertDontSee('ExportWizardTheFifth');
|
||||
}
|
||||
|
||||
public function test_page_export_only_includes_revision_count_if_user_has_revision_view_permissions()
|
||||
{
|
||||
$editor = $this->users->editor();
|
||||
$page = $this->entities->page();
|
||||
|
||||
$resp = $this->actingAs($editor)->get($page->getUrl('/export/html'));
|
||||
$resp->assertSee('Revision #');
|
||||
|
||||
$this->permissions->removeUserRolePermissions($editor, [Permission::RevisionViewAll]);
|
||||
|
||||
$resp = $this->actingAs($editor)->get($page->getUrl('/export/html'));
|
||||
$resp->assertDontSee('Revision #');
|
||||
}
|
||||
|
||||
public function test_html_exports_contain_csp_meta_tag()
|
||||
{
|
||||
$entities = [
|
||||
|
||||
Reference in New Issue
Block a user