Exemplo n.º 1
0
 public function enforceOwnerSecurity(Event $event)
 {
     $user = $this->getUser();
     if ($user != $event->getOwner()) {
         throw $this->createAccessDeniedException('You are not the owner!!!');
     }
 }
Exemplo n.º 2
0
 public function enforceOwnerSecurity(Event $event)
 {
     $user = $this->getUser();
     if ($user != $event->getOwner()) {
         throw new AccessDeniedException('You do not own this!');
     }
 }
 public function enforceOwnerSecurity(Event $event)
 {
     $user = $this->getUser();
     if ($user != $event->getOwner()) {
         // if you're using 2.5 or higher
         // throw $this->createAccessDeniedException('You are not the owner!!!');
         throw new AccessDeniedException('You are not the owner!!!');
     }
 }
Exemplo n.º 4
0
 private function checkOwnerSecurity(Event $event)
 {
     if ($this->getUser() != $event->getOwner()) {
         throw new AccessDeniedException('Not the owner');
     }
 }
 /**
  * Simple function to enforce security - should be abstracted into a voter
  * Simple function to enforce security - should be abstracted into a voter
  *
  * @param Event $event
  * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException
  */
 private function checkOwnerSecurity(Event $event)
 {
     $user = $this->getUser();
     if ($this->get('security.context')->isGranted('ROLE_ADMIN')) {
         return;
     }
     if ($user == $event->getOwner()) {
         return;
     }
     throw new AccessDeniedException('You are not the owner!!!');
 }
Exemplo n.º 6
0
 /**
  * @param Event $event
  */
 private function checkOwnerSecurity(Event $event)
 {
     $user = $this->getSecurityContext()->getToken()->getUser();
     if ($user != $event->getOwner()) {
         throw new AccessDeniedException('You are not the owner!!!');
     }
 }
 private function checkCapacity(Event $event)
 {
     if ($this->getUser() != $event->getOwner()) {
         throw $this->createAccessDeniedException('You are not owner, you could not change this event !');
     }
 }