/** * @param CourseInterface $course * @param UserInterface $user * @return bool */ protected function isViewGranted($course, $user) { // grant VIEW privileges if at least one of the following // statements is true: // 1. the user's primary school is the course's owning school // 2. the user has READ rights on the course's owning school via the permissions system // 3. the user has READ rights on the course via the permissions system return $this->schoolsAreIdentical($course->getSchool(), $user->getSchool()) || $this->permissionManager->userHasReadPermissionToSchool($user, $course->getSchool()) || $this->permissionManager->userHasReadPermissionToCourse($user, $course); }