Example #1
0
 public function jsonSerialize()
 {
     return array_merge(parent::jsonSerialize(), array('value' => $this->getMap()));
 }
 public function jsonSerialize()
 {
     return array_merge(parent::jsonSerialize(), array('value' => array($this->getUsername(), $this->getPassword(), $this->getNote())));
 }
Example #3
0
 private function sharePassword(DatabaseRow $row, $username)
 {
     $shares = $row->getAttribute('shares');
     if ($shares == null) {
         $shares = new \stdClass();
     }
     if (array_key_exists($username, $shares)) {
         $share = $this->getDoctrine()->getRepository('PasswordSafeBundle:SharedPassword')->find($shares->{$username});
         if ($share->getOrigin() != $this->getUser()) {
             $share = new SharedPassword();
         }
     } else {
         $share = new SharedPassword();
     }
     $share->setOrigin($this->getUser());
     $receiver = $this->getDoctrine()->getRepository('PasswordSafeBundle:User')->find($username);
     $share->setReceiver($receiver);
     $encryptedData = $this->get('passwordSafe.rsaService')->encrypt($row, $receiver);
     $share->setEncryptedData($encryptedData);
     $this->getDoctrine()->getManager()->persist($share);
     $this->getDoctrine()->getManager()->flush();
     $shares->{$username} = $share->getId();
     $row->updateAttribute('shares', $shares);
 }