1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* UserService class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace eZ\Publish\Core\Repository\SiteAccessAware; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\UserService as UserServiceInterface; |
12
|
|
|
use eZ\Publish\API\Repository\Values\Content\Content; |
13
|
|
|
use eZ\Publish\API\Repository\Values\User\PasswordInfo; |
14
|
|
|
use eZ\Publish\API\Repository\Values\User\PasswordValidationContext; |
15
|
|
|
use eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct; |
16
|
|
|
use eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct; |
17
|
|
|
use eZ\Publish\API\Repository\Values\User\UserCreateStruct; |
18
|
|
|
use eZ\Publish\API\Repository\Values\User\UserGroup; |
19
|
|
|
use eZ\Publish\API\Repository\Values\User\User; |
20
|
|
|
use eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct; |
21
|
|
|
use eZ\Publish\API\Repository\Values\User\UserUpdateStruct; |
22
|
|
|
use eZ\Publish\API\Repository\LanguageResolver; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* UserService for SiteAccessAware layer. |
26
|
|
|
* |
27
|
|
|
* Currently does nothing but hand over calls to aggregated service. |
28
|
|
|
*/ |
29
|
|
|
class UserService implements UserServiceInterface |
30
|
|
|
{ |
31
|
|
|
/** @var \eZ\Publish\API\Repository\UserService */ |
32
|
|
|
protected $service; |
33
|
|
|
|
34
|
|
|
/** @var \eZ\Publish\API\Repository\LanguageResolver */ |
35
|
|
|
protected $languageResolver; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Construct service object from aggregated service. |
39
|
|
|
* |
40
|
|
|
* @param \eZ\Publish\API\Repository\UserService $service |
41
|
|
|
* @param \eZ\Publish\API\Repository\LanguageResolver $languageResolver |
42
|
|
|
*/ |
43
|
|
|
public function __construct( |
44
|
|
|
UserServiceInterface $service, |
45
|
|
|
LanguageResolver $languageResolver |
46
|
|
|
) { |
47
|
|
|
$this->service = $service; |
48
|
|
|
$this->languageResolver = $languageResolver; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function createUserGroup(UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup) |
52
|
|
|
{ |
53
|
|
|
return $this->service->createUserGroup($userGroupCreateStruct, $parentGroup); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function loadUserGroup($id, array $prioritizedLanguages = null) |
57
|
|
|
{ |
58
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
59
|
|
|
|
60
|
|
|
return $this->service->loadUserGroup($id, $prioritizedLanguages); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function loadSubUserGroups(UserGroup $userGroup, $offset = 0, $limit = 25, array $prioritizedLanguages = null) |
64
|
|
|
{ |
65
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
66
|
|
|
|
67
|
|
|
return $this->service->loadSubUserGroups($userGroup, $offset, $limit, $prioritizedLanguages); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function deleteUserGroup(UserGroup $userGroup) |
71
|
|
|
{ |
72
|
|
|
return $this->service->deleteUserGroup($userGroup); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function moveUserGroup(UserGroup $userGroup, UserGroup $newParent) |
76
|
|
|
{ |
77
|
|
|
return $this->service->moveUserGroup($userGroup, $newParent); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function updateUserGroup(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct) |
81
|
|
|
{ |
82
|
|
|
return $this->service->updateUserGroup($userGroup, $userGroupUpdateStruct); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function createUser(UserCreateStruct $userCreateStruct, array $parentGroups) |
86
|
|
|
{ |
87
|
|
|
return $this->service->createUser($userCreateStruct, $parentGroups); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function loadUser($userId, array $prioritizedLanguages = null) |
91
|
|
|
{ |
92
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
93
|
|
|
|
94
|
|
|
return $this->service->loadUser($userId, $prioritizedLanguages); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function loadAnonymousUser() |
98
|
|
|
{ |
99
|
|
|
return $this->service->loadAnonymousUser(); |
|
|
|
|
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function loadUserByCredentials($login, $password, array $prioritizedLanguages = null) |
103
|
|
|
{ |
104
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
105
|
|
|
|
106
|
|
|
return $this->service->loadUserByCredentials($login, $password, $prioritizedLanguages); |
|
|
|
|
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function checkUserCredentials(User $user, string $credentials): bool |
110
|
|
|
{ |
111
|
|
|
return $this->service->checkUserCredentials($user, $credentials); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function loadUserByLogin($login, array $prioritizedLanguages = null) |
115
|
|
|
{ |
116
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
117
|
|
|
|
118
|
|
|
return $this->service->loadUserByLogin($login, $prioritizedLanguages); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function loadUsersByEmail($email, array $prioritizedLanguages = null) |
122
|
|
|
{ |
123
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
124
|
|
|
|
125
|
|
|
return $this->service->loadUsersByEmail($email, $prioritizedLanguages); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function deleteUser(User $user) |
129
|
|
|
{ |
130
|
|
|
return $this->service->deleteUser($user); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function updateUser(User $user, UserUpdateStruct $userUpdateStruct) |
134
|
|
|
{ |
135
|
|
|
return $this->service->updateUser($user, $userUpdateStruct); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function assignUserToUserGroup(User $user, UserGroup $userGroup) |
139
|
|
|
{ |
140
|
|
|
return $this->service->assignUserToUserGroup($user, $userGroup); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function unAssignUserFromUserGroup(User $user, UserGroup $userGroup) |
144
|
|
|
{ |
145
|
|
|
return $this->service->unAssignUserFromUserGroup($user, $userGroup); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public function loadUserGroupsOfUser(User $user, $offset = 0, $limit = 25, array $prioritizedLanguages = null) |
149
|
|
|
{ |
150
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
151
|
|
|
|
152
|
|
|
return $this->service->loadUserGroupsOfUser($user, $offset, $limit, $prioritizedLanguages); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public function loadUsersOfUserGroup(UserGroup $userGroup, $offset = 0, $limit = 25, array $prioritizedLanguages = null) |
156
|
|
|
{ |
157
|
|
|
$prioritizedLanguages = $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages); |
158
|
|
|
|
159
|
|
|
return $this->service->loadUsersOfUserGroup($userGroup, $offset, $limit, $prioritizedLanguages); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function loadUserByToken($hash, array $prioritizedLanguages = null) |
163
|
|
|
{ |
164
|
|
|
return $this->service->loadUserByToken( |
165
|
|
|
$hash, |
166
|
|
|
$this->languageResolver->getPrioritizedLanguages($prioritizedLanguages) |
167
|
|
|
); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function updateUserToken(User $user, UserTokenUpdateStruct $userTokenUpdateStruct) |
171
|
|
|
{ |
172
|
|
|
return $this->service->updateUserToken($user, $userTokenUpdateStruct); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
public function expireUserToken($hash) |
176
|
|
|
{ |
177
|
|
|
return $this->service->expireUserToken($hash); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
public function isUser(Content $content): bool |
181
|
|
|
{ |
182
|
|
|
return $this->service->isUser($content); |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
public function isUserGroup(Content $content): bool |
186
|
|
|
{ |
187
|
|
|
return $this->service->isUserGroup($content); |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
public function newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType = null) |
191
|
|
|
{ |
192
|
|
|
return $this->service->newUserCreateStruct($login, $email, $password, $mainLanguageCode, $contentType); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
public function newUserGroupCreateStruct($mainLanguageCode, $contentType = null) |
196
|
|
|
{ |
197
|
|
|
return $this->service->newUserGroupCreateStruct($mainLanguageCode, $contentType); |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
public function newUserUpdateStruct() |
201
|
|
|
{ |
202
|
|
|
return $this->service->newUserUpdateStruct(); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function newUserGroupUpdateStruct() |
206
|
|
|
{ |
207
|
|
|
return $this->service->newUserGroupUpdateStruct(); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function validatePassword(string $password, PasswordValidationContext $context = null): array |
211
|
|
|
{ |
212
|
|
|
return $this->service->validatePassword($password, $context); |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function getPasswordInfo(User $user): PasswordInfo |
216
|
|
|
{ |
217
|
|
|
return $this->service->getPasswordInfo($user); |
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.