Esempio n. 1
0
 public function grantContact(Contact $contact)
 {
     $grant = false;
     if ($this->authorizationChecker->isGranted('ROLE_RS')) {
         $grant = true;
     } elseif ($this->authorizationChecker->isGranted('ROLE_RCA')) {
         if (in_array($this->userManager->getCurrent()->getAgency(), $contact->getAgencies()->toArray())) {
             $grant = true;
         }
     } elseif ($this->authorizationChecker->isGranted('ROLE_CA')) {
         foreach ($contact->getAccount()->getOwners() as $account_owner) {
             if ($account_owner->getUser() == $this->userManager->getCurrent() && !$account_owner->getEnd()) {
                 if (in_array($this->userManager->getCurrent()->getAgency(), $contact->getAgencies()->toArray())) {
                     $grant = true;
                     break;
                 }
             }
         }
     }
     return $grant;
 }
Esempio n. 2
0
 /**
  * Remove contacts
  *
  * @param \Enigmatic\CRMBundle\Entity\Contact $contacts
  */
 public function removeContact(\Enigmatic\CRMBundle\Entity\Contact $contacts)
 {
     $this->contacts->removeElement($contacts);
 }