mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-16 18:30:17 +01:00
Merge pull request #1786 from wallabag/v2-restrict-user-infos
API shows just what needed for user
This commit is contained in:
commit
17b3d026fd
@ -7,6 +7,9 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Hateoas\Configuration\Annotation as Hateoas;
|
||||
use JMS\Serializer\Annotation\Groups;
|
||||
use JMS\Serializer\Annotation\XmlRoot;
|
||||
use JMS\Serializer\Annotation\Exclude;
|
||||
use JMS\Serializer\Annotation\VirtualProperty;
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\AnnotationBundle\Entity\Annotation;
|
||||
@ -161,6 +164,8 @@ class Entry
|
||||
private $isPublic;
|
||||
|
||||
/**
|
||||
* @Exclude
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
|
||||
*
|
||||
* @Groups({"export_all"})
|
||||
@ -336,6 +341,33 @@ class Entry
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @VirtualProperty
|
||||
* @SerializedName("user_name")
|
||||
*/
|
||||
public function getUserName()
|
||||
{
|
||||
return $this->user->getUserName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @VirtualProperty
|
||||
* @SerializedName("user_email")
|
||||
*/
|
||||
public function getUserEmail()
|
||||
{
|
||||
return $this->user->getEmail();
|
||||
}
|
||||
|
||||
/**
|
||||
* @VirtualProperty
|
||||
* @SerializedName("user_id")
|
||||
*/
|
||||
public function getUserId()
|
||||
{
|
||||
return $this->user->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user