Пример #1
0
 /**
  * @param int $courseId
  * @param int $owningSchoolId
  * @param UserInterface $user
  *
  * @return bool
  */
 protected function isViewGranted($courseId, $owningSchoolId, UserInterface $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 is instructing ILMs or offerings in this course
     // 3. the user is directing this course
     // 4. the user has READ rights on the course's owning school via the permissions system
     // 5. the user has READ rights on the course via the permissions system
     return $owningSchoolId === $user->getSchool()->getId() || $this->courseManager->isUserInstructingInCourse($user, $courseId) || $user->isDirectingCourse($courseId) || $this->permissionManager->userHasReadPermissionToSchool($user, $owningSchoolId) || $this->permissionManager->userHasReadPermissionToCourse($user, $courseId);
 }