1 | <?php |
||
20 | class User implements UserInterface { |
||
21 | |||
22 | /** |
||
23 | * Holds the actual user data. |
||
24 | */ |
||
25 | private $userEntity; |
||
26 | |||
27 | /** |
||
28 | * The CRUDEntity fieldname of the username. |
||
29 | */ |
||
30 | protected $usernameField; |
||
31 | |||
32 | /** |
||
33 | * The fieldname of the password (hash). |
||
34 | */ |
||
35 | protected $passwordField; |
||
36 | |||
37 | /** |
||
38 | * The fieldname of the password hash salt. |
||
39 | */ |
||
40 | protected $saltField; |
||
41 | |||
42 | /** |
||
43 | * Hold password hash salt. |
||
44 | */ |
||
45 | private $roles; |
||
46 | |||
47 | /** |
||
48 | * Constructor. |
||
49 | * |
||
50 | * @param string $usernameField |
||
51 | * the username |
||
52 | * |
||
53 | * @param string $passwordField |
||
54 | * the password (hash) |
||
55 | * |
||
56 | * @param string $saltField |
||
57 | * the password hash salt |
||
58 | * |
||
59 | * @param Entity $userEntity |
||
60 | * the actual user data |
||
61 | * |
||
62 | * @param array $roles |
||
63 | * the roles |
||
64 | */ |
||
65 | public function __construct($usernameField, $passwordField, $saltField, Entity $userEntity, array $roles) { |
||
72 | |||
73 | /** |
||
74 | * Gets the roles. |
||
75 | * |
||
76 | * @return array |
||
77 | * the roles |
||
78 | */ |
||
79 | public function getRoles() { |
||
82 | |||
83 | /** |
||
84 | * Gets the password (hash). |
||
85 | * |
||
86 | * @return string |
||
87 | * the password |
||
88 | */ |
||
89 | public function getPassword() { |
||
92 | |||
93 | /** |
||
94 | * Gets the password hash salt. |
||
95 | * |
||
96 | * @return string |
||
97 | * the salt |
||
98 | */ |
||
99 | public function getSalt() { |
||
102 | |||
103 | /** |
||
104 | * Gets the username. |
||
105 | * |
||
106 | * @return string |
||
107 | * the username |
||
108 | */ |
||
109 | public function getUsername() { |
||
112 | |||
113 | /** |
||
114 | * Should erase some crucial data if needed. But nothing to do here in this |
||
115 | * implementation. |
||
116 | */ |
||
117 | public function eraseCredentials() { |
||
119 | |||
120 | /** |
||
121 | * Gets the user entity holding all data. |
||
122 | * |
||
123 | * @return Entity |
||
124 | * the user entity |
||
125 | */ |
||
126 | public function getUserEntity() { |
||
129 | |||
130 | } |
||
131 |