Esempio n. 1
0
 /**
  * @param ObjectiveInterface $objective
  * @param UserInterface $user
  * @return bool
  */
 protected function isCreateEditDeleteGrantedForCourseObjective($objective, $user)
 {
     /* @var CourseInterface $course */
     $course = $objective->getCourses()->first();
     // there should ever only be one
     // Code below has been copy/pasted straight out of CourseVoter::isGranted().
     // TODO: consolidate. [ST 2015/08/05]
     // HALT!
     // deny DELETE and CREATE privileges if the owning course is locked or archived.
     if ($course->isArchived() || $course->isLocked()) {
         return false;
     }
     return $this->userHasRole($user, ['Faculty', 'Course Director', 'Developer']) && ($this->schoolsAreIdentical($course->getSchool(), $user->getSchool()) || $this->permissionManager->userHasWritePermissionToSchool($user, $course->getSchool())) || $this->permissionManager->userHasWritePermissionToCourse($user, $course);
 }
Esempio n. 2
0
 /**
  * @param ObjectiveInterface $descendant
  */
 public function removeDescendant(ObjectiveInterface $descendant)
 {
     $this->descendants->removeElement($descendant);
 }