aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Entity/User.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle/Entity/User.php')
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index 48446e3c..f93c59c7 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -1,5 +1,15 @@
1<?php 1<?php
2 2
3// This permits to have the LdapUserInterface even when fr3d/ldap-bundle is not
4// in the packages
5namespace FR3D\LdapBundle\Model;
6
7interface LdapUserInterface
8{
9 public function setDn($dn);
10 public function getDn();
11}
12
3namespace Wallabag\UserBundle\Entity; 13namespace Wallabag\UserBundle\Entity;
4 14
5use Doctrine\Common\Collections\ArrayCollection; 15use Doctrine\Common\Collections\ArrayCollection;
@@ -16,6 +26,7 @@ use Wallabag\ApiBundle\Entity\Client;
16use Wallabag\CoreBundle\Entity\Config; 26use Wallabag\CoreBundle\Entity\Config;
17use Wallabag\CoreBundle\Entity\Entry; 27use Wallabag\CoreBundle\Entity\Entry;
18use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; 28use Wallabag\CoreBundle\Helper\EntityTimestampsTrait;
29use FR3D\LdapBundle\Model\LdapUserInterface;
19 30
20/** 31/**
21 * User. 32 * User.
@@ -28,7 +39,7 @@ use Wallabag\CoreBundle\Helper\EntityTimestampsTrait;
28 * @UniqueEntity("email") 39 * @UniqueEntity("email")
29 * @UniqueEntity("username") 40 * @UniqueEntity("username")
30 */ 41 */
31class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface 42class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface, LdapUserInterface
32{ 43{
33 use EntityTimestampsTrait; 44 use EntityTimestampsTrait;
34 45
@@ -68,6 +79,13 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
68 protected $email; 79 protected $email;
69 80
70 /** 81 /**
82 * @var string
83 *
84 * @ORM\Column(name="dn", type="text", nullable=true)
85 */
86 protected $dn;
87
88 /**
71 * @var \DateTime 89 * @var \DateTime
72 * 90 *
73 * @ORM\Column(name="created_at", type="datetime") 91 * @ORM\Column(name="created_at", type="datetime")
@@ -309,4 +327,33 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
309 return $this->clients->first(); 327 return $this->clients->first();
310 } 328 }
311 } 329 }
330
331 /**
332 * Set dn.
333 *
334 * @param string $dn
335 *
336 * @return User
337 */
338 public function setDn($dn)
339 {
340 $this->dn = $dn;
341
342 return $this;
343 }
344
345 /**
346 * Get dn.
347 *
348 * @return string
349 */
350 public function getDn()
351 {
352 return $this->dn;
353 }
354
355 public function isLdapUser()
356 {
357 return $this->dn !== null;
358 }
312} 359}