1 | <?php |
||
14 | class LdapUser implements UserInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var string The unique usernam (LDAP: uid) of the represented user |
||
18 | */ |
||
19 | protected $username; |
||
20 | /** |
||
21 | * @var string The hashed password |
||
22 | */ |
||
23 | protected $password; |
||
24 | /** |
||
25 | * @var array All LDAP attributes |
||
26 | */ |
||
27 | protected $attributes; |
||
28 | /** |
||
29 | * @var array All roles associated with this user |
||
30 | */ |
||
31 | protected $roles; |
||
32 | /** |
||
33 | * @var array All groups the user is a member of |
||
34 | */ |
||
35 | protected $memberships; |
||
36 | /** |
||
37 | * @var array All groups the user is an owner of |
||
38 | */ |
||
39 | protected $ownerships; |
||
40 | |||
41 | /** |
||
42 | * LdapUser constructor, set members. |
||
43 | * |
||
44 | * @param string $username |
||
45 | * @param string $password |
||
46 | * @param array $attributes |
||
47 | * @param array $roles |
||
48 | * @param array $memberships |
||
49 | * @param array $ownerships |
||
50 | */ |
||
51 | public function __construct($username, $password, array $attributes = [], array $roles = [], array $memberships = [], array $ownerships = []) |
||
62 | |||
63 | /** |
||
64 | * Retrieve the requested attribute with $index, there may be many of any given kind. |
||
65 | * |
||
66 | * @param string $attribName The name of the attribute |
||
67 | * @param int $index The index. Set null, if an array containing all attributes should be returned |
||
68 | * @return string|array Returns the specified attribute of the user or an array containing all attributes, if $index is null |
||
69 | */ |
||
70 | public function getAttribute($attribName, $index = null) |
||
74 | |||
75 | /** |
||
76 | * Returns all attributes |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | public function getAttributes() |
||
84 | |||
85 | /** |
||
86 | * {@inheritdoc} |
||
87 | */ |
||
88 | public function getRoles() |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function getPassword() |
||
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | public function getSalt() |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function getUsername() |
||
117 | |||
118 | /** |
||
119 | * Returns the groups the user is member of. |
||
120 | * |
||
121 | * @return array The groups containing the user as member |
||
122 | */ |
||
123 | public function getGroups() |
||
127 | |||
128 | /** |
||
129 | * Returns the groups the user is owner of. |
||
130 | * |
||
131 | * @return array The groups containing the user as owner |
||
132 | */ |
||
133 | public function getOwnerships() |
||
137 | |||
138 | /** |
||
139 | * Get an attribute of one of the associated groups. |
||
140 | * |
||
141 | * @param int $groupIndex |
||
142 | * @param string $attribName |
||
143 | * @param null $index |
||
144 | * @return array|mixed |
||
145 | */ |
||
146 | public function getGroupAttribute($groupIndex, $attribName, $index = null) |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function eraseCredentials() |
||
158 | } |