Install Report Builder
Report Metadata
Examples

Symfony2/Doctrine Report Builder - Secure Metadata

If you are using a role based security (and not the default), the secure metadata provides a way to mark entities and properties as only being accessible by certain roles. This is useful for data that you want to only allow certain roles access to. For example in a user's table, you might decide that only administrators can see user names.

Enable Role Security

# config.yml
brown298_report_builder:
    builder:
        security_type: role
Annotation
/**
 * User
 *
 * @ORM\Table()
 * @ORM\Entity()
 *
 * Limit entire class
 * @Report\Secure(roles="ROLE_ADMIN")
 */
class User
{
...
    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=255)
     *
     * Limit a particular property
     * @Report\Secure(roles="ROLE_ADMIN")
     */
    private $password;
...
}
Yml
Brown298\ReportTest\Entity\User:
    Report:
        Secure:
            Roles: "ROLE_ADMIN" # limit entire class
        Properties:
            password:
                Secure:
                    Roles: "ROLE_ADMIN" # limit property