22
33namespace UserBase \Client \Model ;
44
5+ use LinkORB \Contracts \UserbaseRole \RoleInterface ;
56use Symfony \Component \Security \Core \User \AdvancedUserInterface ;
6- use Symfony \Component \Security \Core \Role \Role ;
77use RuntimeException ;
88
9- final class User implements UserInterface, AdvancedUserInterface, AccountContainerInterface, PolicyContainerInterface
9+ final class User implements
10+ AccountContainerInterface,
11+ AdvancedUserInterface,
12+ PolicyContainerInterface,
13+ RoleInterface,
14+ UserInterface
1015{
1116 private $ password ;
1217 private $ enabled ;
1318 private $ accountNonExpired ;
1419 private $ credentialsNonExpired ;
1520 private $ accountNonLocked ;
1621 private $ roles ;
17-
22+
1823 private $ createdAt ;
1924 private $ lastSeenAt ;
2025 private $ deletedAt ;
21-
26+
2227 private $ accountUsers = array ();
2328 private $ policies = array ();
2429
@@ -37,42 +42,42 @@ public function __construct($name)
3742 $ this ->roles = array ();
3843 $ this ->salt = "KJH6212kjwek_fj23D01-239.1023fkjdsj^k2hdfssfjk!h234uiy4324 " ;
3944 }
40-
45+
4146 public function getCreatedAt ()
4247 {
4348 return $ this ->createdAt ;
4449 }
45-
50+
4651 public function setCreatedAt ($ createdAt )
4752 {
4853 $ this ->createdAt = $ createdAt ;
4954 return $ this ;
5055 }
51-
56+
5257 public function getDeletedAt ()
5358 {
5459 return $ this ->deletedAt ;
5560 }
56-
61+
5762 public function setDeletedAt ($ deletedAt )
5863 {
5964 $ this ->deletedAt = $ deletedAt ;
6065 return $ this ;
6166 }
62-
67+
6368 public function getLastSeenAt ()
6469 {
6570 return $ this ->lastSeenAt ;
6671 }
67-
72+
6873 public function setLastSeenAt ($ lastSeenAt )
6974 {
7075 if ($ this ->lastSeenAt >0 ) {
7176 $ this ->lastSeenAt = $ lastSeenAt ;
7277 }
7378 return $ this ;
7479 }
75-
80+
7681 /**
7782 * {@inheritdoc}
7883 */
@@ -88,7 +93,7 @@ public function getPassword()
8893 {
8994 return $ this ->password ;
9095 }
91-
96+
9297 public function setPassword ($ password )
9398 {
9499 $ this ->password = $ password ;
@@ -115,18 +120,18 @@ public function setUsername($username)
115120 $ this ->name = $ username ;
116121 return $ this ;
117122 }
118-
123+
119124 public function getName ()
120125 {
121126 return $ this ->name ;
122127 }
123-
128+
124129 public function getDisplayName ()
125130 {
126131 $ account = $ this ->getUserAccount ();
127132 return $ account ->getDisplayName ();
128133 }
129-
134+
130135 /**
131136 * {@inheritdoc}
132137 */
@@ -165,7 +170,7 @@ public function isEnabled()
165170 {
166171 return $ this ->enabled ;
167172 }
168-
173+
169174 public function setEnabled ($ enabled )
170175 {
171176 $ this ->enabled = $ enabled ;
@@ -178,12 +183,12 @@ public function setEnabled($enabled)
178183 public function eraseCredentials ()
179184 {
180185 }
181-
186+
182187 public function getEmail ()
183188 {
184189 return $ this ->getUserAccount ()->getEmail ();
185190 }
186-
191+
187192 public function getPictureUrl ($ size = null )
188193 {
189194 return $ this ->getUserAccount ()->getPictureUrl ($ size );
@@ -193,12 +198,12 @@ public function addAccountUser(AccountUser $accountUser)
193198 {
194199 $ this ->accountUsers [] = $ accountUser ;
195200 }
196-
201+
197202 public function getAccountUsers ()
198203 {
199204 return $ this ->accountUsers ;
200205 }
201-
206+
202207 public function getAccounts ()
203208 {
204209 $ accounts = array ();
@@ -207,7 +212,7 @@ public function getAccounts()
207212 }
208213 return $ accounts ;
209214 }
210-
215+
211216 public function getUserAccount ()
212217 {
213218 foreach ($ this ->getAccounts () as $ account ) {
@@ -217,7 +222,7 @@ public function getUserAccount()
217222 }
218223 throw new RuntimeException ("This user has no user-account: " . $ this ->getName ());
219224 }
220-
225+
221226 public function getAccountsByType ($ type )
222227 {
223228 $ res = array ();
@@ -228,17 +233,17 @@ public function getAccountsByType($type)
228233 }
229234 return $ res ;
230235 }
231-
236+
232237 public function addPolicy (Policy $ policy )
233238 {
234239 $ this ->policies [] = $ policy ;
235240 }
236-
241+
237242 public function getPolicies ()
238243 {
239244 return $ this ->policies ;
240245 }
241-
246+
242247 public function addRole ($ roleName )
243248 {
244249 $ this ->roles [] = $ roleName ;
0 commit comments