예제 #1
0
 /**
  * Send an email informing someone that they've been granted access to a
  * resource (show, society, or venue).
  */
 public function sendPendingAceEmail(PendingAccess $ace)
 {
     $message = \Swift_Message::newInstance()->setFrom($this->from_address)->setTo($ace->getEmail());
     /* Get the resource and pass it to the template. */
     switch ($ace->getType()) {
         case 'show':
             $entity = $this->em->getRepository('ActsCamdramBundle:Show')->findOneById($ace->getRid());
             break;
         case 'society':
             $entity = $this->em->getRepository('ActsCamdramBundle:Society')->findOneById($ace->getRid());
             break;
         case 'venue':
             $entity = $this->em->getRepository('ActsCamdramBundle:Venue')->findOneById($ace->getRid());
             break;
     }
     $message->setSubject('Access to ' . $ace->getType() . ' ' . $entity->getName() . ' on Camdram granted')->setBody($this->twig->render('ActsCamdramBundle:Email:ace.txt.twig', array('is_pending' => true, 'ace' => $ace, 'entity' => $entity)));
     $this->mailer->send($message);
 }
예제 #2
0
 /**
  * Log the he person that they have been granted access to a resource on the
  * site, pending creating an account.
  */
 public function postPersist(PendingAccess $pending_ace, LifecycleEventArgs $event)
 {
     $this->logger->info(sprintf('%s has granted access for %s to edit %s %d.', $pending_ace->getIssuer()->getName(), $pending_ace->getEmail(), $pending_ace->getType(), $pending_ace->getRid()));
 }
예제 #3
0
 /**
  * Does this match a pre-existing pending access token?
  *
  * This is a lightweight test for equality; is the same email address being
  * granted access to the same resource.
  */
 public function isDuplicate(PendingAccess $ace)
 {
     $qb = $this->createQueryBuilder('p')->where('p.rid = :rid')->andWhere('p.type = :type')->andWhere('p.email = :email')->setParameters(array('rid' => $ace->getRid(), 'type' => $ace->getType(), 'email' => $ace->getEmail()));
     $result = $qb->getQuery()->getOneOrNullResult();
     return $result == null ? false : true;
 }