1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\UserBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use FOS\UserBundle\Entity\User as BaseUser; |
7
|
|
|
|
8
|
|
|
abstract class User extends BaseUser |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var string |
12
|
|
|
* |
13
|
|
|
* @ORM\Column(name="created", type="datetime", nullable=false) |
14
|
|
|
*/ |
15
|
|
|
protected $created; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
* |
20
|
|
|
* @ORM\Column(name="activated", type="boolean") |
21
|
|
|
*/ |
22
|
|
|
protected $activated; |
23
|
|
|
|
24
|
|
|
public function __construct() |
25
|
|
|
{ |
26
|
|
|
parent::__construct(); |
27
|
|
|
$this->created = new \DateTime(); |
|
|
|
|
28
|
|
|
$this->activated = false; |
|
|
|
|
29
|
|
|
$this->enabled = true; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getWSSEToken() |
33
|
|
|
{ |
34
|
|
|
$nonce = hash_hmac('sha512', uniqid(null, true), uniqid(), true); |
35
|
|
|
$created = new \DateTime('now'); |
36
|
|
|
$created = $created->format(\DateTime::ISO8601); |
37
|
|
|
$digest = sha1($nonce.$created.$this->getPassword(), true); |
38
|
|
|
|
39
|
|
|
return sprintf( |
40
|
|
|
'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"', |
41
|
|
|
$this->getUsername(), |
42
|
|
|
$digest, |
43
|
|
|
$nonce, |
44
|
|
|
$created |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function __toString() |
49
|
|
|
{ |
50
|
|
|
return $this->username; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getParent() |
54
|
|
|
{ |
55
|
|
|
return 'FOSUserBundle'; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Gets the value of created. |
60
|
|
|
* |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function getCreated() |
64
|
|
|
{ |
65
|
|
|
return $this->created; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Sets the value of created. |
70
|
|
|
* |
71
|
|
|
* @param string $created the created |
72
|
|
|
* |
73
|
|
|
* @return self |
74
|
|
|
*/ |
75
|
|
|
public function setCreated($created) |
76
|
|
|
{ |
77
|
|
|
$this->created = $created; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Gets the value of activated. |
84
|
|
|
* |
85
|
|
|
* @return string |
86
|
|
|
*/ |
87
|
|
|
public function getActivated() |
88
|
|
|
{ |
89
|
|
|
return $this->activated; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Sets the value of activated. |
94
|
|
|
* |
95
|
|
|
* @param string $activated the activated |
96
|
|
|
* |
97
|
|
|
* @return self |
98
|
|
|
*/ |
99
|
|
|
public function setActivated($activated) |
100
|
|
|
{ |
101
|
|
|
$this->activated = $activated; |
102
|
|
|
|
103
|
|
|
return $this; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..