- } elseif ($entity->isA('page')) {
-
- if (!$entity->restricted) {
- $book = $this->getBook($entity->book_id);
- $hasExplicitAccessToBook = $book->hasActiveRestriction($role->id, $restrictionAction);
- $hasPermissiveAccessToBook = !$book->restricted;
-
- $chapter = $this->getChapter($entity->chapter_id);
- $hasExplicitAccessToChapter = $chapter && $chapter->hasActiveRestriction($role->id, $restrictionAction);
- $hasPermissiveAccessToChapter = $chapter && !$chapter->restricted;
- $acknowledgeChapter = ($chapter && $chapter->restricted);
-
- $hasExplicitAccessToParents = $acknowledgeChapter ? $hasExplicitAccessToChapter : $hasExplicitAccessToBook;
- $hasPermissiveAccessToParents = $acknowledgeChapter ? $hasPermissiveAccessToChapter : $hasPermissiveAccessToBook;
-
- return $this->createJointPermissionDataArray($entity, $role, $action,
- ($hasExplicitAccessToParents || ($roleHasPermission && $hasPermissiveAccessToParents)),
- ($hasExplicitAccessToParents || ($roleHasPermissionOwn && $hasPermissiveAccessToParents))
- );
- } else {
- $hasAccess = $entity->hasRestriction($role->id, $action);
- return $this->createJointPermissionDataArray($entity, $role, $action, $hasAccess, $hasAccess);
- }
+ return $this->createJointPermissionDataArray($entity, $role, $action,
+ ($hasExplicitAccessToParents || ($roleHasPermission && $hasPermissiveAccessToParents)),
+ ($hasExplicitAccessToParents || ($roleHasPermissionOwn && $hasPermissiveAccessToParents))
+ );
+ }