1 | <?php |
||
23 | class UserProvider implements UserProviderInterface { |
||
24 | |||
25 | /** |
||
26 | * The CRUDEntity fieldname of the username. |
||
27 | */ |
||
28 | protected $usernameField; |
||
29 | |||
30 | /** |
||
31 | * The fieldname of the password (hash). |
||
32 | */ |
||
33 | protected $passwordField; |
||
34 | |||
35 | /** |
||
36 | * The fieldname of the password hash salt. |
||
37 | */ |
||
38 | protected $saltField; |
||
39 | |||
40 | /** |
||
41 | * Holds the CRUDData instance to grab the user data from. |
||
42 | */ |
||
43 | protected $userData; |
||
44 | |||
45 | /** |
||
46 | * Holds the CRUDData instance to grab the user role data from. |
||
47 | */ |
||
48 | protected $userRoleData; |
||
49 | |||
50 | /** |
||
51 | * Constructor. |
||
52 | * |
||
53 | * @param Data $userData |
||
54 | * the Data instance to grab the user data from |
||
55 | * |
||
56 | * @param Data $userRoleData |
||
57 | * the Data instance to grab the user role data from |
||
58 | * |
||
59 | * @param string $usernameField |
||
60 | * the Entity fieldname of the username |
||
61 | * |
||
62 | * @param string $passwordField |
||
63 | * the Entity fieldname of the password hash |
||
64 | * |
||
65 | * @param string $saltField |
||
66 | * the Entity fieldname of the password hash salt |
||
67 | */ |
||
68 | public function __construct(Data $userData, Data $userRoleData, $usernameField = 'username', $passwordField = 'password', $saltField = 'salt') { |
||
75 | |||
76 | /** |
||
77 | * Loads and returns an user by username. |
||
78 | * Throws an UsernameNotFoundException on not existing username. |
||
79 | * |
||
80 | * @param string $username |
||
81 | * the username |
||
82 | * |
||
83 | * @return User |
||
84 | * the loaded user |
||
85 | */ |
||
86 | public function loadUserByUsername($username) { |
||
111 | |||
112 | /** |
||
113 | * Reloads and returns the given user. |
||
114 | * Throws an UsernameNotFoundException if the user ceased to exist meanwhile. |
||
115 | * |
||
116 | * @param UserInterface $user |
||
117 | * the user to reload |
||
118 | * |
||
119 | * @return User |
||
120 | * the reloaded user |
||
121 | */ |
||
122 | public function refreshUser(UserInterface $user) { |
||
126 | |||
127 | /** |
||
128 | * Tests whether the given user class is supported by this UserProvider. |
||
129 | * |
||
130 | * @param string $class |
||
131 | * the user class name to test |
||
132 | * |
||
133 | * @return boolean |
||
134 | * true if the class is "CRUDlex\User" |
||
135 | */ |
||
136 | public function supportsClass($class) { |
||
139 | |||
140 | } |
||
141 |