1212use BookStack \Entities \Repos \BookRepo ;
1313use BookStack \Entities \Repos \ChapterRepo ;
1414use BookStack \Entities \Repos \PageRepo ;
15+ use BookStack \Permissions \Permission ;
1516use BookStack \Uploads \Image ;
1617use BookStack \Uploads \ImageService ;
1718use Illuminate \Http \UploadedFile ;
@@ -49,7 +50,7 @@ public function cloneChapter(Chapter $original, Book $parent, string $newName):
4950
5051 $ copyChapter = $ this ->chapterRepo ->create ($ chapterDetails , $ parent );
5152
52- if (userCan (\ BookStack \ Permissions \ Permission::PageCreate, $ copyChapter )) {
53+ if (userCan (Permission::PageCreate, $ copyChapter )) {
5354 /** @var Page $page */
5455 foreach ($ original ->getVisiblePages () as $ page ) {
5556 $ this ->clonePage ($ page , $ copyChapter , $ page ->name );
@@ -61,7 +62,7 @@ public function cloneChapter(Chapter $original, Book $parent, string $newName):
6162
6263 /**
6364 * Clone the given book.
64- * Clones all child chapters & pages.
65+ * Clones all child chapters and pages.
6566 */
6667 public function cloneBook (Book $ original , string $ newName ): Book
6768 {
@@ -74,19 +75,19 @@ public function cloneBook(Book $original, string $newName): Book
7475 // Clone contents
7576 $ directChildren = $ original ->getDirectVisibleChildren ();
7677 foreach ($ directChildren as $ child ) {
77- if ($ child instanceof Chapter && userCan (\ BookStack \ Permissions \ Permission::ChapterCreate, $ copyBook )) {
78+ if ($ child instanceof Chapter && userCan (Permission::ChapterCreate, $ copyBook )) {
7879 $ this ->cloneChapter ($ child , $ copyBook , $ child ->name );
7980 }
8081
81- if ($ child instanceof Page && !$ child ->draft && userCan (\ BookStack \ Permissions \ Permission::PageCreate, $ copyBook )) {
82+ if ($ child instanceof Page && !$ child ->draft && userCan (Permission::PageCreate, $ copyBook )) {
8283 $ this ->clonePage ($ child , $ copyBook , $ child ->name );
8384 }
8485 }
8586
8687 // Clone bookshelf relationships
8788 /** @var Bookshelf $shelf */
8889 foreach ($ original ->shelves as $ shelf ) {
89- if (userCan (\ BookStack \ Permissions \ Permission::BookshelfUpdate, $ shelf )) {
90+ if (userCan (Permission::BookshelfUpdate, $ shelf )) {
9091 $ shelf ->appendBook ($ copyBook );
9192 }
9293 }
0 commit comments