mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-05-04 18:08:46 +03:00
Permissions: Tweaks/fixed during review of revision-view-all changes
This commit is contained in:
@@ -134,8 +134,8 @@ class PageRevisionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function restore(string $bookSlug, string $pageSlug, int $revisionId)
|
public function restore(string $bookSlug, string $pageSlug, int $revisionId)
|
||||||
{
|
{
|
||||||
$page = $this->pageQueries->findVisibleBySlugsOrFail($bookSlug, $pageSlug);
|
|
||||||
$this->checkPermission(Permission::RevisionViewAll);
|
$this->checkPermission(Permission::RevisionViewAll);
|
||||||
|
$page = $this->pageQueries->findVisibleBySlugsOrFail($bookSlug, $pageSlug);
|
||||||
$this->checkOwnablePermission(Permission::PageUpdate, $page);
|
$this->checkOwnablePermission(Permission::PageUpdate, $page);
|
||||||
|
|
||||||
$page = $this->pageRepo->restoreRevision($page, $revisionId);
|
$page = $this->pageRepo->restoreRevision($page, $revisionId);
|
||||||
@@ -150,8 +150,8 @@ class PageRevisionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy(string $bookSlug, string $pageSlug, int $revId)
|
public function destroy(string $bookSlug, string $pageSlug, int $revId)
|
||||||
{
|
{
|
||||||
$page = $this->pageQueries->findVisibleBySlugsOrFail($bookSlug, $pageSlug);
|
|
||||||
$this->checkPermission(Permission::RevisionViewAll);
|
$this->checkPermission(Permission::RevisionViewAll);
|
||||||
|
$page = $this->pageQueries->findVisibleBySlugsOrFail($bookSlug, $pageSlug);
|
||||||
$this->checkOwnablePermission(Permission::PageDelete, $page);
|
$this->checkOwnablePermission(Permission::PageDelete, $page);
|
||||||
|
|
||||||
$revision = $page->revisions()->where('id', '=', $revId)->first();
|
$revision = $page->revisions()->where('id', '=', $revId)->first();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ return new class extends Migration
|
|||||||
'page-view-all',
|
'page-view-all',
|
||||||
])->get();
|
])->get();
|
||||||
|
|
||||||
if (!$pageViewPermissions->count() === 0) {
|
if ($pageViewPermissions->count() === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,4 +19,4 @@
|
|||||||
<small class="hide-over-m bold">{{ trans('common.delete') }}<br></small>
|
<small class="hide-over-m bold">{{ trans('common.delete') }}<br></small>
|
||||||
<small>{{ trans('settings.role_controlled_by_page_delete') }}</small>
|
<small>{{ trans('settings.role_controlled_by_page_delete') }}</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user