1 | <?php |
||
20 | class User implements UserInterface |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Holds the actual user data. |
||
25 | */ |
||
26 | private $userData; |
||
27 | |||
28 | /** |
||
29 | * The CRUDEntity fieldname of the username. |
||
30 | */ |
||
31 | protected $usernameField; |
||
32 | |||
33 | /** |
||
34 | * The fieldname of the password (hash). |
||
35 | */ |
||
36 | protected $passwordField; |
||
37 | |||
38 | /** |
||
39 | * The fieldname of the password hash salt. |
||
40 | */ |
||
41 | protected $saltField; |
||
42 | |||
43 | /** |
||
44 | * Hold password hash salt. |
||
45 | */ |
||
46 | private $roles; |
||
47 | |||
48 | /** |
||
49 | * Constructor. |
||
50 | * |
||
51 | * @param string $usernameField |
||
52 | * the username |
||
53 | * |
||
54 | * @param string $passwordField |
||
55 | * the password (hash) |
||
56 | * |
||
57 | * @param string $saltField |
||
58 | * the password hash salt |
||
59 | * |
||
60 | * @param Entity $userEntity |
||
61 | * the actual user data |
||
62 | * |
||
63 | * @param array $roles |
||
64 | * the roles |
||
65 | */ |
||
66 | public function __construct($usernameField, $passwordField, $saltField, Entity $userEntity, array $roles) |
||
78 | |||
79 | /** |
||
80 | * Gets the roles. |
||
81 | * |
||
82 | * @return array |
||
83 | * the roles |
||
84 | */ |
||
85 | public function getRoles() |
||
89 | |||
90 | /** |
||
91 | * Gets the password (hash). |
||
92 | * |
||
93 | * @return string |
||
94 | * the password |
||
95 | */ |
||
96 | public function getPassword() |
||
100 | |||
101 | /** |
||
102 | * Gets the password hash salt. |
||
103 | * |
||
104 | * @return string |
||
105 | * the salt |
||
106 | */ |
||
107 | public function getSalt() |
||
111 | |||
112 | /** |
||
113 | * Gets the username. |
||
114 | * |
||
115 | * @return string |
||
116 | * the username |
||
117 | */ |
||
118 | public function getUsername() |
||
122 | |||
123 | /** |
||
124 | * Should erase some crucial data if needed. But nothing to do here in this |
||
125 | * implementation. |
||
126 | */ |
||
127 | public function eraseCredentials() |
||
130 | |||
131 | /** |
||
132 | * Gets the user data. |
||
133 | * |
||
134 | * @return array |
||
135 | * the user data |
||
136 | */ |
||
137 | public function getUserData() |
||
141 | |||
142 | } |
||
143 |