/** * @param string $attribute * @param IlmSessionInterface $ilmFacet * @param TokenInterface $token * @return bool */ protected function voteOnAttribute($attribute, $ilmFacet, TokenInterface $token) { // grant perms based on the session $session = $ilmFacet->getSession(); if (!$session) { return false; } return parent::voteOnAttribute($attribute, $session, $token); }
/** * @param string $attribute * @param OfferingInterface $offering * @param TokenInterface $token * @return bool */ protected function voteOnAttribute($attribute, $offering, TokenInterface $token) { $session = $offering->getSession(); if (!$session) { return false; } // grant perms based on the owning session return parent::voteOnAttribute($attribute, $session, $token); }
/** * @param string $attribute * @param SessionLearningMaterialInterface $material * @param TokenInterface $token * @return bool */ protected function voteOnAttribute($attribute, $material, TokenInterface $token) { $session = $material->getSession(); if (!$session) { return false; } // grant perms based on the owning session $granted = parent::voteOnAttribute($attribute, $session, $token); // prevent access if associated LM is in draft, and the current user has no elevated privileges. if ($granted && self::VIEW === $attribute) { $granted = $this->userHasRole($token->getUser(), ['Faculty', 'Course Director', 'Developer']) || LearningMaterialStatusInterface::IN_DRAFT !== $material->getLearningMaterial()->getStatus()->getId(); } return $granted; }