- /**
- * Set the restrictions for this bookshelf.
- * @param $slug
- * @param Request $request
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws \BookStack\Exceptions\NotFoundException
- */
- public function restrict(string $slug, Request $request)
- {
- $bookshelf = $this->entityRepo->getBySlug('bookshelf', $slug);
- $this->checkOwnablePermission('restrictions-manage', $bookshelf);
-
- $this->entityRepo->updateEntityPermissionsFromRequest($request, $bookshelf);
- session()->flash('success', trans('entities.shelves_permissions_updated'));
- return redirect($bookshelf->getUrl());
- }
-
- /**
- * Copy the permissions of a bookshelf to the child books.
- * @param string $slug
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws \BookStack\Exceptions\NotFoundException
- */
- public function copyPermissions(string $slug)
- {
- $bookshelf = $this->entityRepo->getBySlug('bookshelf', $slug);
- $this->checkOwnablePermission('restrictions-manage', $bookshelf);
-
- $updateCount = $this->entityRepo->copyBookshelfPermissions($bookshelf);
- session()->flash('success', trans('entities.shelves_copy_permission_success', ['count' => $updateCount]));
- return redirect($bookshelf->getUrl());