]> BookStack Code Mirror - bookstack/commitdiff
Merge pull request #11 from BookStackApp/master
authorAbijeet Patro <redacted>
Mon, 15 May 2017 16:55:33 +0000 (22:25 +0530)
committerGitHub <redacted>
Mon, 15 May 2017 16:55:33 +0000 (22:25 +0530)
Fixed chapter check for non-mysqlnd instances

1  2 
app/Services/PermissionService.php

index c86ef0e7aa51354d375203727a34e9e9abdfbf32,6f9561a161ed0a8dc8ac85f00c317b1d9df23706..89f80f9360a878f6224a36853a399c691221a6a1
@@@ -399,7 -399,7 +399,7 @@@ class PermissionServic
          $hasPermissiveAccessToParents = !$book->restricted;
  
          // For pages with a chapter, Check if explicit permissions are set on the Chapter
-         if ($entity->isA('page') && $entity->chapter_id !== 0) {
+         if ($entity->isA('page') && $entity->chapter_id !== 0 && $entity->chapter_id !== '0') {
              $chapter = $this->getChapter($entity->chapter_id);
              $hasPermissiveAccessToParents = $hasPermissiveAccessToParents && !$chapter->restricted;
              if ($chapter->restricted) {
          $action = end($explodedPermission);
          $this->currentAction = $action;
  
 -        $nonJointPermissions = ['restrictions', 'image', 'attachment'];
 +        $nonJointPermissions = ['restrictions', 'image', 'attachment', 'comment'];
  
          // Handle non entity specific jointPermissions
          if (in_array($explodedPermission[0], $nonJointPermissions)) {