1 | <?php |
||
16 | class AdUserProvider implements UserProviderInterface |
||
17 | { |
||
18 | private $usernamePatterns = array(); |
||
19 | private $recursiveGrouproles = false; |
||
20 | |||
21 | /** |
||
22 | * @var TranslatorInterface |
||
23 | */ |
||
24 | private $translator; |
||
25 | |||
26 | private $config = array(); |
||
27 | |||
28 | public function __construct(array $config, AdldapService $AdldapService, TranslatorInterface $translator) |
||
39 | |||
40 | /** |
||
41 | * Retrieves a configuration value. make all required test. |
||
42 | * |
||
43 | * @param string $name Key name |
||
44 | * @param mixed $default Default value |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | protected function getConfig($name, $default) |
||
58 | |||
59 | /** |
||
60 | * Loads the user for the given username. |
||
61 | * |
||
62 | * This method must throw UsernameNotFoundException if the user is not |
||
63 | * found. |
||
64 | * |
||
65 | * @param string $username The username |
||
66 | * |
||
67 | * @return AdUser |
||
68 | * |
||
69 | * @see UsernameNotFoundException |
||
70 | * |
||
71 | * @throws UsernameNotFoundException if the user is not found |
||
72 | * |
||
73 | */ |
||
74 | public function loadUserByUsername($username) |
||
94 | |||
95 | |||
96 | /** |
||
97 | * Retrieves the username from the login name, it is transformed using the username patterns. |
||
98 | * |
||
99 | * @param string $string |
||
100 | * |
||
101 | * @return string |
||
102 | * |
||
103 | * @throws \InvalidArgumentException |
||
104 | */ |
||
105 | public function getUsernameFromString($string) |
||
128 | |||
129 | /** |
||
130 | * Refreshes the user for the account interface. |
||
131 | * |
||
132 | * It is up to the implementation to decide if the user data should be |
||
133 | * totally reloaded (e.g. from the database), or if the UserInterface |
||
134 | * object can just be merged into some internal array of users / identity |
||
135 | * map. |
||
136 | * |
||
137 | * @param UserInterface $user |
||
138 | * |
||
139 | * @return UserInterface |
||
140 | * |
||
141 | * @throws UnsupportedUserException if the account is not supported |
||
142 | */ |
||
143 | public function refreshUser(UserInterface $user) |
||
157 | |||
158 | /** |
||
159 | * Fetches the user data via adLDAP and stores it in the provided $adUser. |
||
160 | * |
||
161 | * @param AdUser $adUser |
||
162 | * @param TokenInterface $token |
||
163 | * @param adLDAP $adLdap |
||
164 | */ |
||
165 | public function fetchData(AdUser $adUser, TokenInterface $token, adLDAP $adLdap) |
||
204 | |||
205 | /** |
||
206 | * Whether this provider supports the given user class |
||
207 | * |
||
208 | * @param string $class |
||
209 | * |
||
210 | * @return Boolean |
||
211 | */ |
||
212 | public function supportsClass($class) |
||
216 | } |
||
217 |